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) :)
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:
Edit: Of course I will be giving credit to the correct individuals at the end of the script, this is mainly for learning purposes.
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.