List problem

I am having a problem with a list. I'm defining it in the Start Script section, as follows (only the first lines of the code are shown):

udg = NewObjectList()
list add (udg, cellar)
list add (udg, portcullis room w)
list add (udg, small cellar s)

However, when I try to access the list in the game, I'm told thatudg is not recognised as an object. Is there somewhere else that I need to define it?


However, when I try to access the list in the game

Where are you trying to access it? Later in the start script?

Variables only exist within the script that defined them.

If you want something to be accessible within different scripts, you need to make it an attribute. A common way to do this (for variables which don't relate to a particular object) is to replace the name udg with game.udg. Then it will be accessible to all scripts as long as the game object exists.


Thanks - it works fine now.


Log in to post a reply.

Support

Forums