Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: JudgeDeadd on Sat 04/12/2004 13:37:30

Title: Undefined symbol :(
Post by: JudgeDeadd on Sat 04/12/2004 13:37:30
Here's a script that runs when player clicks the drawer:
6 if (gotmoney = 0) then
7 {
8   AddInventory(1);
9   DisplaySpeech(0,"I found some money.");
10   gotmoney = 1;
11 }
12 else DisplaySpeech(0,"I already took everything from there.")

But when I try to save the room, it says "Error line 6: undefined symbol "gotmoney"
What shall I do?
Title: Re: Undefined symbol :(
Post by: Ishmael on Sat 04/12/2004 14:21:45
int gotmoney;

to the start of the room script might do any good?
Title: Re: Undefined symbol :(
Post by: strazer on Sat 04/12/2004 15:44:44
if (gotmoney == 0) then

Always use == when doing comparisons. Use one = only when assigning values.
"then" is not needed.
Title: Re: Undefined symbol :(
Post by: JudgeDeadd on Sun 05/12/2004 19:21:41
this just doesn't work... I've tried "int gotmoney" in game start and room start scripts, but it just doesn't work!
Title: Re: Undefined symbol :(
Post by: Radiant on Sun 05/12/2004 20:24:20
That's because you're not supposed to put it in the game_start function, but rather at the top of the global script, outside of any functions.
Title: Re: Undefined symbol :(
Post by: Ishmael on Mon 06/12/2004 19:33:06
I take it this is a room script, so go the room in the room editor and click on the {} button in the room settings, and add to the very first line of the script:
int gotmoney;

and do these changes:
if (gotmoney == 0)
{
  AddInventory(1);
  DisplaySpeech(0,"I found some money.");
  gotmoney = 1;
}
else DisplaySpeech(0,"I already took everything from there.");