SRL Archive - OSR Help

FindNormalRandoms


Roflme

2012-10-13 11:20:55

procedure WalkToTanner;
var
myPath: TPointArray;
begin
MarkTime(WalkTimer);
myPath := [Point(4576, 2929), Point(4566, 2971),
Point(4565, 3025), Point(4584, 3029)];

SPS_WalkPath(myPath);

if TimeFromMark(WalkTimer) > 45000 then
begin
if FindNormalRandoms then
begin
WalkToTanner;
end else
begin
WalkToBank;
WalkToTanner;
end;
end;
end;

(someone tell me if I've used end else correctly there; for some reason I can never use it correctly)

FindNormalRandoms will only come back true if it finds a random and solves it right? I don't want it to throw my script off because I'm not using it properly.

The procedure is supposed to walk to the tanner, and if it takes a while (45 seconds) if it finds a random it'll solve it and then resume walking to tanner. If it doesn't find a random then it got stuck somehow and it'll walk back to the bank, and then return back to the tanner.

J J

2012-10-13 11:42:56

You can just call FindNormalRandoms normally. If it doesn't solve the random it will log off in most cases so your script will stop anyways. Here in your script adding the if statement does nothing, you could make it into a boolean though so you can stop the script if it doesn't return true.

function WalkToTanner: boolean

Enslaved

2012-10-13 12:04:40

doesnt findnormalrandoms return false if no random is detected?

IMO i would just place it as
FindNormalRandoms;
as if it fails it would just log out

riwu

2012-10-13 20:15:19

From: Enslaved
doesnt findnormalrandoms return false if no random is detected?

IMO i would just place it as
FindNormalRandoms;
as if it fails it would just log out

This would be fine in most cases but for some cases like banking/walking, if no failsafe is in place to repeat the procedure, even if the random is successfully solved the script may not be able to recover from incomplete actions.

@rolfme
WalkToBank;
WalkToTanner;
is called in an else statement so if FindNormalRandoms returns true it's not going to execute them?

Try have your walking in a separate procedure then do something like:
for i:=0 to 2 do
begin
WalkToTanner;
if AtTanner then
Break;
FindNormalRandoms;
end;

I'm not sure if SPS can recover from that though, unless you blindwalk, or try get your current position and adjust the array myPath to skip points that you've already walked to, and continue from there.

noidea

2012-10-13 21:30:37

Iirc, FindNormalRandoms would return true if it was stuck in a random. This is how I'd do it:


for i:= 0 to 5 do
if findnormalrandoms then
exit
else
walkingstep(i);

riwu

2012-10-13 21:55:16

From: noidea
Iirc, FindNormalRandoms would return true if it was stuck in a random. This is how I'd do it:


for i:= 0 to 5 do
if findnormalrandoms then
exit
else
walkingstep(i);

Nope it returns true only if an event is found and successfully solved.
To check whether it failed you can check for (Players[CurrentPlayer].Active).

FindNormalRandoms
~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function FindNormalRandoms(): boolean;

Finds and solves Runescape's random events. Returns true if an event was
solved.