SRL Archive - General Botting Help

General guidance and advise


newguy45

2015-04-09 11:42:36

Hello all. I've been apart of the runescape hacking community since kaitnieks made scar version 1.12. Unfortunately I got tied up in php coding projects for making money and never had the time I needed to dedicate to properly learn how to code in scar. (what is the language anyway? Pascal?) Times have changed now and I have the time to dedicate to learn how to code in Simba properly.

I am just looking for general guidance on everything. If you see me doing something the hard way or just wrong please tell me! Also im learning how to use code standards. During kaitnieks, any code I did release was all unstandardized and ugly.

As of right now I've been working on a script to play a new facebook game called shipping manager. I have been trying to detect a blue depart button that bitmaps and colors are not reliably finding for me. Though reading the tutorials here I found the APA program and made a color tolerance which seems to be working fine now but in all honesty I have no idea how it works and i'm sure I could be doing this better in my script. I'll post it below if you guys would like to tell be if my standards are off or code that could be done better please let me know.


program SetSail;
{.include SRL\SRL.scar}
var
glitchCount, c, d, i: Integer;
arP: TPointArray;

const
BUNKERTYPE = 'any'; //cheap or any
SETSAILS = 10; //how many times you want the bot to try to send your boats off before it buys bunker
BUNKER = 200; //how mcuh fuel you want to buy per increment keep this low for maximum fuel
procedure FuelTheShips;
var X, Y: Integer;
begin
if(FindColor(X,Y, 11107117,883, 407, 948, 433))then //1
begin
writeln('found Depart Button 1');
MoveMouse(461, 423);
wait(200);
ClickMouse(461, 423, mouse_Left);
wait(1000);
ClickMouse(461, 423, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 1');
end;
wait(1000);
if(FindColor(X,Y, 11500842,883, 446, 948, 472))then //2
begin
writeln('found Depart Button 2');
MoveMouse(467, 460);
wait(200);
ClickMouse(467, 460, mouse_Left);
wait(1000);
ClickMouse(467, 460, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 2');
end;
wait(1000);
if(FindColor(X,Y, 11369772,881, 480, 950, 506))then //3
begin
writeln('found Depart Button 3');
MoveMouse(467, 497);
wait(200);
ClickMouse(467, 497, mouse_Left);
wait(1000);
ClickMouse(467, 497, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 3');
end;
wait(1000);
if(FindColor(X,Y, 11107117,881, 518, 948, 542))then //4
begin
writeln('found Depart Button 4');
MoveMouse(466, 535);
wait(200);
ClickMouse(466, 535, mouse_Left);
wait(1000);
ClickMouse(466, 535, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 4');
end;

wait(1000);
if(FindColor(X,Y, 10384946,882, 555, 951, 579))then //5
begin
writeln('found Depart Button 5');
MoveMouse(468, 571);
wait(200);
ClickMouse(468, 571, mouse_Left);
wait(1000);
ClickMouse(468, 571, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 5');
end;

wait(1000);
if(FindColor(X,Y, 10647600,882, 594, 951, 619))then //6
begin
writeln('found Depart Button 6');
MoveMouse(468, 610);
wait(200);
ClickMouse(468, 610, mouse_Left);
wait(1000);
ClickMouse(468, 610, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 6');
end;
wait(1000);
if(FindColor(X,Y, 9990962,881, 630, 949, 657))then //7
begin
writeln('found Depart Button 7');
MoveMouse(469, 646);
wait(200);
ClickMouse(469, 646, mouse_Left);
wait(1000);
ClickMouse(469, 646, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 7');
end;
wait(1000);
if(FindColor(X,Y, 11107117,883, 665, 948, 690))then //8
begin
writeln('found Depart Button 8');
MoveMouse(470, 682);
wait(200);
ClickMouse(470, 682, mouse_Left);
wait(1000);
ClickMouse(470, 682, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 8');
end;
wait(1000);
if(FindColor(X,Y, 14800578,883, 704, 949, 728))then //9
begin
writeln('found Depart Button 9');
MoveMouse(470, 720);
wait(200);
ClickMouse(470, 720, mouse_Left);
wait(1000);
ClickMouse(470, 720, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 9');
end;
wait(1000);
if(FindColor(X,Y, 15723231,882, 742, 949, 767))then //10
begin
writeln('found Depart Button 10');
MoveMouse(464, 757);
wait(200);
ClickMouse(464, 757, mouse_Left);
wait(1000);
ClickMouse(464, 757, mouse_Left);
wait(400);
end else
begin
writeln('Did not find Depart Button 10');
end;
end;

procedure DirtyWork;
var X, Y, a, b: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
MoveMouse(691, 793); //click send ships
wait(400);
ClickMouse(691, 793, mouse_Left);
wait(3000);
MoveMouse(660, 255); //close hide button
wait(400);
ClickMouse(660, 255, mouse_Left);
writeln('Ships sent off waiting 3 mins');
wait(180000);
MoveMouse(652, 273); //click routes
wait(400);
ClickMouse(652, 273, mouse_Left);
wait(3000);
end else
begin
writeln('No ships to send out waiting three mins');
wait(180000);
MoveMouse(652, 273); //click routes
wait(400);
ClickMouse(652, 273, mouse_Left);
wait(3000);
end;
end;

procedure sendFirstFleet;
var X, Y: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
MoveMouse(691, 793); //click send ships
wait(400);
ClickMouse(691, 793, mouse_Left);
wait(3000);
MoveMouse(660, 255); //close hide button
wait(400);
ClickMouse(660, 255, mouse_Left);
wait(2000);
writeln('Ships sent off waiting 3 mins');
MoveMouse(652, 273); //click routes
wait(400);
ClickMouse(652, 273, mouse_Left);
wait(3000);
end else
begin
writeln('no ships');
end;
end;

procedure glitchCheck;
var X, Y, a, b, i: Integer;
begin
if not(FindColor(X,Y, 9272929,617, 378, 666, 398))then
begin
Inc(glitchCount);
wait(1000);
MoveMouse(649, 270); //click routes
wait(400);
ClickMouse(649, 270, mouse_Left);
if(glitchCount <= 1)then
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitch');
end else
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitches');
end;
wait(5000);
end else
writeln('No glitch');
end;

procedure buyBunker;
var x, y: Integer;
begin
MoveMouse(853, 271); //click Bunker
wait(400);
ClickMouse(853, 271, mouse_Left);
wait(3000);
If(BUNKERTYPE='any')Then
begin
MoveMouse(725, 334); //click order
wait(1500);
ClickMouse(725, 334, mouse_Left);
wait(1500);
repeat
MoveMouse(855, 377); //click click textbox
wait(1500);
ClickMouse(855, 377, mouse_Left);
SendKeys(IntToStr(BUNKER), 155, 155);
wait(1500);
MoveMouse(865, 434); //click place order
wait(1500);
ClickMouse(865, 434, mouse_Left);
wait(1500);
until(FindColor(x,y, 11857918,858, 456, 909, 488));
MoveMouse(913, 262); //close bunker
wait(1500);
ClickMouse(913, 262, mouse_Left);
end;
end

function AutoColor: Integer;
var

arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(1);

FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
SetColorToleranceSpeed(tmpCTS);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 55.54) and (H <= 56.25) and (S >= 35.46) and (S <= 57.23) and (L >= 36.45) and (L <= 42.18) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.56) and (X <= 15.39) and (Y >= 12.35) and (Y <= 17.63) and (Z >= 21.54) and (Z <= 40.13) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

SetColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

begin
AutoColor;
repeat
if (i = SETSAILS) then
begin
buyBunker;
i := 0;
end;
glitchCheck;
wait(5000);
//FuelTheShips;
sendFirstFleet;
wait(5000);
glitchCheck;
//FuelTheShips;
DirtyWork;
glitchCheck;
wait(3000);
Inc(i);
until( false );
end.

newguy45

2015-04-09 15:03:21

I have improved my bot to use more SRL code to make it less detectable!


program SetSail;
{$I SRL-6/SRL.Simba}
var
glitchCount, c, d, i: Integer;
arP: TPointArray;

const
BUNKERTYPE = 'any'; //cheap or any
SETSAILS = 1; //how many times you want the bot to try to send your boats off before it buys bunker

procedure DirtyWork;
var X, Y, a, b: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(3000);
Mouse(660, 255, 4, 4, MOUSE_LEFT);
writeln('Ships sent off, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end else
begin
writeln('No ships to send out, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end;
end;

procedure sendFirstFleet;
var X, Y: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
Mouse(660, 255, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 2000));
writeln('Ships sent off waiting 3 mins');
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
end else
begin
writeln('no ships');
end;
end;

procedure glitchCheck;
var X, Y, a, b, i: Integer;
begin
if not(FindColor(X,Y, 9272929,617, 378, 666, 398))then
begin
Inc(glitchCount);
wait(1000);
Mouse(649, 270, 4, 4, MOUSE_LEFT);
if(glitchCount <= 1)then
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitch');
end else
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitches');
end;
wait(gaussRangeInt(3000, 5000));
end else
writeln('No glitch');
end;

procedure buyBunker;
var x, y: Integer;
begin
Mouse(853, 271, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
If(BUNKERTYPE='any')Then
begin
Mouse(725, 334, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
repeat
Mouse(855, 377, 4, 4, MOUSE_LEFT);
SendKeys(IntToStr(gaussRangeInt(100, 400)), 155, 155); // random number between 100 and 400
wait(gaussRangeInt(1000, 1500));
Mouse(865, 434, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
until(FindColor(x,y, 11857918,858, 456, 909, 488));
Mouse(913, 262, 4, 4, MOUSE_LEFT);
end;
end

function AutoColor: Integer;
var

arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(1);

FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
SetColorToleranceSpeed(tmpCTS);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 55.54) and (H <= 56.25) and (S >= 35.46) and (S <= 57.23) and (L >= 36.45) and (L <= 42.18) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.56) and (X <= 15.39) and (Y >= 12.35) and (Y <= 17.63) and (Z >= 21.54) and (Z <= 40.13) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

SetColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

begin
AutoColor;

repeat
if (i = SETSAILS) then
begin
buyBunker;
i := 0;
end;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
//FuelTheShips;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
//FuelTheShips;
DirtyWork;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
Inc(i);
until( false );
end.