SRL Archive - RS3 Help

Can't seem to include a wait after a procedure


nero_dante

2015-03-05 07:30:10

Hey I'm very new to the scripting, been using other scripts for ages, but its time I try and give back. However getting stuck on the very basics lol. This is the script I have so far but I can't seem to put pauses in the script. (it is a very basic clicking script for the Burthorpe agility course, as I am just going one step at a time.

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam')
end; [COLOR="#0000FF"]// Can't seem to put a wait here..... I tried typing [COLOR="#FF0000"]wait(randomrange(3800,4200));[/COLOR]But it says it's an error[/COLOR]
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall')
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 182, 152);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge')
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over low wall')
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
end.

KeepBotting

2015-03-05 07:42:40

Are you trying to place a wait() on the same line as the end? Because, yeah that's going to throw a compiling error

Do something like this:


procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam')
wait(5000); //Here
end;

the bank

2015-03-05 07:43:36

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam'); //You didn't have a semicolon here
Wait(gaussRangeInt(3800, 4200)); //Now this should work :)
end;
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall')
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 182, 152);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge')
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over low wall')
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
end.

E:

KeepBotting didn't catch it either, so don't feel bad ;)

nero_dante

2015-03-05 07:49:53

From: KeepBotting
Are you trying to place a wait() on the same line as the end? Because, yeah that's going to throw a compiling error

Do something like this:


procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam')
wait(5000); //Here
end;


I was putting it how you put it but I still got the error but I will try it again

fady

2015-03-05 07:51:00

From: nero_dante
Hey I'm very new to the scripting, been using other scripts for ages, but its time I try and give back. However getting stuck on the very basics lol. This is the script I have so far but I can't seem to put pauses in the script. (it is a very basic clicking script for the Burthorpe agility course, as I am just going one step at a time.

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam')
end; [COLOR="#0000FF"]// Can't seem to put a wait here..... I tried typing [COLOR="#FF0000"]wait(randomrange(3800,4200));[/COLOR]But it says it's an error[/COLOR]
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall')
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 182, 152);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge')
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over low wall')
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
end.



The_bank is correct, it seems like the rest of your writeLns are missing a semi colon at the end as well. Adding a semi-colon at the end of each one should fix it.

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam'); // Add one here
end;
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall'); // Add one here too
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 182, 152);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge'); // And here!
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over low wall'); // And here as well!
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
end.

nero_dante

2015-03-05 07:51:45

From: the bank
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam'); //You didn't have a semicolon here
Wait(gaussRangeInt(3800, 4200)); //Now this should work :)
end;
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall')
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 182, 152);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge')
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over low wall')
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
end.

E:

KeepBotting didn't catch it either, so don't feel bad ;)


Ahh I didn't see that error when posting, but I did have the semicolon on the script itself… must have missed it when i copy and pasted it.

Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?

KeepBotting

2015-03-05 07:55:26

From: nero_dante
Ahh I didn't see that error when posting, but I did have the semicolon on the script itself… must have missed it when i copy and pasted it.

Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?


You can use either, see this thread for an explanation of the difference between the two: https://villavu.com/forum/showthread.php?t=111711

fady

2015-03-05 07:58:46

From: nero_dante
Ahh I didn't see that error when posting, but I did have the semicolon on the script itself… must have missed it when i copy and pasted it.

Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?


randomrange is kind of pseudorandom, as in if given enough time all the possibilities are going to happen an equal amount of times. However, gaussRangeInt will give you a standard bell curve, where the results that are more towards the center of the range and going to happen more often than the ones that are farther away from the center, which is assumed to be more human like.

Edit: opps beaten to it!

nero_dante

2015-03-05 08:00:49

From: fady
randomrange is kind of pseudorandom, as in if given enough time all the possibilities are going to happen an equal amount of times. However, gaussRangeInt will give you a standard bell curve, where the results that are more towards the center of the range and going to happen more often than the ones that are farther away from the center, which is assumed to be more human like.


