Log in

View Full Version : why does this crash my simba?



Shuttleu
07-30-2010, 08:33 AM
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
07-30-2010, 08:41 AM
You didn't say which function was the one causing it.

Shuttleu
07-30-2010, 10:01 AM
whoops, sorry, its MyFindBirdNest

~shut

ffcfoo
07-30-2010, 11:15 AM
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?
07-30-2010, 12:19 PM
Try removing all reflection related code and see if it still happens.

Shuttleu
07-30-2010, 12:37 PM
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
07-30-2010, 01:32 PM
Perhaps the outdated hooks are killing Simba.

Wizzup?
07-30-2010, 01:47 PM
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
07-30-2010, 11:21 PM
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
07-31-2010, 06:58 PM
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
08-02-2010, 09:28 AM
does anyone have any ideas...?

~shut

Sex
08-02-2010, 09:31 AM
Um of course not it is ground item finding..just use color.