PDA

View Full Version : The correct way to find randoms



Cazax
02-04-2009, 08:00 PM
I have seen scripts are calling randoms in a wrong way:
Procedure CheckRandoms;
Begin
FindNormalRandoms;
End;

That's wrong, if you get an unsolvable random or it couldn't solve a random, FindNormalRandoms will logout. So, if you call it inside a loop for example:
Repeat
CheckRandoms;
If FindTree(X, Y) Then
Begin
Mouse(X, Y, 5, 5, True);
..................
It would logout and start searching for a tree. How to call it:
Repeat
If FindNormalRandoms Then
If Not LoggedIn Then
Exit;
If FindTree(X, Y) Then
Begin
Mouse(X, Y, 5, 5, True);
..............
That's why FindNormalRandoms is a function, not a procedure. You could adapt it to check fights too. example:
Function Randoms: Boolean;
Begin
Result := FindNormalRandoms;
If FindFight Then
Begin
...
Result := True;
End;
End;

......

If Randoms Then
Begin
Writeln('Found random/fighting random!');
If Not LoggedIn Then
Exit;
End;
Thank you for reading :)


Just be sure you don't do this in your main loop, or it will accidentally terminate your script. Sometimes instead of exit; you need to use break;

Heavenzeyez1
02-04-2009, 08:11 PM
That's why my woodcutter always keeps looking for the tree in Molly etc...
Thanks a ton!
~Eerik~

noidea
02-04-2009, 08:29 PM
I didnt relise this eigther! Its amazing on how people get to SRL members, and not know this. Rep'd.

Heavenzeyez1
02-04-2009, 08:38 PM
I didnt relise this eigther! Its amazing on how people get to SRL members, and not know this. Rep'd.

Exactly. Like.. when I first didn't have any antirandoms.. people used to say: "Just add FindNormalRandoms; to somewhere. -.- , so I thought that was it. But later one day, I thought why it will search for tree in molly, I was like. :|
Forgot to mention, rep'd. :)
~Eerik~

tarajunky
02-04-2009, 09:03 PM
Just be sure you don't do this in your main loop, or it will accidentally terminate your script. Sometimes instead of exit; you need to use break;

Coh3n
02-14-2011, 07:14 PM
Hm, I always knew it was a function, but never realized it logged out. Explains a lot...

Guess you learn something new every day. ;)

E: I actually went through Reflection's and SRL's FindRandoms, and neither return true if they failed. They only return true when the random is solved. Please, correct me if I'm wrong.