SRL Archive - OSR Help

Script continuously clicking


Synikk

2011-12-19 03:02:19

hey guys, im making a powerminer and when i begin mining the script causes it to continuously click the ore, how do i make it so that there is a 4-6 second break between each click? here is the function

Function MineIronOre:Boolean
;Var
X, Y: Integer;
Begin
//FindObjCustom(x, y, ['att', 'ack'], [123456, 345678], 5);
If FindObjCustom(x, y, ['ine', 'ocks', 'e R'], [2766942,3162219], 10) Then
Begin
StatsGuise('Found ore')

GetMousePos(x, y);
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);

End;

End;

End;
End;

Kyle Undefined

2011-12-19 03:04:47

You could do something like this:


StatsGuise('Found ore')
Wait(4000 + RandomRange(500, 2000));
GetMousePos(x, y);

Synikk

2011-12-19 04:19:02

hey there i tried including that wait string that you suggested but now it waits 5 seconds before starting and then waits 5 seconds after clicking. Then for some reason it click the empty vein that it has just mined again. Could you take a look at this code, maybe run it and advise me what to do? thanks (:
program ArdongueIronPowerMiner;

//{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i SRL\SRL\Misc\Debug.SCAR}
{$i SRL\SRL\Misc\Stats.simba}


Const
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
BreakEvery = 120; // How many minutes you want to break after
BreakFor = 5; // How long to break for
Version= '1.00'; // Dont need to change
NumbOfPlayers= 1; // How many players you are botting
StartPlayer= 0; //Player to start autoing with (0 means 1st player)



procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['oins', 'XP'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
Integers[1] := 4; //Seconds to try mining rock before clicking another.
end;

end;


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;


Procedure Antiban;
Begin
Case Random (140) of
0: Begin StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500)); End;
1: Begin StatsGuise('Antiban') GameTab(Tab_Stats) HoverSkill('Mining', False) GameTab(28); End;
End;
End;


Procedure FailSafe(Reason:String);
Begin
Players[CurrentPlayer].Loc := Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;



Function MineIronOre:Boolean
;Var
X, Y: Integer;
Begin
//FindObjCustom(x, y, ['att', 'ack'], [123456, 345678], 5);
If FindObjCustom(x, y, ['ine', 'ocks', 'e R'], [2766942,3162219], 10) Then
Begin
StatsGuise('Found ore')
Wait(4000 + RandomRange(500, 2000));

GetMousePos(x, y);
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);

End;

End;

End;
End;


Begin

SetupSRL;
DeclarePlayers;
Repeat
MineIronOre;
Until(false);

End.

Gaston7eze

2011-12-22 12:39:22

Add Wait(x time)
So it should look like this:
Wait(2000) for example.

Hero

2011-12-22 13:37:10

You will want to put

Wait(2000+Random(400));
After the click on the rock.

Here is an example of what my first iron miner did to mine iron.

procedure MiningIron;//Mining process
var
x, y:Integer;

begin
if not LoggedIn then Exit;

if (FindObjCustom(X, Y, ['Mine','ne Ro','cks'], [2503511,2569562,3360116 ], 10)) then
ClickMouse2(true);//Clicks the rock once found.

if DidRedClick then//Makes sure it was a red click and not a yellow.
Wait(2000+Random(300))//Waits for the ore to be mined(adjust by level).
else

While IsMoving do//If the player is moving to another rock it will wait instead of clicking again
Writeln('Moving to rock');
Wait(2000+random(500));
FindNormalRandoms;
exit;
end;