okay cool thanks for that :)

the bank

2015-03-05 08:06:30

From: nero_dante
Ahh I didn't see that error when posting, but I did have the semicolon on the script itself… must have missed it when i copy and pasted it.

Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?


No, you didnt miss it when you copied it over, you missed it all together. A semicolon does not simply disappear from copying and pasting lol.

But am I right to assume your problem is solved?

nero_dante

2015-03-05 08:10:36

From: the bank
No, you didnt miss it when you copied it over, you missed it all together. A semicolon does not simply disappear from copying and pasting lol.

But am I right to assume your problem is solved?


ahh, yeah it was my bad I thought i had them. and yes it did fix it. I should sleep more at night before attempting something new xD

nero_dante

2015-03-05 09:07:52

Thanks for the little help that i needed. I got it to complete a whole lap :P so I'm very happy with myself xD. If you see anything that I could change to make it more simple please do let me know. I'm aware that it doesnt repeat all process's to do more laps haven't gotten that far yet :P .

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam');
wait(gaussRangeInt(5800,6200));
end;
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall');
wait(gaussRangeInt(6800,7000));
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 181, 150);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge');
wait(gaussRangeInt(6000,6200));
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
end;
procedure SwingonRope();
var
SwingRope: Tbox;
begin
SwingRope :=intTobox(351, 167, 371, 191);
mouseBox(SwingRope, MOUSE_LEFT);
WriteLn('Swinging on Rope');
wait(gaussRangeInt(3000,4000));
end;
procedure SwingAcrossMonkeyBars();
var
MonkeyBar: Tbox;
begin
MonkeyBar :=intTobox(292, 241, 351, 251);
mouseBox(MonkeyBar, MOUSE_LEFT);
WriteLn('Swinging across Monkey Bars');
wait(gaussRangeInt(7800,8300));
end;
procedure JumpDownledge();
var
JumpLedge: Tbox;
begin
JumpLedge :=intTobox(230, 200, 278, 209);
mouseBox(JumpLedge, MOUSE_LEFT);
WriteLn('Finishing Lap');
wait(gaussRangeInt(2200,2600));
end;
procedure StartingOver();
var
Starttile: Tbox;
begin
Starttile :=intTobox(372, 189, 390, 207);
mouseBox(Starttile, MOUSE_LEFT);
WriteLn('Starting New Lap');
wait(gaussRangeInt(1900,2500));
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
ClimbOverLowWall();
SwingonRope();
SwingacrossMonkeyBars();
JumpDownLedge();
StartingOver();

end.

KeepBotting

2015-03-05 17:15:19

From: nero_dante
Thanks for the little help that i needed. I got it to complete a whole lap :P so I'm very happy with myself xD. If you see anything that I could change to make it more simple please do let me know. I'm aware that it doesnt repeat all process's to do more laps haven't gotten that far yet :P .

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_LEFT);
WriteLn('Walking over LogBeam');
wait(gaussRangeInt(5800,6200));
end;
procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_LEFT);
WriteLn('Climbing up wall');
wait(gaussRangeInt(6800,7000));
end;
Procedure WalkAcrossBalancingLedge();
var
Ledge: Tbox;
begin
Ledge := intTobox(156, 146, 181, 150);
mouseBox(Ledge, MOUSE_LEFT);
WriteLn('Walking across Balancing Ledge');
wait(gaussRangeInt(6000,6200));
end;
procedure ClimbOverLowWall();
var
LowWall: Tbox;
begin
LowWall :=intTobox(235, 209, 251, 299);
mouseBox(LowWall, MOUSE_LEFT);
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
end;
procedure SwingonRope();
var
SwingRope: Tbox;
begin
SwingRope :=intTobox(351, 167, 371, 191);
mouseBox(SwingRope, MOUSE_LEFT);
WriteLn('Swinging on Rope');
wait(gaussRangeInt(3000,4000));
end;
procedure SwingAcrossMonkeyBars();
var
MonkeyBar: Tbox;
begin
MonkeyBar :=intTobox(292, 241, 351, 251);
mouseBox(MonkeyBar, MOUSE_LEFT);
WriteLn('Swinging across Monkey Bars');
wait(gaussRangeInt(7800,8300));
end;
procedure JumpDownledge();
var
JumpLedge: Tbox;
begin
JumpLedge :=intTobox(230, 200, 278, 209);
mouseBox(JumpLedge, MOUSE_LEFT);
WriteLn('Finishing Lap');
wait(gaussRangeInt(2200,2600));
end;
procedure StartingOver();
var
Starttile: Tbox;
begin
Starttile :=intTobox(372, 189, 390, 207);
mouseBox(Starttile, MOUSE_LEFT);
WriteLn('Starting New Lap');
wait(gaussRangeInt(1900,2500));
end;
begin
clearDebug();
setupSRL();
WalkLogBeam();
ClimbUpWall();
WalkAcrossBalancingLedge();
ClimbOverLowWall();
SwingonRope();
SwingacrossMonkeyBars();
JumpDownLedge();
StartingOver();

