Simba Code:
program new;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/SmartGraphics.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)
Players[0].Name := 'Uqam'; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
procedure Antiban;
begin
FindNormalRandoms;
case Random(80) of
0: RandomRClick;
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
5: ExamineInv;
7: SetAngle(SRL_ANGLE_HIGH);
8: Wait(5000)
end;
end;
type //Credit goes to NKN for the custom object finding functions. I only put the values in there. The frame is all his.
MSObject = record
Col, Tol, TPADist, MinCount: Integer;
Hue, Sat: Extended;
Uptext: String;
MMDot: String;
end;
var
GE, BuyButton, SellButton, ExitGEMenuButton : MSObject;
procedure LoadObjects;
var
i:integer;
begin
with GE do
begin
Col := 2891040;
Tol := 20;
Hue := 0.18;
Sat := 0.30;
UpText := 'Exch'
end;
with BuyButton do
begin
Col := 247218;
Tol := 4;
Hue := 0.25;
Sat := 1.29;
UpText := 'Buy O'
end;
with SellButton do
begin
Col := 224454;
Tol := 4;
Hue := 0.34;
Sat := 0.03;
UpText := 'Sell O'
end;
with ExitGEMenuButton do
begin
Col := 11975110;
Tol := 10;
Hue := 0.80;
Sat := 0.31;
UpText := 'ack'
end;
for i := 1 to 28 do
Boxes[i] := InvBox(i)
end;
function FindObject(var x,y : Integer; Obj: MSObject; X1,Y1,X2,Y2:integer) : Boolean;
//Censored =)
function InGEE: Boolean;
begin;
result := findTextTPA(39116, 20, 204, 27, 248, 49, 'Grand', upCharsEx, nothing);
end;
function GEESellMenu: Boolean;
begin;
result := findTextTPA(39116, 20, 87, 68, 155, 86, 'Sell O', upCharsEx, nothing);
end;
function GEEBuyMenu: Boolean;
begin;
result := findTextTPA(39116, 20, 87, 68, 155, 86, 'Buy O', upCharsEx, nothing);
end;
function GEECanTypeAmount: Boolean;
begin;
result := findTextTPA(0, 150, 125, 387, 166, 412, 'nter', upCharsEx, nothing);
end;
function GEECanTypePrice: Boolean;
begin;
result := findTextTPA(0, 150, 140, 392, 182, 411, 'nter', upCharsEx, nothing);
end;
function GEECanTypeItem: Boolean;
begin;
result := findTextTPA(23200, 50, 196, 355, 228, 373, 'rand', upCharsEx, nothing);
end;
function OpenGE: Boolean;
var
x,y:integer;
begin
if InGEE or GEESellMenu or GEEBuyMenu then
Exit;
if(FindObject(x,y,GE,MSX1,MSY1,MSX2,MSY2)) then
begin
Clickmouse2(false);
WaitOption('Exchange G',500);
WaitFunc(@InGEE,10,6000);
end else
Exit;
end;
function GEEMenuExit: Boolean;
var
x, y : Integer;
begin
if not InGEE then
Exit;
if not GEESellMenu and not GEEBuyMenu then
Exit;
if(FindObject(x,y,ExitGEMenuButton,MSX1,MSY1,MSX2,MSY2)) then
begin
ClickMouse2(true);
WaitOption('ack',500);
WaitFunc(@InGEE,10,6000);
end else
Exit;
end;
function GEEBuyAt(spot: integer): Boolean;
var
x, y, i: Integer;
b: TBox;
begin
Result := False;
if not InGEE then
Exit;
if GEESellMenu or GEEBuyMenu then
Exit;
case spot of
0:
if not (FindObject(x,y,BuyButton,MSX1,MSY1,MSX2,MSY2)) then
begin
writeln('No spot is free')
Exit;
end;
1..6:
begin
b:= GridBox(spot, 3, 2, 155, 120, 155, 120, point(100,136));
if not FindObject(x,y,BuyButton,b.x1,b.y1,b.x2,b.y2) then
begin
writeln('This spot is not free')
Exit;
end;
end;
else
begin
writeln('Invalid spot entered');
Exit;
end;
end;
ClickMouse2(true);
WaitOption('Buy O',500);
Wait(500+Random(250));
WaitFunc(@GEEBuyMenu,10,6000);
end;
function GEESellAt(spot: integer): Boolean;
var
x, y, i: Integer;
b: TBox;
begin
Result := False;
if not InGEE then
Exit;
if GEESellMenu or GEEBuyMenu then
GEEMenuExit;
case spot of
0:
if not (FindObject(x,y,SellButton,MSX1,MSY1,MSX2,MSY2)) then
begin
writeln('No spot is free')
Exit;
end;
1..6:
begin
b:= GridBox(spot, 3, 2, 155, 120, 155, 120, point(100,136));
if not FindObject(x,y,SellButton,b.x1,b.y1,b.x2,b.y2) then
begin
writeln('This spot is not free')
Exit;
end;
end;
else
begin
writeln('Invalid spot entered');
Exit;
end;
end;
ClickMouse2(true);
if WaitOption('Sell O',500) then
WaitFunc(@GEEBuyMenu,10,6000);
Wait(1250+Random(250));
end;
procedure GEESetQuantity(Q : String);
var
x, y, numberOfFailures : integer;
searchBox: TBox;
begin
for numberofFailures := 0 to 5 do
if not InGEE then
Exit;
if not GEESellMenu and not GEEBuyMenu then
Exit;
case lowercase(Q) of
'1':
searchBox := IntToBox(56, 211, 87, 231);
'10':
searchBox := IntToBox(97, 211, 129, 231);
'100':
searchBox := IntToBox(138, 211, 170, 231);
'all':
if not GEESellMenu then
begin
writeln('Invalid parameter');
Exit;
end else
searchBox := IntToBox(220, 211, 253, 231);
else
begin
if (FindColorTolerance(x, y, 39116, 222, 211, 252, 231, 100)) then
begin
MMouse(x, y, 4, 4);
ClickMouse2(true);
WaitFunc(@GEECanTypeAmount, 10, 16000);
TypeSendEx(Q, true);
Wait(1500 + Random(250));
end;
end;
end;
case lowercase(Q) of
'1', '10', '100', 'all':
if (FindColorTolerance(x, y, 39116, searchBox.x1, searchBox.y1, searchBox.x2, searchBox.y2, 100)) then
begin
MMouse(x, y, 4, 4);
ClickMouse2(true);
Wait(1000 + Random(500));
end;
end;
if (ExtractFromStr(GetTextAtExWrap(86, 184, 227, 198, 0, 10, 1, 6400255, 50, UpCharsEx), Numbers)) = Q then
Exit;
begin
writeln('Something went wrong!')
Inc(numberOfFailures);
if numberofFailures = 5 then
begin
writeln('Failed too many times. Terminating script.');
TerminateScript;
end;
end;
end;
procedure GEESetPrice(Value : String; numberOfClicks : Integer);
var
x, y, numberOfFailures, numberOfClickz : integer;
searchBox: TBox;
begin
for numberOfFailures := 0 to 5 do
if not InGEE then
Exit;
if not GEESellMenu and not GEEBuyMenu then
Exit;
case lowercase(Value) of
'min':
searchBox := IntToBox(274, 211, 304, 231);
'mid':
Exit;
'max':
searchBox := IntToBox(427, 211, 460, 231);
else
begin
if (FindColorTolerance(x, y, 39167, 371, 211, 403, 231, 100)) then
begin
MMouse(x, y, 4, 4);
ClickMouse2(true);
WaitFunc(@GEECanTypePrice, 10, 6000);
TypeSendEx(Value, true);
Wait(1500 + Random(250));
if (ExtractFromStr(GetTextAtExWrap(296, 184, 438, 198, 0, 10, 1, 6400255, 50, UpCharsEx), Numbers)) = Value then
Exit;
begin
writeln('Something went wrong!')
Inc(numberOfFailures);
if numberOfFailures = 5 then
begin
writeln('Failed too many times. Terminating script.');
TerminateScript;
end;
end;
end;
end;
end;
case lowercase(Value) of
'min', 'max':
if (FindColorTolerance(x, y, 39167, searchBox.x1, searchBox.y1, searchBox.x2, searchBox.y2, 100)) then
begin
repeat
MMouse(x, y, 4, 4);
ClickMouse2(true);
Inc(numberOfClickz);
Wait(200 + Random(50));
until (numberOfClickz = numberOfClicks);
Wait(500 + Random(200));
end;
end;
end;
procedure GEEConfirmOffer;
begin
MouseBoxEx(215, 286, 310, 325, 10, 1);
Wait(1500 + Random(500));
end;
procedure GEEBuy(What, Quantity, Value: String; numberOfClicks, spot : Integer);
var
x, y : Integer;
begin
if not InGEE then
Exit;
if GEESellMenu or GEEBuyMenu then
GEEMenuExit;
GEEBuyAt(spot);
WaitFunc(@GEECanTypeItem, 10, 6000);
TypeSendEx(What, true);
WaitFindColor(x, y, 23200, 67, 343, 119, 359, 30, 6000);
MouseBoxEx(200, 350, 228, 368, 5, 1);
WaitColorGone(39372, 394, 81, 40, 6000);
//if not findTextTPA(39372, 20, 210, 75, 380, 95, What, StatChars, nothing) = true then //Look at the note below
//Writeln('A problem occurred. Trying again.');
//GEEBuy(What, Quantity, Value, numberOfClicks, spot);
GEESetQuantity(Quantity);
GEESetPrice(value, numberOfClicks);
GEEConfirmOffer;
end;
procedure BuyRanarr;
var
Price, x, y : Integer;
begin
OpenGE;
//GEEBuyAt(6);
//GEESetQuantity('12354');
//GEESetPrice('852', 4)
//GEEMenuExit;
GEEBuy('lean ranarr', '2', 'max', 1, 0);
writeln('See if any malicious loop is going on');
end;
procedure Mainloop;
begin
//OpenGE;
BuyRanarr;
end;
begin
{$IFDEF SMART}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
ClearDebug;
SetupSRL;
DeclarePlayers; // Calls the procedure, you can't forget this!
LoginPlayer;
ClickNorth(SRL_ANGLE_HIGH);
LoadObjects;
repeat
Mainloop;
until(allPlayersInactive);
end.