Runtime Error: Object does not exist

Blitz3D Forums/Blitz3D Programming/Runtime Error: Object does not exist

UncleLag(Posted 2003) [#1]
I'm sure I'm missing something obvious, bur I just can't work out what it is.

When I try to run my program a Runtime Error dialog is displayed with the message "Object does not exist". It highlights the following line of code:

planet.ssb\xposTemp# = planet.ssb\xposTemp# - xvelTemp#.

Here is the code in context:

Type ssb
Field name$
Field ID
Field mass#
Field radius#
Field xpos#,ypos#,zpos#
Field xposTemp#
Field yposTemp#
Field zposTemp#
Field xvel#,yvel#,zvel#
; Field xvelTemp#,yvelTemp#,zvelTemp#

Field entity
End Type

...code deleted...



For planet.ssb = Each ssb
planet.ssb\xposTemp# = planet.ssb\xpos#
planet.ssb\yposTemp# = planet.ssb\ypos#
planet.ssb\zposTemp# = planet.ssb\zpos#
xvelTemp# = planet.ssb\xvel#
yvelTemp# = planet.ssb\yvel#
zvelTemp# = planet.ssb\zvel#
IDTemp = planet.ssb\ID





For planet.ssb = Each ssb
If IDTemp <> planet\ID Then ;we don't want to include the planet's effect on itself
xvelTemp# = xvelTemp# + ((G * planet\mass)/((planet.ssb\xpos# - xposTemp#)^2)) ;remember to confirm if
yvelTemp# = yvelTemp# + ((G * planet\mass)/((planet.ssb\ypos# - yposTemp#)^2)) ;squaring is slower than
zvelTemp# = zvelTemp# + ((G * planet\mass)/((planet.ssb\zpos# - zposTemp#)^2)) ;multiplying together


End If
Next
;we will use the Temps to store information, otherwise the results for
;the next planet will be skewed/screwed by the results from the previous calculations

planet.ssb\xposTemp# = planet.ssb\xposTemp# - xvelTemp#
planet.ssb\yposTemp# = planet.ssb\yposTemp# - yvelTemp#
planet.ssb\zposTemp# = planet.ssb\zposTemp# - zvelTemp#

planet.ssb\xvel# = xvelTemp#
planet.ssb\yvel# = yvelTemp#
planet.ssb\zvel# = zvelTemp#
Next

;now we can finalise the results.
For planet.ssb = Each ssb
planet.ssb\xpos# = planet.ssb\xposTemp#
planet.ssb\ypos# = planet.ssb\yposTemp#
planet.ssb\zpos# = planet.ssb\zposTemp#

PositionEntity planet\entity,planet\xpos#,planet\ypos#,planet\zpos#

Next


Skysaw(Posted 2003) [#2]
Could be that you're using the same identifier within two nested loops:

For planet.ssb = Each ssb
...
For planet.ssb = Each ssb
...
next
next

There's no way to distinguish the two planet variables. At the very least, change one of them so you can tell which is the problem.