Strange safeDelete() issues.
by James Bond · in Torque Game Builder · 01/15/2007 (10:22 am) · 3 replies
I have a bit of a strange problem here. From script, i have a function that creates static sprites and names them by color and number. For example, it checks to see if i have $Red3 created, and if so, it creates $Red4. I also have a function that deletes these sprites at the end of the turn using safedelete() (For example $Red3.safedelete();). The problem is that when i run the function to delete the sprite, it deletes one, two, and three ($Red1, $Red2, and $Red3), but not four. If i try to use the safedelete() command from the console, it says that the object cannot be found, but the imagemap is still there, and i can still move it (Drag and Drop) like it was never removed. I have tried delete(), but i still get the same problem. Any Ideas?
About the author
#2
Which shows that the object does, in fact, exist.
After $Red4.safeDelete();
So the object does get delete, but why does the imagemap stay?
01/15/2007 (1:30 pm)
Ok, here is what i get before the safeDelete().==>$Red4.dump(); Member Fields: AngularVelocity = "0" AutoMassInertia = "1" AutoMountRotation = "0" AutoRotation = "0" BlendColor = "1 1 1 1" BlendingEnabled = "1" canSaveDynamicFields = "1" class = "reddrug" CollisionActiveReceive = "0" CollisionActiveSend = "0" CollisionCallback = "0" CollisionCircleScale = "1" CollisionCircleSuperscribed = "1" CollisionDetectionMode = "POLYGON" CollisionGroups = "-1" CollisionLayers = "-1" CollisionMaxIterations = "1" CollisionPhysicsReceive = "0" CollisionPhysicsSend = "0" CollisionPolyList = "-1.000 -1.000 1.000 -1.000 1.000 1.000 -1.000 1.000" CollisionPolyScale = "1.000 1.000" CollisionResponseMode = "CLAMP" config = "" ConstantForce = "0.000 0.000" ConstantForceGravitic = "0" Damping = "0" Density = "0.01" DstBlendFactor = "ONE_MINUS_SRC_ALPHA" Enabled = "1" FlipX = "0" FlipY = "0" ForceScale = "1" ForwardOnly = "0" frame = "0" Friction = "0.3" GraphGroup = "0" imageMap = "reddrugImageMap" Immovable = "0" Inertia = "1.04167" Layer = "0" Lifetime = "0" LinearVelocity = "0.000 0.000" LinkPoints = "" Mass = "0.25" MaxAngularVelocity = "0" MaxLinearVelocity = "0" MinAngularVelocity = "0" MinLinearVelocity = "0" MountForce = "0" MountInheritAttributes = "0" MountOffset = "0.000 0.000" MountOwned = "0" MountRotation = "0" MountTrackRotation = "1" Paused = "0" position = "-27.500 -12.500" Restitution = "1" Rotation = "0" scenegraph = "t2dScene" size = "5.000 5.000" SortPoint = "0.000 0.000" SrcBlendFactor = "SRC_ALPHA" superclass = "RedDrugSlot" UseMouseEvents = "1" Visible = "1" WorldLimitCallback = "0" WorldLimitMax = "0.000 0.000" WorldLimitMin = "0.000 0.000" WorldLimitMode = "OFF" Tagged Fields: isSelectable = "1"
Which shows that the object does, in fact, exist.
After $Red4.safeDelete();
==>$Red4.safeDelete(); ==>$Red4.dump(); <input> (0): Unable to find object: '2653' attempting to call function 'dump' Set::getObject index out of range.
So the object does get delete, but why does the imagemap stay?
#3
01/15/2007 (3:13 pm)
How are you actually able to turn it etc if the reference to it does not exist anymore? Sounds little curious. But anyway: that what actually allows you to modify it further could be preventing the safeDelete from happening.
Torque Owner Ben R Vesco