SRL Archive - RS3 Help

SRL Events


Justin

2014-10-15 05:23:32

I am unable to get SRL_Events to work for some reason…

Script 1
SRL_Events[EVENT_ANTIBAN] := @script1_antiban;

Script 2
SRL_Events[EVENT_ANTIBAN] := @script2_antiban;

utils.simba (located: C:\Simba\Includes\util\utils.simba) - Custom simba file

{$include_once ../Includes/srl-6/srl.simba}
{$include_once ../Includes/SPS/lib/sps-rs3.simba}

function waitPoint(waitPoint: TPoint; area: TSPSArea): boolean;
begin
if not isLoggedIn() then
exit;
while (not (Distance(area.GetPlayerPos, waitPoint) <= 5) and (isLoggedIn)) do
begin
wait(500 + randomRange(100, 200));
if (SRL_Events[EVENT_ANTIBAN] <> nil) then
SRL_Events[EVENT_ANTIBAN]();
end;
exit(true);
end;

utils.simba is a file that I include in Script 1 and Script 2
{$I util/utils.simba}

When I try to compile, I am getting the error message

Error: Operator "cmp_NotEqual" not compatible with types "Unknown" and "Pointer" at line 50
Compiling failed.

utils.simba line 50: if (SRL_Events[EVENT_ANTIBAN] <> nil) then

Any help would be appreciated.

bonsai

2014-10-15 07:15:27

From: Justin

{$include_once ../Includes/srl-6/srl.simba}
{$include_once ../Includes/SPS/lib/sps-rs3.simba}

function waitPoint(waitPoint: TPoint; area: TSPSArea): boolean;
begin
if not isLoggedIn() then
exit;
while (not (Distance(area.GetPlayerPos, waitPoint) <= 5) and (isLoggedIn)) do
begin
wait(500 + randomRange(100, 200));
if (SRL_Events[EVENT_ANTIBAN] <> nil) then
SRL_Events[EVENT_ANTIBAN]();
end;
exit(true);
end;


You're getting burned by auto-invoke. It's running your antiban and complaining that it didn't return a pointer to compare to nil. You need to use '@' to get the address.

SRL-6 uses {$f-} in all files to turn this feature off, and I also like to do this in my code.

Then you need to call your functions with () and a reference like the one you had would give you the pointer to the procedure.


if (@SRL_Events[EVENT_ANTIBAN] <> nil) then

I ran into some other issues trying to get your snippet compiled through, but I will leave that fun to you!

Justin

2014-10-15 07:27:51

From: bonsai
snip


Thanks bonsai!

Compiled successfully in 2125 ms.

The reason why you were getting some compiling errors is because I wrote that code in the browser without testing it.