Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: rtf on Sat 27/03/2004 21:22:45

Title: My Function Isn't A Defined Token. Boo-Hoo.
Post by: rtf on Sat 27/03/2004 21:22:45
OK, let's get right to it.

I downloaded Geoffkhan's sample game, and I noticed a very smart function that he put in there.  Apparently he makes a function to make the character face left, right, etc...

So I was like "Dude, I am so ripping this."
So I copied it and then I pasted it in my global script:

Quote
function faceback () {
FaceLocation(GetPlayerCharacter(),160,-1000);
}
function facefront () {
FaceLocation(GetPlayerCharacter(),160,1000);
}
function faceleft () {
FaceLocation(GetPlayerCharacter(),-1000,100);
}
function faceright () {
FaceLocation(GetPlayerCharacter(),1000,100);
}

So then I tried to implement it in my game:

Quote
DisplaySpeech(1, "I'm going to check this out.");
faceright();
I get an "undefined token" error message.
Why is AGS doing this to me?  I can't take it!  I even copied and pasted it all, it should work!
Title: Re:My Function Isn't A Defined Token. Boo-Hoo.
Post by: Pumaman on Sat 27/03/2004 21:36:34
Where did you paste it? The function has to be defined before it can be used, so make sure you pasted the function definitions near the top of the global script.
Title: Re:My Function Isn't A Defined Token. Boo-Hoo.
Post by: rtf on Sat 27/03/2004 22:56:05
yeah, i actually did paste it at the very top of the global script.  Thanks, though.
Title: Re:My Function Isn't A Defined Token. Boo-Hoo.
Post by: Kweepa on Sun 28/03/2004 02:26:47
You are using these in a room script, I presume.
And you didn't "import" the functions.
Title: Re:My Function Isn't A Defined Token. Boo-Hoo.
Post by: rtf on Sun 28/03/2004 02:36:22
EDIT:

OK, i got help from the master himself.  Apperntly, I forgot about the script header...
silly me  :-X