SRL Archive - OSR Help

Error


KingKong

2010-12-15 20:56:04


for i := 1 to 3 do
begin
if GetCurrentTab <> tab_Magic then
GameTab(tab_Magic);
if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
Mouse(x, y, 2, 2, true);
FreeBitmap(Bitmap);
while (GetCurrentTab <> tab_Inv) and (a <= 3) do
begin
wait(300);
a := i + 1;
end;
R_FindRandoms;
MouseItem(i, true);
while (GetCurrentTab <> tab_Magic) and (b <= 3) do
begin
wait(500 + random(500));
b := b + 1;
end;
AntiBan;
end;
when i ran the script yesterday and the day before it ran perfectly, but today it gave me this error:
Error: Exception: The bitmap[2] does not exist at line 69(if findbitmaptol….then)
The following DTMs were not freed: [SRL - Lamp bitmap]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 16-12-10 14.txt] has not been freed in the script, freeing it now.

Any ideas on how to fix it?

i luffs yeww

2010-12-15 21:47:26

Can you show the whole script? Seems as if Bitmap isn't declared..

KingKong

2010-12-15 23:47:28


procedure CastSpell;
var
a, b, i, x, y, Bitmap: Integer;
begin
R_FindRandoms;
Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
'dLB+0AK0k/eSq4Tn8li8k64Ze');
for i := 1 to 3 do
begin
if GetCurrentTab <> tab_Magic then
GameTab(tab_Magic);
if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
Mouse(x, y, 2, 2, true);
FreeBitmap(Bitmap);
while (GetCurrentTab <> tab_Inv) and (a <= 3) do
begin
wait(300);
a := i + 1;
end;
R_FindRandoms;
MouseItem(i, true);
while (GetCurrentTab <> tab_Magic) and (b <= 3) do
begin
wait(500 + random(500));
b := b + 1;
end;
AntiBan;
end;
end;

i luffs yeww

2010-12-15 23:50:20


procedure CastSpell;
var
a, b, i, x, y, Bitmap: Integer;
begin
R_FindRandoms;
Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
'dLB+0AK0k/eSq4Tn8li8k64Ze');
for i := 1 to 3 do
begin
if GetCurrentTab <> tab_Magic then
GameTab(tab_Magic);
if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
Mouse(x, y, 2, 2, true);
//FreeBitmap(Bitmap); You have to put this outside the loop.
while (GetCurrentTab <> tab_Inv) and (a <= 3) do
begin
wait(300);
a := i + 1;
end;
R_FindRandoms;
MouseItem(i, true);
while (GetCurrentTab <> tab_Magic) and (b <= 3) do
begin
wait(500 + random(500));
b := b + 1;
end;
AntiBan;
end;
FreeBitmap(Bitmap);
end;

Or just have a..


procedure ScriptTerminate;
begin
FreeBitmap(Bitmap);
end;

etc. etc.

KingKong

2010-12-15 23:54:47

I tried it putting outside the loop as well and tried without freeing it as well, but it still didn't work

Heysus

2010-12-16 00:09:07

From: kongking
I tried it putting outside the loop as well and tried without freeing it as well, but it still didn't work


If that didn't work then I have no idea how to fix it. You could try making the bitmap global instead of declaring it every time you call that function.

i luffs yeww

2010-12-16 00:39:12

And you should still post the whole script rather than just one procedure.

KingKong

2010-12-16 00:42:51

Still giving me the same error.

Edit: here's the script:


{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := true;
Pin := '';
BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
Integers[0] := 333;
end;
end;

procedure AntiBan;
begin
case random(1001) of
0..40: BoredHuman;
41..80: PickUpMouse;
81..120: HoverSkill('Smithing', false);
121..160: HoverSkill('Magic', false);
161..200: RandomMovement;
201..220: MakeCompass('random');
220..240: RandomRClick;
end;
end;

procedure WithdrawOres;
begin
if not BankScreen then
R_OpenBankBooth('vwb');
if PinScreen then
InPin(Players[0].Pin);
if BankScreen then
begin
Withdraw(3, 0, 3); //bank slot 4
wait(365 + random(210));
Withdraw(2, 0, 0);
wait(132 + random(52)); //bank slot 3
end;
CloseBank;
wait(50 + random(300));
end;

procedure CastSpell;
var
a, b, i, x, y, Bitmap: Integer;
begin
R_FindRandoms;
Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
'dLB+0AK0k/eSq4Tn8li8k64Ze');
for i := 1 to 3 do
begin
if GetCurrentTab <> tab_Magic then
GameTab(tab_Magic);
if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
Mouse(x, y, 2, 2, true);
FreeBitmap(Bitmap);
while (GetCurrentTab <> tab_Inv) and (a <= 3) do
begin
wait(300);
a := i + 1;
end;
R_FindRandoms;
MouseItem(i, true);
while (GetCurrentTab <> tab_Magic) and (b <= 3) do
begin
wait(500 + random(500));
b := b + 1;
end;
AntiBan;
end;
end;

procedure BankOres;
begin
if not BankScreen then
R_OpenBankBooth('vwb');
if PinScreen then
InPin(Players[0].Pin);
if BankScreen then
Deposit(1, 3, true);
end;

procedure MainLoop;
var
loads: Integer;
begin
repeat
WithdrawOres;
CastSpell;
BankOres;
loads := loads + 1;
ClearDebug;
writeln('Running for: ' + TimeRunning);
writeln('Loads done: ' + IntToStr(loads));
writeln('Smithing exp: ' + ToStr(112.5 * loads));
writeln('Magic exp: ' + IntToStr(159 * loads));
until(loads = Players[0].Integers[0]);
end;

begin
Smart_Members := false;
Smart_Server := 123;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
DeclarePlayers;
LogInPlayer;
MainLoop;
Logout;
end.

Bonfield

2010-12-16 01:26:34

I would make the bitmap global and take the freeing out of the function and donut externally, that should fix your problem

I think what happens the script loads the bitmap but it gets freed before getting used

KingKong

2010-12-16 02:06:53

Already tried it making a global variable, but it still gives me the same error.

Bonfield

2010-12-16 02:09:49

I haven't got access to a computer with simba, i will have a better look when i get home

lordsaturn

2010-12-16 03:01:54

When I = 1, you call FindBitmapTol, then 2 lines later, you free the bitmap. When I = 2, you call FindBitmapTol, and are returned an exception because you have no bitmap to search for.

KingKong

2010-12-16 03:10:44

^ This solved my problem. I just put the bitmap in the loop.

Bonfield

2010-12-16 03:14:51

I was trying to explain what lordsaturn said, wouldn't putting the bitmap in the loop be the same as declaring it over and over again, just free the bitmap on result or when the function fails

i luffs yeww

2010-12-16 04:19:25

From: kongking
^ This solved my problem. I just put the bitmap in the loop.


From: lordsaturn
When I = 1, you call FindBitmapTol, then 2 lines later, you free the bitmap. When I = 2, you call FindBitmapTol, and are returned an exception because you have no bitmap to search for.


Doing what I said would fix the problem, too..? >_>

KingKong

2010-12-16 04:50:54

lol, i think you all were trying to say the same thing to me, and i only realised it after hearing it like 5 times.

KingKong

2010-12-16 20:59:10

Does anyone know how to start a script from within a script and close an opened script from within a script?(Didn't want to open a new thread just for this)

i luffs yeww

2010-12-16 22:50:36

Well, you could look at how MSI works. Recently they've been working on something similar to this. But in short, no. Not without modifications, I don't think.