SRL Archive - First Scripts

Very, very basic Shipping Manager autorouter


newguy45

2015-03-30 10:22:04

So my simba coding skills are obviously terrible but I tried many things to make this script work, in the end I used coordinates and colors lots of work will need to be done if you want to be able to use this but here it is none the less


program SetSail;
var
glitchCount: Integer;
procedure Fuel;
var X, Y: Integer;
begin
if(FindColor(X,Y, 10975533,910, 508, 992, 538))then
begin
writeln('found Depart Button 1');
MoveMouse(665, 515);
wait(200);
ClickMouse(665, 515, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 1');
end;
wait(1000);
if(FindColor(X,Y, 11304237,909, 558, 988, 596))then
begin
writeln('found Depart Button 2');
MoveMouse(619, 571);
wait(200);
ClickMouse(619, 571, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 2');
end;
wait(1000);
if(FindColor(X,Y, 11501100,910, 611, 988, 647))then
begin
writeln('found Depart Button 3');
MoveMouse(611, 628);
wait(200);
ClickMouse(611, 628, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 3');
end;
wait(1000);
if(FindColor(X,Y, 11238444,910, 663, 991, 701))then
begin
writeln('found Depart Button 4');
MoveMouse(629, 686);
wait(200);
ClickMouse(629, 686, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 4');
end;
wait(1000);
if(FindColor(X,Y, 11303980,910, 721, 990, 753))then
begin
writeln('found Depart Button 5');
MoveMouse(583, 740);
wait(200);
ClickMouse(583, 740, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 5');
end;
wait(1000);
if(FindColor(X,Y, 10975788,910, 776, 990, 812))then
begin
writeln('found Depart Button 6');
MoveMouse(654, 793);
wait(200);
ClickMouse(654, 793, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
begin
writeln('Did not find Depart Button 6');
end;
end;

procedure Madness;
var X, Y: Integer;
begin
wait(600);
MoveMouse(651, 843); //click send ships
wait(400);
ClickMouse(651, 843, mouse_Left);
wait(4000);
if(FindColor(X,Y, 10384430,611, 286, 739, 591))then
begin
writeln('found Hide Button');
MoveMouse(X, Y);
writeln('mouse on hide');
wait(5000);
ClickMouse(X, Y, mouse_Left);
wait(180000);
MoveMouse(580, 332); //click routes
writeln('mouse off hide');
wait(400);
ClickMouse(580, 332, mouse_Left);
wait(3000);
end else
begin
writeln('No ships avalible, checking again in three mins');
wait(180000);
MoveMouse(580, 332); //click routes
wait(400);
ClickMouse(580, 332, mouse_Left);
wait(1000);
end;
end;

procedure glitchCheck;
var X, Y: Integer;
begin
if not(FindColor(X,Y, 9207392,342, 469, 418, 490))then
begin
Inc(glitchCount);
wait(1000);
MoveMouse(580, 332); //click routes
wait(400);
ClickMouse(580, 332, mouse_Left);
if(glitchCount <= 1)then
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitch');
end else
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitches');
end;
wait(15000);
end else
writeln('No glitch');
end;


begin
repeat
wait(2000);
Fuel;
wait(2000);
Madness;
glitchCheck;
until( false );
end.

Wu-Tang Clan

2015-03-30 16:27:05

[SIMBA=writeln('No ships avalible, checking again in three mins');
wait(180000);]
I just want to say that you should never ever EVER do this.

What I will tell you is a better, more efficient way of doing this. You should know that your character will not be logged in if the above procedure actually had worked. You would literally do nothing for 3 minutes.
writeln('No ships avalible, checking again in 30 seconds');
wait(30000);
if (<place something like findcolor>) then exit;

That may be the most basic way to "improve" on your work. From the looks of it you are learning and will move on to more advanced coding techniques as you progress. Try to stay away from basic color finding and coordinate clicking because after any updates or tiny changes during your script and you wont get any work done.

Also, don't have such small waits! You have things like
wait(400);
any lag and you will have broken your script, I would say try to stay away from wait functions being under 1 second unless that is way too long.

newguy45

2015-03-31 02:58:02

Thanks for you tips! If I may though, why can I not wait for three minuets? this is not for runescape. the facebook game this is for has no idol logout

newguy45

2015-03-31 03:46:05

I updated my code above, made some tweaks to make it more robust and more reliable. Now it has a lag handler that will check to make sure everything is still preforming correctly after 3 minuets ( basically if the site lags out or I wind up on the wrong page some how it will put it's self back on track )

newguy45

2015-04-05 17:39:37

is there a technique I can use to run a method like once every three times the main run repeats?

KeepBotting

2015-04-05 17:46:26

From: newguy45
is there a technique I can use to run a method like once every three times the main run repeats?


Put a for loop that loops three times in the mainloop?

//mainloop
begin
for i := 0 to 2 do //zero, one, two -- three times
begin
//stuff here, which will repeat thrice every time the program loops
end;

otherStuff(); //will only run once when the program loops
end.

newguy45

2015-04-05 23:50:42

From: KeepBotting
Put a for loop that loops three times in the mainloop?

//mainloop
begin
for i := 0 to 2 do //zero, one, two -- three times
begin
//stuff here, which will repeat thrice every time the program loops
end;

otherStuff(); //will only run once when the program loops
end.



Thanks for the help, im trying to get my mind around this still. So if I put that while loop in my code I can make it run a procedure once for every three times my mainloop repeats? How do I increase the count of i? Sorry for the noobyness