SRL Archive - Bugs

LoggedIn range check error


Cigue

2010-08-03 18:42:27

Everytime I run my script, I get an error on line 110 of Players.scar.

function LoggedIn: Boolean;
var
cx, cy: Integer;
begin
Result := FindColor(cx, cy, 16777215, 439, 491, 440, 492);//range check error
end;

The script is attached.

EvilChicken!

2010-08-03 20:38:28

Does this error occur while you're using SMART? I think I remember seeing issues like this before, but those occurred such a long time ago, I cannot recall how I fixed them, and they might not even relate to your case anyway.

Either way, I have some good news for you; the script works for me (testing in standard RS screen). Assuming the error occurs at first login?

Anyway, I always like to add two lines to my script:
ActivateClient;
Wait(1000 + Random(1000));

Put those in right before your first LogInPlayer procedure call. In your script, they would go close to the very beginning of your mainloop, with these being the surrounding lines:
begin
SetupSRL;
Setup_DeclarePlayers;

ActivateClient;
Wait(1000 + Random(1000));

LogInPlayer;
Wait(Random(500)+1000);
GameTab(Tab_Inv);

(I don't think you're stupid or anything, I just want to make sure I make myself clear :p)

Although, I do get an error in Misc_ProgressReport; – it fails to FreeDTM(Made); – but I'm sure you already were aware of that.

Cigue

2010-08-03 23:06:03

From: EvilChicken!
Either way, I have some good news for you; the script works for me (testing in standard RS screen). Assuming the error occurs at first login?


I ran it in standard screen too, sounds like the problem is with my SRL.

From: EvilChicken!
Anyway, I always like to add two lines to my script:
ActivateClient;
Wait(1000 + Random(1000));

Put those in right before your first LogInPlayer procedure call. In your script, they would go close to the very beginning of your mainloop, with these being the surrounding lines:
begin
SetupSRL;
Setup_DeclarePlayers;

ActivateClient;
Wait(1000 + Random(1000));

LogInPlayer;
Wait(Random(500)+1000);
GameTab(Tab_Inv);

Although, I do get an error in Misc_ProgressReport; – it fails to FreeDTM(Made); – but I'm sure you already were aware of that.


What does ActivateClient do? I'm just curious, I'll probably start using it anyway.

As for that last bit, I didn't know, and looking at the script I can't really be sure what is causing that. Made is a global DTM loaded once at the start and never freed anywhere else, so why would that fail?

EvilChicken!

2010-08-03 23:28:24

Before I comment on anything else; YOU NEED TO SPLIT UP YOUR PROCEDURES! DX
I think I've told you that before. :p
For instance, like this:
function DeclareWhatDo: Boolean;
var
Material: Integer;
I: Byte;
begin
for I := 0 to 2 do
begin
case (I) of
0: Material := DTMFromString('78DA63E46661601067624005103E2394C7C80' +
'8542345400D33116AF8816A6409A81106AA9127A0461CA8469480' +
'1A56A01A41026A3889F03BC83D12F8D5000017FA01A0');
1: Material := DTMFromString('78DA63E466616048636440054C601226CAC80' +
'954934A849A64026AB8806A1209A8E105AA8925A0861FA8268A80' +
'1A4122D4F001D52411E19E14026A406198805F0D007AF9049B');
2: Material := DTMFromString('78DA633465616008636440054C601226CAA80' +
'554E347408D2E508D270135464035EE04D480DCE346408D0D1176' +
'D901D57811506341D83D009F610442');
end;
if FindDTM(Material, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
case (I) of
0: WhatDo := 'Bolts';
1: WhatDo := 'Darts';
2: WhatDo := 'Headless Arrows';
end;
Result := True;
end;
FreeDTM(Material);
if (Result) then exit;
end;
Misc_ProgressReport;
end;

And, you need more failsafes: the runtime error I was getting, was because it didn't find any of the DTMs it was looking for, and continued on without loading any. I know it can be a true pain, but having failsafe checks for such situation makes a script really stable and trustworthy; you won't be wondering why something totally unrelated doesn't work when you have an error in some place you didn't know you had an error.
So, debugging is key. Make your script have a debugging mode and debug every single thinkable thing. Even things that seem unworthy.

But, yes, regarding your actual error .. (:p) .. if you're sure that you're running RuneScape on 'Safe Mode' (found in options screen), then a solution might be to reinstall Simba + SRL opendev.

Cigue

2010-08-03 23:32:22

From: EvilChicken!
Before I comment on anything else; YOU NEED TO SPLIT UP YOUR PROCEDURES! DX
I think I've told you that before. :p
For instance, like this:
function DeclareWhatDo: Boolean;
var
Material: Integer;
I: Byte;
begin
for I := 0 to 2 do
begin
case (I) of
0: Material := DTMFromString('78DA63E46661601067624005103E2394C7C80' +
'8542345400D33116AF8816A6409A81106AA9127A0461CA8469480' +
'1A56A01A41026A3889F03BC83D12F8D5000017FA01A0');
1: Material := DTMFromString('78DA63E466616048636440054C601226CAC80' +
'954934A849A64026AB8806A1209A8E105AA8925A0861FA8268A80' +
'1A4122D4F001D52411E19E14026A406198805F0D007AF9049B');
2: Material := DTMFromString('78DA633465616008636440054C601226CAA80' +
'554E347408D2E508D270135464035EE04D480DCE346408D0D1176' +
'D901D57811506341D83D009F610442');
end;
if FindDTM(Material, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
case (I) of
0: WhatDo := 'Bolts';
1: WhatDo := 'Darts';
2: WhatDo := 'Headless Arrows';
end;
Result := True;
end;
FreeDTM(Material);
if (Result) then exit;
end;
Misc_ProgressReport;
end;

And, you need more failsafes: the runtime error I was getting, was because it didn't find any of the DTMs it was looking for, and continued on without loading any. I know it can be a true pain, but having failsafe checks for such situation makes a script really stable and trustworthy; you won't be wondering why something totally unrelated doesn't work when you have an error in some place you didn't know you had an error.
So, debugging is key. Make your script have a debugging mode and debug every single thinkable thing. Even things that seem unworthy.

But, yes, regarding your actual error .. (:p) .. if you're sure that you're running RuneScape on 'Safe Mode' (found in options screen), then a solution might be to reinstall Simba + SRL opendev.


I don't get how RuneScape could cause a RANGE CHECK ERROR but it indeed is in safe mode. :/

EDIT : also, the version I published only checked once for every DTM, how could it go into an endless loop like you said?