PDA

View Full Version : [TUT]Calling FindNormalRandoms Correctly!



Sin
06-03-2012, 03:29 PM
Hello guys, i've seen ALOT of people call antirandoms like this -

my code my code
my code my code
FindNormalRandoms;
my code my code my code

That is WRONG!

Let's take a look at FindNormalRandoms shall we?

(*
FindNormalRandoms
~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function FindNormalRandoms(): boolean;

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

.. note::

Author: Coh3n
Last Modified: Jan. 22nd, 2012 by Coh3n

Example:

.. code-block:: pascal

FindNormalRandoms();
*)
function FindNormalRandoms(): boolean;
begin
result := _FindAllrandoms(true);
end;

As you can see, it returns a BOOLEAN value, meaning a true or false.
It results TRUE if the Random gets solved, and results FALSE if it does NOT.
The correct way to call FindNormalRandoms is like this -

my code my code
my code my code
my code my code my code
if not FindNormalRandoms then
if not LoggedIn then
TerminateScript/NextPlayer;

What this does is, if it FAILS to solve the random, it'll check if it is logged in.
If it IS logged in, then it'll continue (we'll get to it next ;)) if it isn't, it'll close the script.

Again, most likely if you fail a random, you get teleported to a random location, so unless your script has failsafes, this is what you should do -
if not FindNormalRandoms then
if not LoggedIn then
TerminateScript/Next Player else
begin
Logout;
TerminateScript/NextPlayer;
end;


This was done in browser, so there WILL be errors, point them out to me :)

[/SIMBA]

NoUserName
06-07-2012, 10:28 AM
Cheers i will keep this in mind =]

putonajonny
06-07-2012, 02:15 PM
But if FindNormalRandoms finds a random but can't solve it it will carry on, don't you need:
FindNormalRandoms;
if not LoggedIn then
begin
Players[CurrentPlayer].Status := 'Stuck in a random';
NextPlayer(False);
end;
//or
FindNormalRandoms;
if not LoggedIn then
TerminateScript;
Since FindNormalRandoms will always log you out if you fail a random