SRL Archive - Help

why does this crash my simba?


Shuttleu

2010-07-30 04:33:11

i have this function (MyFindBirdNest) which i made for my vine vanquisher, but it seems to crash my simba after being called about 30 times, but i cannot reproduce it if i run the function by itself

i know it is the function because if i comment out the line that calls it then simba doesn't crash

here are the functions
function AddGroundItemArrays(Array1, Array2: TGroundItemArray): TGroundItemArray;
var
x, y, z: Integer;
begin
x:= Length(Array1);
y:= Length(Array2);
SetArrayLength(Result, x+y);

for z:= 0 to High(Array1) do
Result[z]:= Array1[z];

for z:= 0 to y-1 do
Result[(x+y)-(y-z)]:= Array2[z];
end;

function GetItemsInBox(Box: TBox): TGroundItemArray;
var
x, y: Integer;
Temp: TGroundItemArray;
begin
for x:= Box.X1 to Box.X2 do
for y:= Box.Y1 downto Box.Y2 do
begin
Temp:= GetItemsAt(Tile(x, y));
Result:= AddGroundItemArrays(Result, Temp);
end;
end;

function MyFindBirdNest: Boolean;
var
GroundItems: TGroundItemArray;
i: Integer;
BirdNestLoc: TTile;
begin
if Debug then
Writeln('Searching for birds nest');
GroundItems:= GetItemsInBox(Box);
for i:=0 to High(GroundItems) do
if (GroundItems[i].ID > 5069) and (GroundItems[i].ID < 5076) then
begin
writeln('found birds nest');
writeln('picking up birds nest');
BirdNestLoc:= TileToMS(GroundItems[i].Tile, 0);
Mouse(BirdNestLoc.x, BirdNestLoc.y, 0, 0, False);
Wait(250+Random(500));
if ChooseOptionMulti(['ake', 'ird', 'est']) then
begin
Result:= True;
writeln('picked up birds nest :)');
Break;
end;
end;
if Debug then
Writeln('Finished searching for birds nest');
end;

if you have any idea what is causing it then i would be very greatful

~shut

Sex

2010-07-30 04:41:05

You didn't say which function was the one causing it.

Shuttleu

2010-07-30 06:01:34

whoops, sorry, its MyFindBirdNest

~shut

ffcfoo

2010-07-30 07:15:11

This looks like your Simba is on crack. Try kicking him out of your computer and getting a new Simba to live in your Hard drive. If that doesn't work I hope someone else can because I see nothing wrong with this code.

Wizzup?

2010-07-30 08:19:21

Try removing all reflection related code and see if it still happens.

Shuttleu

2010-07-30 08:37:00

commenting this line out seems to stop it from crashing
Temp:= GetItemsAt(Tile(x, y));
so it is something wrong with that function :/

~shut

ZephyrsFury

2010-07-30 09:32:07

Perhaps the outdated hooks are killing Simba.

Wizzup?

2010-07-30 09:47:03

Let me just state that whatever happens in libsmart is not Simba's fault. If the libsmart.dll segfaults / AV's then that will crash Simba (at least the script thread). Nothing you can do about it, that's what you get when using plugins. ;)

Narcle

2010-07-30 19:21:43

Ground item finding has a leak inside of SMART. We don't know what causes it, but its not in the reflection include its inside SMART itself. This is why I haven't used it because it can't be fixed by normal means.

Shuttleu

2010-07-31 14:58:46

From: Narcle
Ground item finding has a leak inside of SMART. We don't know what causes it, but its not in the reflection include its inside SMART itself. This is why I haven't used it because it can't be fixed by normal means.
damn, any ideas on what else i can use to find the bird nest one the floor using reflection?

~shut

Shuttleu

2010-08-02 05:28:28

does anyone have any ideas…?

~shut

Sex

2010-08-02 05:31:41

Um of course not it is ground item finding..just use color.