SRL Archive - OSR Help

Error: Exception: The bitmap[0] does not exist at line 664


rj

2013-07-14 16:34:48

Ah… I feel so dumb posting this. I forgot the fix

Here is the code:

function isCutting():Boolean;
var
count, t:Integer;
begin
count := ss_invCount;
marktime(t);
repeat
wait(250)
if (invcount>count) then result := true;
until (TimeFromMark(t)>4000) or (result = true)
end;

I get this error when ever I try to do

while (isCutting) do
wait(200);

Ian

2013-07-14 16:38:16

From: Officer Barbrady
Ah… I feel so dumb posting thifunction isCutting():Boolean;
var
count, t:Integer;
begin
count := ss_invCount;
marktime(t);
repeat
wait(250)
if (invcount>count) then result := true;
until (TimeFromMark(t)>4000) or (result = true)
end;s.. but I get that and globals to simba opens up I forgot the fix.

Here is the code that causes the crash:


Probably an issue with ss_InvCount. Also where you have
(Result = True);
I think you could just have
Result;

Kasi

2013-07-14 16:40:47

Nothing wrong with that.

Edit: i use this when i cba looking at the logic of loading bitmaps / dtms inside a loop of some sort. i just free whenever i feel like loading a dtm/bitmap and then load the bitmap / dtm when i need it. i know its inefficient. but i always go through and sort it out later.


procedure TryFreeDTM(I : Integer);
begin
try
freeDTM(I);
except
end;
end;

procedure TryFreeBitmap(I : Integer);
begin
try
freeBitmap(I);
except
end;
end;

rj

2013-07-14 16:47:51

From: Kasi
Nothing wrong with that.

I only get the error when I do

While (isCutting) do
wait(200)

Kasi

2013-07-14 16:51:24

From: Officer Barbrady
I only get the error when I do

While (isCutting) do
wait(200)


your basically saying the interpreter is wrong lol, ps is procedural. the error will be in ss_InvCount. if you loaded a bmp in that func.

rj

2013-07-14 17:02:18

From: Kasi
your basically saying the interpreter is wrong lol, ps is procedural. the error will be in ss_InvCount. if you loaded a bmp in that func.


Nope it's just:

{
Written by: Danny RS
}
function ss_ItemExists(SlotToCheck: Integer): Boolean;
Var
xsx,ysy,x,y,R,C:Integer;
begin
SlotToCheck:=SlotToCheck-1;
xsx:=580;
ysy:=230;
C:=(Round(SlotToCheck/4));
R:=(SlotToCheck -(C*4));
If FindColor(x, y, 65536, xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25) Then
begin
Result:=True;
end;
end;
function ss_invcount():Integer;
var
i:Integer;
begin
Result := 0;
for i:=1 to 28 do
if ss_itemexists(i)
then Inc(Result);
end;

Same as the unofficial P07 include

Kasi

2013-07-14 17:29:27

Fixed. because he wasn't calling SetupSRL, some Bitmaps weren't getting loaded.