Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: pixg on Sat 12/07/2014 13:02:47

Title: Undefined token error
Post by: pixg on Sat 12/07/2014 13:02:47
having a really frustrating problem with AGS at the moment,

it keeps telling me certain things are undefined, hotspots and objects.

I've never had this problem before, e.g I have a hotspot called hDrain

at some point i wanted the drain to dissapear so i used the following code

Code (ags) Select

  hDrain.Active = false;


it tells, when i try to run the game that :

GlobalScript.asc(696): Error (line 696): Undefined token 'hDrain'

from what i understand this is roughly translated as "theres no such thing as hDrain, you havent made a hotspot called that"

but i clearly have! whats going on?

I even have a code earlier saying that if i stand on the hDrain it will play a certain animation and it seems to be fine with that, which confuses me even more.


Title: Re: Undefined token error
Post by: Cassiebsg on Sat 12/07/2014 13:07:05
I maybe be off on this one, but isn't hDrain a room hotspot? I'm not sure you can address room hotspots on the Global Script... try putting the code in the room script instead.

Hope it helps. :)

Edit: Either that or you need to refer to it by hotspot ID like with objects. But again, I may be way off base here (my experience isn't that much with AGS).
Title: Re: Undefined token error
Post by: Calin Leafshade on Sat 12/07/2014 13:18:16
yea, hotspot names are not valid in the global script.

if you want to reference a hotspot from the global you need to use the id like this:


hotspot[5].Visible = false


where "5" is the ID in question.