SRL Archive - OSR Help

Help with failsafe?


Gl3nn IV

2012-02-23 16:21:55

I want to add a failsafe into my script to do the following, click on minimap at selected point ( i have the DTM for it) If wait exceeds a set time.

Im unsure what and where to add in this.
var
Xi, Yi, X1, Y1, X2, Y2: Integer;
begin
//Writeln('Checking for bones');
if FindObjEx(Xi, Yi, ['ake', 'ke'], BoneColours, 3, 50, 1, 5, 689, 390) then
begin
GetMousePos(Xi, Yi);
Mouse(Xi, Yi, 0, 0, false);
if WaitOptionMulti(['ake Bone', 'ake B'], 200) then
Wait(RandomRange(700, 1200));
while IsMoving do
begin
Wait(250);
antiban;
end;
If not(invfull) then
begin
FindBones;
or if FindObjEx
end;
end;
end;

Thanks in advance

RISK

2012-02-23 16:28:51

procedure Example;
var
T, maxT: Integer;
begin
T := 0;
maxT := (RandomRange(8500, 10000)); // Minimum and maximum amount of wait time

MarkTime(T);

while (TimeFromMark(T) < maxT) do
begin
WriteLn('Waiting.');
Wait(1000);
end;
end;

Is an example of what you could do. If you need anything to be explained, feel free to ask! :) We don't mind at all.


E: For a further example of what you want to do specifically:
procedure Example;
var
T, maxT: Integer;
begin
T := 0;
maxT := (RandomRange(8500, 11500));

MarkTime(T)

repeat
if (TimeFromMark(T) >= maxT) then
WriteLn('T is greater than or equal to maxT.'); // Replace with fail-safe(s)

WriteLn('Waiting.');
Wait(1000);
until(False);
end;

Gl3nn IV

2012-02-23 17:07:26

Thanks for the advice, i couldn't find anything about waiting times :P
Does T stand for the time or something else? T := 0;
I can't do DTM's walking and its annoying. Any other simple clicker, it only needs to walk to one spot if wait exceeds a certain time.. :3

Sorry for being a noob.

RISK

2012-02-23 17:16:09

T := 0; is to simply set the integer 'T' to 0. It's a habit of mine to set all the integers and such to default values at the procedure/function's start.

maxT := (); sets the maximum amount of time to wait before it does the fail-safe in mind. We set it there as each time the if (TimeFromMark(T), etc) gets called, it will create a random value for it to choose from. But if we set it at the start of the script as a set integer, it won't be random each time the if .. then comes up.

MarkTime(T); will begin to mark the time that will pass after calling this in to the integer we place in between the parenthesis. In this case, 'T'.

We use TimeFromMark(T) to get the value of 'T' in a way that we can compare it to maxT and see if we need to initiate a fail-safe or not.


You could use SPS, by the way, for the walking. If you're having trouble with DTM walking, that is.

Gl3nn IV

2012-02-23 17:38:01

Ahh, thanks you explain really well. I just compiled the DTM method so it may work… If not i'll just rage.
I may use SPS if this doesn't work.
Thanks for all the help again :)