My Function Isn't A Defined Token. Boo-Hoo.

Started by rtf, Sat 27/03/2004 21:22:45

Previous topic - Next topic

rtf

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!
I fail at art.

Pumaman

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.

rtf

yeah, i actually did paste it at the very top of the global script.  Thanks, though.
I fail at art.

Kweepa

You are using these in a room script, I presume.
And you didn't "import" the functions.
Still waiting for Purity of the Surf II

rtf

#4
EDIT:

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

SMF spam blocked by CleanTalk