end.


Congratulations :) I know that feel of finally getting a script to work correctly. It does feel good, and it should! You've earned it.

One thing I'd like to point out is that you use blind clicking throughout the script (mousing to predefined boxes and clicking without checking anything). Ideally you'd have fully-fledged color-finding methods, but for now I'd encourage you to incorporate mouse-over text checks.

e.g.

procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_MOVE);
if isMouseOverText('limb Wal') then //Whatever appears when you mouse-over the wall
fastClick(MOUSE_LEFT)
else begin
writeLn('No mouseovertext :(');
terminateScript();
end;
WriteLn('Climbing up wall');
wait(gaussRangeInt(6800,7000));
end;

I believe that something to this effect is, at this point in development, even more important than implementing color-finding. Because if the camera is moved, or you hit a bad bit of lag, your script (currently) is going to continue clicking in an infinite loop.

The above code will stop everything is something goes wrong. Failsafes become of less immediate importance as you implement more reliable first-resort methods.

So, in conclusion: 1) great job, 2) add some mouse-over checks and shutdown failsafes, and 3) look into mainScreen.findObject() eventually for color clicking.

nero_dante

2015-03-05 19:00:59

From: KeepBotting
Congratulations :) I know that feel of finally getting a script to work correctly. It does feel good, and it should! You've earned it.

One thing I'd like to point out is that you use blind clicking throughout the script (mousing to predefined boxes and clicking without checking anything). Ideally you'd have fully-fledged color-finding methods, but for now I'd encourage you to incorporate mouse-over text checks.

e.g.

procedure ClimbUpWall();
var
Wall: Tbox;
begin
Wall := intTobox(277, 76, 305, 99);
mouseBox(Wall, MOUSE_MOVE);
if isMouseOverText('limb Wal') then //Whatever appears when you mouse-over the wall
fastClick(MOUSE_LEFT)
else begin
writeLn('No mouseovertext :(');
terminateScript();
end;
WriteLn('Climbing up wall');
wait(gaussRangeInt(6800,7000));
end;

I believe that something to this effect is, at this point in development, even more important than implementing color-finding. Because if the camera is moved, or you hit a bad bit of lag, your script (currently) is going to continue clicking in an infinite loop.

The above code will stop everything is something goes wrong. Failsafes become of less immediate importance as you implement more reliable first-resort methods.

So, in conclusion: 1) great job, 2) add some mouse-over checks and shutdown failsafes, and 3) look into mainScreen.findObject() eventually for color clicking.


Yeah I was planning to add mouseovertext as my nex move in the script. but simba wasn't opening up a client and I don't know how to use my browser to work a script so I'm waiting untill tomorrow to do more when hopefully the client loads :)