1.5 beta 3 Mac crash
by Vern Jensen · in Torque Game Builder · 07/05/2007 (11:55 am) · 2 replies
I've found when working on my game that if I have an object that doesn't exist, and try to call a function on it, that the entire program will just crash if this happens a lot in a short amount of time (i.e. lots of sprites have timers that all go off within a few milliseconds of each other, flooding the console with error messages of "object not found").
For instance, if there is code:
%mySprite.moveToHere(5,6);
%mySprite.moveToThere(2,3);
and %mySprite ends up not existing somehow, and this code gets called a lot in a short amount of time, then the whole program will just *crash*, making it difficult to try to see what's in the console before the whole thing just quits.
-Vern
For instance, if there is code:
%mySprite.moveToHere(5,6);
%mySprite.moveToThere(2,3);
and %mySprite ends up not existing somehow, and this code gets called a lot in a short amount of time, then the whole program will just *crash*, making it difficult to try to see what's in the console before the whole thing just quits.
-Vern
#2
07/09/2007 (9:53 am)
Thanks, Guy. I had a fuzzy recollection of having seen the isobject() call before, but wasn't sure if it would tell me if a real object had been deleted or not. Good to know.
Torque Owner Guy Lewis
A couple of things.
First, The log uses buffered writes, if you stream a large amount of data to the log quickly it will overrun the buffer and crash the program. Second you can use the isobject() call to check that the object exists before trying to manipulate it. That would eliminate the log being flooded with the missing object entries.
if(isobject(%mySprite)) { %mySprite.moveToHere(5,6); %mySprite.moveToThere(2,3); }I am wondering why your program would encounter so many objects that don't exist. I would suggest reviewing your code for ways to improve object tracking.
~Guy
hope this helps.