Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mster24 on Mon 03/09/2007 13:56:05

Title: "Undefined Token" Scripting Error
Post by: Mster24 on Mon 03/09/2007 13:56:05
I'm making an RPG, "Ruby Quest", using the RPG-Making tutorial available on the site. I keep trying to save the game, but it says that there's an undefined token in a script. Here's the script, and the line with the problem is bold. It's under the repeatedly_execute section of the global script.

String mana;
String expweapon;
String expmagic;
String enemyhp;  //this is the HP of your enemy. ignore it for now.
StrFormat (Mana, "%d", GetGlobalInt (2));
StrFormat (expweapon, "%d", GetGlobalInt (3));
StrFormat (expmagic, "%d", GetGlobalInt (4));
StrFormat (dusmanhp, "%d", GetGlobalInt (5));
SetLabelText (0, 1, gold); //so the mana points will be shown in the GUI 0, Label 1)
SetLabelText (0, 2, exp);
SetLabelText (0, 9, expbuyu);
SetLabelText (4, 1, dusmanhp); //this code isn't too necessary for now. it is about another GUI, number 4. 
// put anything you want to happen every game cycle here

Could someone help?
Title: Re: "Undefined Token" Scripting Error
Post by: Rui 'Trovatore' Pires on Mon 03/09/2007 14:29:44
Out of curiosity, is your variable defined as "mana" or "Mana"? Capitalization matters.
Title: Re: "Undefined Token" Scripting Error
Post by: Khris on Mon 03/09/2007 14:37:58
Wow, that code's a mess.

In the GUI editor, select the labels to show the numbers and name them (enter a descriptive name where it says "Script name").

Say you've named the label that's supposed to show the amount of mana "lblMana":

Then use:
  lblMana.Text=String.Format("%d", GetGlobalInt(2));