PDA

View Full Version : Need help adding a rest feature



illuminatiswag
02-22-2012, 05:03 PM
Tittle says it all would appreciate it

Runaway
02-22-2012, 08:14 PM
This is a procedure I used in one of my scripts:


procedure Replenish;
var
i: integer;
begin
if ColorWait(500, 255, 742, 107, 760, 119) then
// Looking for the color 255, the red to the right of the run energy button
begin
SetRest;
MarkTime(i);
repeat
Wait(1000+Random(1000));
until(ColorWait(500, 65280, 742, 107, 760, 119) or (TimeFromMark(i) > 30000));
// Looking for the color 65280, the green to the right of the run energy button
Wait(3000+Random(1000));
end;
end;


Since the text turns green when you hit 75+ energy, I implemented a few second wait after the loop was finished to make sure the energy gets to at least 90+ energy before ending.

You should call it often in your script since it will only replenish the run energy if it's below 25 energy.