Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: SinSin on Sun 15/06/2008 20:38:58

Title: Do_dance undefined token tutorial
Post by: SinSin on Sun 15/06/2008 20:38:58
I am currently working my way through the tutorial for scripting on AGS 2.7 and have gotten as far as part 2  everything is starting to sink in but i have come across this undefined token malarchy
Currently I have
function do_dance () {       
   cEgo.LockView(10);
   cEgo.Animate(2, 5);
   cEgo.UnlockView();
}

At the very top of my Global script
and I have
function hotspot4_a() {// script for Hotspot 4 (Hotspot 4): Interact hotspot
do_dance(); 

In my interact hotspot4 script

Why should i be getting an undefined token message when i have created a function of exactly the same name

Thanx in advance Sin
Title: Re: Do_dance undefined token tutorial
Post by: GarageGothic on Sun 15/06/2008 20:52:36
Because the function is in the global script and the hotspot is in the room script. You need to "import function do_dance();" in the global header  to be able access it from room scripts (you can also import it in the room script if you only use it in that one room, but then you may as well move the whole funciton to the room script).