Undefined token error

Started by pixg, Sat 12/07/2014 13:02:47

Previous topic - Next topic

pixg

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

  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.



Cassiebsg

#1
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).
There are those who believe that life here began out there...

Calin Leafshade

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:

Code: ags

hotspot[5].Visible = false


where "5" is the ID in question.

SMF spam blocked by CleanTalk