SCAR Code:
Program VialBuyer;
{ script by me}
{.include SRL/SRL/Misc/Smart.scar}
{.include SRL\SRL.scar}
{.include srl/srl/reflection/reflection.scar}
{
~Credits:
1. Me.
2. shuttleu for answering some questions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
var
RoadPoints, Path : TPointArray;
Position: TPoint;
i, Click :integer;
WalkDTM0, WalkDTM1, WalkDTM2, WalkDTM3, WalkDTM4 : integer;
x, y, Vials, ArdoRoadColor, ShopFloorColor : integer;
RoadRecord, ShopRecord : TAutoColorInfo;
Banker, ShopKeeper :TNPC;
const
GEWealth = 80; // Price of Vial in the Grand Exchange
NumVials = 0; // How many Vials do u have already?
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3 lowercase letters of ur name
Players[0].Active := true; // Will u be using this player?
Players[0].loc := ''; // DONT TOUCH THIS
{
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := '';
Players[1].Active := true;
Players[1].loc := '';
Players[2].Name := '';
Players[2].Pass := '';
Players[2].Nick := '';
Players[2].Active := true;
Players[2].loc := ''; }
end;
Procedure LoadDTMs;
begin
WalkDTM0 := DTMFromString('78DA635CCAC4C090C980022A0A6218E480342' +
'310FF0702C6254035E9A86ABE7D7A0F5703028C738954934340CD' +
'1222D47400D5C41250D30F54138E5F0D00F3E21E3A');
WalkDTM1 := DTMFromString('78DA63B4676260B0654001E525B90C72409A1' +
'188FF0301A339504D286E3520C0E80854E341408D2B508D33AA9A' +
'AFDF3FA1AA09C7740F869A30A01A77FC6A00EA7114B5');
WalkDTM2 := DTMFromString('78DA63B4676260B0604001A545D90C72409A1' +
'188FF0301A315508D23AA9A77EFDEC1D58000A30D508D3E01356E' +
'403596B8ED02ABF101AA714255F3F6C3275435FE4035F6F8D5000' +
'0CB9D1597');
WalkDTM3 := DTMFromString('78DA637465626008644001E525B90C72409A1' +
'188FF0301A31B508D37AA9AAF6FBEC0D58000A333504D180135BE' +
'403551A86ADE0131861A7FDCEE01010025E010F2');
WalkDTM4 := DTMFromString('78DA638C676260C86640011505310C72409A1' +
'188FF03016304504D26AA9A6F9FDEC3D5800023C89C42026A2208' +
'AB01003B611172');
writeln('DTM''s Loaded.')
end;
procedure LoadRecord;
begin
with RoadRecord do
begin
MinCount := 100;
Color := 8094342;
HueMod := 0.38;
SatMod := 0.19;
LumTol := 4;
MinR := 124; MaxR := 143;
MinG := 120; MaxG := 140;
MinB := 115; MaxB := 132;
MinX := 18.43; MaxX := 24.50;
MinY := 19.28; MaxY := 25.87;
MinZ := 19.25; MaxZ := 25.19;
end;
with ShopRecord do
begin
MinCount := 100;
Color := 6057847;
HueMod := 0.40;
SatMod := 0.25;
LumTol := 5;
MinR := 106; MaxR := 132;
MinG := 97; MaxG := 126;
MinB := 81; MaxB := 104;
MinX := 11.93; MaxX := 19.01;
MinY := 12.45; MaxY := 20.43;
MinZ := 9.74; MaxZ := 15.78;
end;
end;
procedure LoadReflectionPath;
begin
SetLength(Path, 5);
Path[0] := Point(2655, 3283);
Path[1] := Point(2643, 3289);
Path[2] := Point(2629, 3296);
Path[3] := Point(2617, 3297);
Path[4] := Point(2614, 3292);
end;
function OpenArdoBank : Boolean;
var
BankPoints: TPointArray;
begin
if (not(LoggedIn)) then exit;
begin
FindNPCByID(494, Banker);
if TileOnMS(Banker.tile, 30) then
position:=TileToMS(Banker.tile, 30);
MMouse(position.x, position.y, 0, 0);
Wait(200+random(400));
if IsUptextMultiCustom(['ank', 'ker', 'alk']) then
begin
Wait(200+random(500));
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(200));
ChooseOption('ank');
Result:=True;
end;
end;
if (not(Result)) then
begin
if TileOnMS(Point(2656, 3283), 15) then
begin
position:=TileToMS(Point(2656, 3283), 30);
MMouse(position.x, position.y, 0, 0);
Wait(200+random(400));
if IsUptextMultiCustom(['ank', 'oot', 'oth']) then
begin
Wait(200+random(500));
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(200));
ChooseOption('uic');
Result:=True;
end;
end;
end;
if (not(Result)) then
begin
FindColorsSpiralTolerance(MSCX, MSCY, BankPoints, 3755092, MSX1, MSY1, MSX2, MSY2, 6);
if Length(BankPoints)=0 then
begin
Writeln('Could not find the BankBooth');
Logout;
exit;
end;
for i:=0 to High(BankPoints) do
begin
MMouse(BankPoints[i].x, BankPoints[i].y, 3, 3);
Wait(200+random(400));
if IsUpTextMultiCustom(['ank', 'oot', 'oth']) then
begin
Wait(200+random(500));
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(200));
ChooseOption('uic');
Result:= True;
exit;
end;
end;
end;
end;
{*******************************************************************************
Name: CheckRun
By: me
Discription: Its supposed to check the color of the 'run' orb on the minimap,
and if its green, to set run on. Im not sure if this works.
*******************************************************************************}
Procedure CheckRun;
var
RunP : integer;
Energy : String;
begin
if (not(LoggedIn)) then Exit;
RunP := GetMMLevels('run', Energy)
if(Energy = 'green') or (RunP >= 40) then
begin
writeln('Setting Run on...');
SetRun(True);
end;
end;
{*******************************************************************************
Name: AntiBan
By: me
Discription: A quick Anti-Ban
*******************************************************************************}
procedure AntiBan;
begin
if (not(LoggedIn)) then Exit;
case Random(28) of //Has 50% chance of performing an Anti-Ban.
0,3,6,7,12,16,24:begin
idleTime(500+random(500),200,0.01);
end;
1,4,9:begin
mmouse(random(msx2),random(msy2),0,0);
Wait(1000+random(670));
GameTab(4);
end;
2,5,18,22:begin
HoverSkill('random', False);
Wait(1000+random(500));
GameTab(4);
end;
4:Begin
mmouse(random(msx2),random(msy2),0,0);
wait(400+random(400));
mouse(x,y,0,0,false);
chooseoption('xamin');
end;
end;
end;
{*******************************************************************************
Name: ToStore;
By: me
Description: Walks Player to Ardougne General Store from South Bank.
*******************************************************************************}
Procedure ToStore;
begin
if (not(LoggedIn)) then Exit;
if TileOnMM(Path[1]) then
begin
if WalkToTile(Path[1], 3, 6)then
Players[CurrentPlayer].loc := '[To store] Reflection tile #1';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 280, 310, 65) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To store] Color click #1';
Break;
end;
end else
if(DTMRotated(WalkDTM1, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To store] DTM #1';
end else
begin
Writeln('Unable to take first step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[2]) then
begin
if WalkToTile(Path[2], 3, 6)then
Players[CurrentPlayer].loc := '[To store] Reflection tile #2';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 280, 310, 65) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To store] Color click #2';
Break;
end;
end else
if(DTMRotated(WalkDTM2, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To store] DTM #2';
end else
begin
Writeln('Unable to take second step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[3]) then
begin
if WalkToTile(Path[3], 3, 6)then
Players[CurrentPlayer].loc := '[To store] Reflection tile #3';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 290, 255, 60) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To store] Color click #3';
Break;
end;
end else
if(DTMRotated(WalkDTM3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To store] DTM #3';
end else
begin
Writeln('Unable to take third step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[4]) then
begin
if WalkToTile(Path[4], 3, 6)then
Players[CurrentPlayer].loc := '[To store] Reflection tile #4';
end else
if(FindSymbol(x, y, 'store'))then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To store] Shop';
end else
if(not(ShopFloorColor > 0)) then
ShopFloorColor:= FindColorRecordEx(x, y, ShopRecord, MMX1, MMY1, MMX2, MMY2, True);
if (ShopFloorColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ShopFloorColor, 0, 229, 175, 30) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To store] Color click #4';
Break;
end;
end else
if(DTMRotated(WalkDTM2, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To store] DTM #4';
end else
begin
Writeln('Unable to step into the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
end;
{*******************************************************************************
Name: FindKeepers;
By: me
Discription: Finds the Ardougne general store shop keepers, If not found the 1st
time, it clicks shop on the minimap, and tries again. If still not
successful, it logs out, and switches player.
*******************************************************************************}
Function OpenShopTrade : Boolean;
var
KortanPoints: TPointArray;
begin
if (not(LoggedIn)) then exit;
begin
FindNPCByID(591, ShopKeeper);
if TileOnMS(ShopKeeper.tile, 30) then
position:=TileToMS(ShopKeeper.tile, 30);
MMouse(position.x, position.y, 0, 0);
Wait(200+random(400));
if IsUptextMultiCustom(['ort', 'tan', 'alk']) then
begin
Wait(200+random(500));
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(200));
ChooseOption('ade');
Result:=True;
end;
end;
if (not(Result)) then
begin
FindColorsSpiralTolerance(MSCX, MSCY, KortanPoints, 7708110, MSX1, MSY1, MSX2, MSY2, 6);
if Length(KortanPoints)=0 then
begin
Writeln('Could not find the Kortan (ShopKeeper)');
Logout;
exit;
end;
for i:=0 to High(KortanPoints) do
begin
MMouse(KortanPoints[i].x, KortanPoints[i].y, 3, 3);
Wait(200+random(400));
if IsUpTextMultiCustom(['ort', 'tan', 'alk']) then
begin
Wait(200+random(500));
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(200));
ChooseOption('ade');
Result:= True;
exit;
end;
end;
end;
end;
{*******************************************************************************
Name: FreeDTMs;
By: me
Discription: Frees the DTMs, reducing LAG. (Hopefully).
*******************************************************************************}
Procedure FreeDTMs;
begin
FreeDTM(WalkDTM0);
FreeDTM(WalkDTM1);
FreeDTM(WalkDTM2);
FreeDTM(WalkDTM3);
FreeDTM(WalkDTM4);
Writeln('DTM''s freed :)');
end;
{*******************************************************************************
Name: BuyVials;
By: me
Discription: Uses FindKeepers; to open the general store, then checks to make
sure shop is in the right tab, if not it fixes, then buys vials,
hitting 2 keys that arenext to eachother. (unlike using a
randomness where the 2 keys can be on opposite sides of the keypad,
this is more human like.)
*******************************************************************************}
Procedure BuyVials;
begin
if (not(LoggedIn)) then Exit;
if ShopScreen then
begin
wait(random(2000));
MouseBox(67, 110, 92, 127, 3)
Wait(400+Random(400));
if(IsUpText('ial'))then
begin
GetMousePos(x, y);
wait(100);
Mouse(x,y,0,0,false)
ChooseOption('Buy X')
for i:=0 to 100 do
begin
inc(i);
Wait(75+random(25));
if (GetColor(227, 402) = 0) then
break;
end;
Wait(200+random(100));
TypeSend(inttostr(28+Random(72)));
end else
Writeln('Hmmm...Couldnt find any vials :(');
Mouse(478, 34, 15, 15, True);
Wait(500+random(400));
end else
Writeln('Hmmm... The shop screen wasn''t up :(');
end;
{*******************************************************************************
Name: ToBank;
By: me
Discription: Uses DTMs, with a RadialRoadWalk failsafe to walk to bank. If road
is not found, it sets the current player false, and goes to next
player.
*******************************************************************************}
Procedure ToBank;
begin
if (not(LoggedIn)) then Exit;
if TileOnMM(Path[3]) then
begin
if WalkToTile(Path[3], 3, 6)then
Players[CurrentPlayer].loc := '[To bank] Reflection tile #3';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 390, 335, 25) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To bank] Color click #3';
Break;
end;
end else
if(DTMRotated(WalkDTM3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To bank] DTM #3';
end else
begin
Writeln('Unable to take third step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[2]) then
begin
if WalkToTile(Path[2], 3, 6)then
Players[CurrentPlayer].loc := '[To bank] Reflection tile #2';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 100, 130, 65) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To bank] Color click #2';
Break;
end;
end else
if(DTMRotated(WalkDTM2, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To bank] DTM #2';
end else
begin
Writeln('Unable to take second step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[1]) then
begin
if WalkToTile(Path[1], 3, 6)then
Players[CurrentPlayer].loc := '[To bank] Reflection tile #1';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 100, 130, 65) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To bank] Color click #1';
Break;
end;
end else
if(DTMRotated(WalkDTM1, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To bank] DTM #1';
end else
begin
Writeln('Unable to take first step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
if TileOnMM(Path[0]) then
begin
if WalkToTile(Path[0], 3, 6)then
Players[CurrentPlayer].loc := '[To bank] Reflection tile #0';
end else
if(FindSymbol(x, y, 'bank'))then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To bank] bank';
end else
if(ArdoRoadColor > 0) then
begin
if RadialWalkEx(RoadPoints, MMCX, MMCY, ArdoRoadColor, 0, 110, 140, 65) then
for i := 0 to High(RoadPoints) do
if MFNF(RoadPoints[i].x, RoadPoints[i].y, 7, 7) then
begin
Players[CurrentPlayer].loc := '[To bank] Color click #0';
Break;
end;
end else
if(DTMRotated(WalkDTM0, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 7, 7, true);
Players[CurrentPlayer].loc := '[To bank] DTM #0';
end else
begin
Writeln('Unable to take first step to the shop');
Logout;
exit;
end;
MarkTime(Click);
Repeat
Wait(100+random(50));
FindNormalRandoms;
until (FFlag(6)) or (TimeFromMark(Click)>= 30000);
end;
{*******************************************************************************
Name: WithDraw;
By: me
Discription: Checks for BankScreen, then checks to see if Coins are in the 1st
slot. Withdraws them.
*******************************************************************************}
Procedure DoStuffWithBank;
var
coins, w: integer;
begin
if (not(LoggedIn)) then Exit;
if(Bankscreen)then
begin
FixBank;
DepositAll;
Coins:= DTMFromString('78DA638C62646098CA8006189148200D52338' +
'D809A684C7336F48B3268A0AB4133E7E36159143500B2F50744');
if FindDTM(Coins, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
MMouse(x+15, y, 5, 5);
Wait(400+random(400));
if IsUptext('oins') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(400+random(400));
ChooseOption('X');
w:= 0;
while w < 100 do
begin
Wait(75+Random(25));
inc(w);
if GetColor(259,404) = 0 then
Break;
end;
TypeSend('280');
w:= 0;
while w < 100 do
begin
Wait(75+Random(25));
inc(w);
if FindDTM(Coins, x, y, MIX1, MIY1, MIX2, MIY2) then
Break;
end;
CloseBank;
FreeDTM(Coins);
end else
begin
FreeDTM(Coins);
CloseBank;
Writeln('hmmm... though we found some coins but the Uptext was wrong :(');
end;
end else
begin
FreeDTM(Coins);
CloseBank;
Writeln('could not find any coins :(');
end;
end;
end;
function NoMorePlayers: boolean;
var i: integer;
begin
for i := 0 to Length(Players) - 1 do
begin
if Players[i].Active then
begin
result := false;
exit;
end;
end;
result := true;
end;
{*******************************************************************************
Name: Setup
By: me
Discription: Sets up the Scripts and players.
*******************************************************************************}
Procedure Setup;
begin
SmartSetupEx(23, True, True, False);
SetTargetDC(SMARTGetDC);
While Not (SmartGetColor(360, 172) = 13158) Do
Wait(100);
SetupSRL;
ActivateClient;
DeclarePlayers;
if(not LoggedIn) then LoginPlayer;
wait(1000+random(1000));
SetAngle(True);
MakeCompass('N');
wait(1000+random(1000));
end;
{*******************************************************************************
Name: Progress Report;
By: me
Discription: A Progress Report...
*******************************************************************************}
Procedure ProgressReport;
var TotalSpent, Profit, GEPrice : integer;
begin
TotalSpent := (Vials * 10);
GEPrice := Vials * GEWealth;
Profit := GEPrice - TotalSpent;
begin
Writeln('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
Writeln('||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||');
Writeln('|| yourock12345''s Vial Buyer v0.1 ||');
Writeln('|| Spent: ' + IntToStr(TotalSpent) + 'gp. ||');
Writeln('|| Bought: ' + IntToStr(Vials) + ' vials. ||');
Writeln('|| Profit: ' + IntToStr(Profit) + ' gp. ||');
Writeln('|| Ran For: ' + TimeRunning + ' ||');
Writeln('||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||');
writeln('|| Post This :) ||');
Writeln('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
end;
end;
{*******************************************************************************
------------------------------] MAIN LOOP! [------------------------------------
*******************************************************************************}
begin
Setup;
LoadDTMs;
LoadRecord;
LoadReflectionPath;
ArdoRoadColor:= FindColorRecordEx(x, y, RoadRecord, MMX1, MMY1, MMX2, MMY2, True);
repeat
ToStore;
OpenShopTrade;
BuyVials;
ToBank;
OpenArdoBank;
DoStuffWithBank;
until(NoMorePlayers)
end.