SRL Archive - RS3 Help

First Script-In-Progress


Quentini

2014-11-01 14:47:34

After going through The Mayor's and Coh3n's scripting guides and finding the gold mine of SRL Documentation, I have begun to develop my first script. I thought I would keep with a simple tradition of scripting a simple powerchopper. (Much like the tradition of a "Hello World" program) :)

program LumberJack;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files

// Constants


// Setting up player info
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

// Logging player in
procedure playerSetup();
begin
repeat
if not isloggedIn() then
begin
players[currentPlayer].login();
writeLn('___________Logging in player___________');
exitSquealOfFortune();
minimap.setAngle(MM_DIRECTION_NORTH);
wait(RandomRange(1000, 2000));
mainScreen.setAngle(MS_ANGLE_HIGH);
writeLn('___________Setup Complete___________');
end else;
exit;
until False;
end;

// Chopping down tree
procedure clickTree();
var
x, y: integer;
begin
if mainscreen.findObject(x, y, 2247486, 3, ['vergreen'], MOUSE_RIGHT) then
begin
chooseOption.select(['hop down']);
tabBackPack.waitForShift(5000);
writeLn('___________We chopped a tree down!___________');
end;
end;

// Performing human-like actions
procedure Antiban();
begin
case random(110) of
10: RandomRClickItem();
20: sleepAndMoveMouse(1000 + random(2500));
30: pickUpMouse();
40:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeLn('Long Browse');
wait(20000 + randomRange(10000, 15000));
end;
50:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeLn('Medium Browse');
wait(15000 + randomRange(5000, 10000));
end;
60:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeLn('Short Browse');
wait(10000 + randomRange(2500, 5000));
end;
70:
begin
hoverSkill(Skill_WOODCUTTING);
Wait(GaussRangeInt(1000, 2000));
end;
80: smallRandomMouse();
90: boredHuman();
100: randomCameraAngle(MS_ANGLE_HIGH);
110: randomGameTab(true);
end;
end;


// main loop
begin
clearDebug();
setupSRL();
declarePlayers();
playerSetup();

repeat
repeat
clickTree();
wait(1000 + RandomRange(1000, 3000));
while (mainscreen.isPlayerAnimating(100)) do
Antiban();
writeLn('___________Performing Antiban___________');
wait(50 + random(50));
until tabBackPack.isFull();

tabBackPack.dropItems(DROP_PATTERN_REGULAR);

until false;

end.

I am looking for criticism or thoughts on what I have so far. This is what I want to accomplish before I begin to actually stress test the script:

  • TPA / ATPA search for trees (thoughts on using an ATPA to ensure that the player's position never strays too far from location?)
  • Progress Report
  • Search Fail-safes
  • Random Breaking
  • Action-Bar Dropping

Edit: Of course I will be giving credit to the correct individuals at the end of the script, this is mainly for learning purposes.

Ian

2014-11-01 15:06:29

Currently you have


repeat
clickTree();
wait(1000 + RandomRange(1000, 3000));
while (mainscreen.isPlayerAnimating()) do
Antiban();
writeLn('___________Performing Antiban___________');
wait(50 + random(50));
until tabBackPack.isFull();

I think you should be using a begin/end after the do if you want it to perform the way it is indented.

like this:


repeat
clickTree();
wait(1000 + RandomRange(1000, 3000));
while (mainscreen.isPlayerAnimating()) do
begin
Antiban();
writeLn('___________Performing Antiban___________');
wait(50 + random(50));
end;
until tabBackPack.isFull();

Also I may be wrong but I thought that action bar dropping couldn't be used for logs because the action bar option is to craft.

Quentini

2014-11-01 15:18:55

From: BMWxi
Currently you have


repeat
clickTree();
wait(1000 + RandomRange(1000, 3000));
while (mainscreen.isPlayerAnimating()) do
Antiban();
writeLn('___________Performing Antiban___________');
wait(50 + random(50));
until tabBackPack.isFull();

I think you should be using a begin/end after the do if you want it to perform the way it is indented.

like this:


repeat
clickTree();
wait(1000 + RandomRange(1000, 3000));
while (mainscreen.isPlayerAnimating()) do
begin
Antiban();
writeLn('___________Performing Antiban___________');
wait(50 + random(50));
end;
until tabBackPack.isFull();

Also I may be wrong but I thought that action bar dropping couldn't be used for logs because the action bar option is to craft.


Ah, that would explain why I wasn't seeing Antiban being performed. Thank you. The action bar thing makes sense. Is the drop function too bot - like or is there randomness built into that?

Ian

2014-11-01 16:42:50

From: Quentini
Ah, that would explain why I wasn't seeing Antiban being performed. Thank you. The action bar thing makes sense. Is the drop function too bot - like or is there randomness built into that?


There is randomness built into it in the way that it won't click the same spot on a slot every time (it uses mousebox) but I believe it will drop them in the same order every time. This itelf is probably fine because a lot of people who aren't bots probably drop things the same way but if you want I think there is also a parameter that you can use to set a different drop pattern.