Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Lewis on Sat 27/10/2012 10:19:50

Title: Undefined token and disappearing objects [Solved]
Post by: Lewis on Sat 27/10/2012 10:19:50
I don't know if this is a beginners' technical question or an advanced technical question, really, but something weird has happened with my objects.

They're all listed perfectly within the objects drop-down for each room, but when I try to call any of them in the script I get an undefined token message.

The objects also aren't appearing in any code auto-complete. Inventory items, characters, dialogs, everything else - all working fine, appearing as normal. But the script seems to think all my objects have gone.

And I have literally no idea how to get around this.

Hopefully these images will help to illustrate:

http://lewisdenby.files.wordpress.com/2012/10/ags-problem.png - Undefined token message, even though oTiedBedding is clearly defined.
http://lewisdenby.files.wordpress.com/2012/10/ags-problem-1.png - In global script, characters are right there in the autocomplete list...
http://lewisdenby.files.wordpress.com/2012/10/ags-problem-2.png - ...but there's no sign of objects.

Now, I'm not sure what/if I did anything to cause this problem. Last time I launched the game from the editor, a few days ago, it was fine. Then I went in today and fixed two small bugs, tried to launch again to test... and this.

Any ideas? I really could do to get this fixed as soon as possible.
Title: Re: Undefined token and disappearing objects
Post by: Andail on Sat 27/10/2012 10:26:55
You're calling the objects from the Global script using their object name, which won't work. Use the object ID number instead. (Only use oTV and similar within the room)
Title: Re: Undefined token and disappearing objects
Post by: Lewis on Sat 27/10/2012 10:39:01
Well, I wondered about that as well, but calling objects by their object name has worked fine for me for the past 12 months, and I appear to have fixed the problem again by simply undoing the minor bugfixing I did before. Now I need to work out what it actually was that went wrong...

EDIT: Wait, hang on. Hmm. Maybe I'm going absolutely mental. Let me study the script for a minute.

EDIT 2: Minor brain fart there. Of course you can't call object names from the global script - and nor have I been trying to for the past 12 months. What happened is I C&Pd some code from the room script to the global script without noticing that there were an errant couple of object names in there. Replaced with object[id] and it works fine.

Solved! Fixed! Head banged repeatedly against the wall, and no progress whatsoever made today!