SCAR Code:
//--------------------------------------------------------------------//
//---------------- Moon 111's Anything AutoBuyer V1.1 ----------------//
//--------------------------------------------------------------------//
//---------------- Requires: SRL 3.81 or better -----------------//
//---------------- and SCAR DIVI 3.11 or better -----------------//
//--------------------------------------------------------------------//
//---------------- Special thanks to the SRL team! -----------------//
//--------------------------------------------------------------------//
//---------------- Instructions: Go to any shop and -----------------//
//---------------- open shop window. Fill out the -----------------//
//---------------- setup section. Start script with -----------------//
//---------------- shop window open. Fill out the -----------------//
//---------------- from (only 1 account). -----------------//
//--------------------------------------------------------------------//
//---------------- Features: Auto world changing, -----------------//
//---------------- max price option, -----------------//
//---------------- max amount option, -----------------//
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
program New;
{.include SRL/SRL.Scar}
{.include SRL/SRL/Misc/Playerform.scar}
var
a,b,xx,yy,maxprice,maxamount,bought,mrandom,color,tol,worlds:integer;
text:string;
member:boolean;
procedure vars;
begin
//----------------------------- SETUP -----------------------------//
xx := 141; // x coord of the location of the item in the shop to buy.
yy := 86; // y coord of the location of the item in the shop to buy.
maxprice := 8; // max price your willing to play for item.
maxamount := 10000; // max amount of items to buy.
color := 1118484; // color of shopkeeper.
tol := 1; // tolerance from color to use.
text := 'Bet'; // part of the name of shopkeeper (top-left corner).
member := false; // Using member world?
//--------------------------- END SETUP ---------------------------//
mrandom := 16;
end;
procedure orderworlds;
begin
if(not(member))then
begin
Mouse(53,484,10,10,True);
wait(200 + random(400));
Mouse(412, 11, 2, 2, True);
wait(300 + random(300));
Mouse(632, 10, 2, 2, True);
end else
begin
Mouse(53,484,10,10,True);
wait(200 + random(400));
Mouse(412, 11, 2, 2, True);
wait(300 + random(300));
Mouse(616, 11, 2, 2, True);
end;
end;
procedure FixChatA;
begin
wait(100 + random(100));
Mouse(488, 427, 8, 8, true);
wait(100 + random(50));
end;
Procedure chooseworld;
var
aa,bb,c:integer;
begin
if(not(member))then
begin
repeat
c := c + 1;
wait(100 + random(200));
until((findcolortolerance(aa, bb, 9013641, 65 + random(170), 37 + random(300), 272, 419, 1)) OR
(c = 100))
end else
begin
repeat
c := c + 1;
wait(100 + random(200));
until((findcolortolerance(aa, bb, 5143442, 65 + random(170), 37 + random(300), 272, 419, 1)) OR
(c = 100))
end;
if(c = 100)then
begin
Writeln('Could not find world. Ending script.');
TerminateScript;
end;
worlds := worlds + 1;
Mouse(aa, bb, 4, 4, True);
wait(1000 + random(400));
end;
function FindShopOwner:boolean;
var
aa,bb:longint;
begin
if(FindObj(aa, bb, text, color, tol))then
begin
Mouse(aa, bb, 0, 0, False);
ChooseOption(x, y, 'Trade');
flag;
wait(1500 + random(1000));
if(rs_ShopScreen)then
begin
Result := True;
end else
begin
Result := False;
end;
end;
end;
procedure checkifok;
begin
if(not(rs_ShopScreen))then
begin
Writeln('Shop window must be open to run script.');
TerminateScript;
end;
end;
procedure checkprice;
var
d:integer;
begin
Mouse(xx, yy, mrandom, mrandom, true);
wait(400 + random(400));
if(StrToInt(GetNumbers(GetBlackChatMessage)) > maxprice)then
begin
Writeln('The price of what you are buying has passed the max price you set. We are now switching worlds...');
Mouse(486, 40, 8, 8, true);
wait(500 + random(300));
Logout;
wait(300 + random(400));
orderworlds;
wait(300 + random(300));
chooseworld;
wait(300 + random(300));
LoginPlayer;
wait(500 + random(500));
FixChatA;
wait(300 + random(200));
repeat
d := d + 1;
wait(200 + random(200));
until((d = 5) OR (FindShopOwner))
if(d = 10)then
begin
Writeln('Could not find shop owner. Ending script.');
TerminateScript;
end;
checkprice;
end;
end;
procedure checkamount;
begin
if(bought >= maxamount)then
begin
Writeln('You have bought the amount you specified (' + IntToStr(maxamount) + '). Ending script.');
end;
end;
procedure buy;
begin
Mouse(xx, yy, mrandom, mrandom, false);
if(not(PopUp('Buy 10')))then
begin
if(not(mrandom = 1))then
begin
mrandom := mrandom / 2;
end;
end else
begin
bought := bought + 10;
end;
end;
procedure progressreport;
var
TimeR,h,m,s:integer;
begin
TimeR := GetTimeRunning;
ConvertTime(TimeR, h, m, s);
Writeln('------------------- Progress Report --------------------------');
Writeln('Items bought: ' + IntToStr(bought));
Writeln('Worlds changed: ' + IntToStr(worlds));
Writeln('Time running: ' + IntToStr(h) + ' hours ' + IntToStr(m) + ' mins and ' + IntToStr(s) + ' secs');
Writeln('--------------------------------------------------------------');
end;
begin
SetUpSRL;
SetupPlayers;
ClearDebug;
vars;
wait(3000 + random(1000));
FixChatA;
checkifok;
repeat
b := b + 1;
checkprice;
checkamount;
repeat
a := a + 1;
buy;
until(a = 10)
a := 0;
if(b = 10)then
begin
b := 0;
progressreport;
end;
until(false)
end.