Originally Posted by
jstemper
it isn't waiting the whole 10 seconds because your backpack changes within those 10 seconds (you cut down a log)
Simba Code:
(*
waitForShift
------------
.. code-block:: pascal
function TRSTabBackPack.waitForShift(waitTime: integer): boolean;
Returns true if the backpack count changes within **waitTime**
.. note::
- by Olly
- Last Updated: 29 July 2013 by Olly
Example:
.. code-block:: pascal
if tabBackpack.waitForShift(5000) then
writeln('Backpack count has changed!');
*)
function TRSTabBackpack.waitForShift(waitTime: integer): boolean;
var
c: integer;
timeOut : LongWord;
begin
result := false;
c := self.count();
timeOut := getSystemTime() + waitTime;
while (timeOut >= getSystemTime()) do
if (c <> self.count()) then
exit(true)
else
wait(20 + random(50));
end;
Looks like it breaks out if backpack item count changes
Good call, thank you.
Ok so within this procedure:
Code:
procedure cutWillow(); //cuts willows
var
x, y: integer;
begin
if mainscreen.findObject(x,y, 2768196,3,['illow'], MOUSE_RIGHT) then
begin
writeLn('Clicked Tree');
chooseOption.select(['hop down']);
//tabBackPack.waitForShift(10000);
wait(randomRange(300,400));
end;
begin;
if (mainScreen.isPlayerAnimating(200)) then
wait(randomRange(12000,15000));
end;
end;
1) I am using the .isplayeranimating (see above snippet) with a threshold of 200 which seems to be working however I would like to adjust it to not wait a random range after it checks if the player is animating but say if player is NOT animating, then .tabbackpack full check, and then repeat chopping procedure. It seems like the function isplayeranimating when used in a procedure only returns a true result and I'm not sure how to negate it to do the opposite. do I need to change the procedure to a function and use a Boolean true/false to get that?
2) I am also having trouble with my loop. it can start in bank or willows, clicks minimap willows, chops, runs to bank, deposits and then just doesn't know what to do. Why doesn't it repeat the main loop and go back to willows after finddepositbox procedure is complete?
3) how can I randomize this function (using it in procedure gettofishspot() so it doesn't click nearly the same exact spot. can I just add a var x y and then adjust the end of the function? sorry, don't really know how to describe this.
minimap.findSymbol(fishPoint, MM_SYMBOL_FISHING, minimap.getBounds());
full code below:
Code:
program new;
//{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$I srl-6/lib/misc/srlplayerform.simba}
var
fishPoint: Tpoint; //Tpoint var to get to trees using mm symbol
bankPoint: Tpoint; //Tpoint var to get to bank using mm symbol
procedure getToFishSpot(); //runs to trees, waits max of 12 seconds to get there
begin
minimap.findSymbol(fishPoint, MM_SYMBOL_FISHING, minimap.getBounds());
mouse(fishPoint, MOUSE_LEFT);
wait(randomRange(8000,12000));
end;
procedure cutWillow(); //cuts willows
var
x, y: integer;
begin
if mainscreen.findObject(x,y, 2768196,3,['illow'], MOUSE_RIGHT) then
begin
writeLn('Clicked Tree');
chooseOption.select(['hop down']);
//tabBackPack.waitForShift(10000);
wait(randomRange(300,400));
end;
begin;
if (mainScreen.isPlayerAnimating(200)) then
wait(randomRange(12000,15000));
end;
end;
procedure runToBank(); //runs to bank
begin
wait(randomRange(2000,3000));
minimap.findSymbol(bankPoint, MM_SYMBOL_BANK, minimap.getBounds());
mouse(bankPoint, MOUSE_LEFT);
//wait(randomRange(12000, 14000));
if minimap.waitPlayerMoving() then
writeLn('We are no longer moving');
end;
procedure findDepositBox(); //uses deposit box
var
x, y, i: integer;
begin
if not isLoggedIn() then
exit;
repeat
if minimap.waitPlayerMoving() then
writeLn('We are no longer moving');
wait(randomRange(1000, 2000));
mainscreen.findObject(x, y, 9593499, 27, colorSetting(2, 0.88, 0.10), mainscreen.playerPoint, 30, 50, 50, ['eposit', 'box'], MOUSE_LEFT);
wait(randomRange(1000, 2000));
inc(i);
until depositBox.isOpen() or (i >= 15);
depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);
depositBox.close();
end;
begin //main loop
clearDebug();
setupSRL();
getToFishSpot();
cutWillow();
repeat
repeat
cutWillow();
until tabBackPack.isFull();
runToBank();
findDepositBox();
until false;
end.