Undefined symbol :(

Started by JudgeDeadd, Sat 04/12/2004 13:37:30

Previous topic - Next topic

JudgeDeadd

Here's a script that runs when player clicks the drawer:
Code: ags
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?
You know what they say... no... wait... you don't. What a shame.

Ishmael

int gotmoney;

to the start of the room script might do any good?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

strazer

if (gotmoney == 0) then

Always use == when doing comparisons. Use one = only when assigning values.
"then" is not needed.

JudgeDeadd

this just doesn't work... I've tried "int gotmoney" in game start and room start scripts, but it just doesn't work!
You know what they say... no... wait... you don't. What a shame.

Radiant

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.

Ishmael

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:
Code: ags
int gotmoney;


and do these changes:
Code: ags
if (gotmoney == 0)
{
  AddInventory(1);
  DisplaySpeech(0,"I found some money.");
  gotmoney = 1; 
}
else DisplaySpeech(0,"I already took everything from there.");
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk