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?
int gotmoney;
to the start of the room script might do any good?
if (gotmoney == 0) then
Always use == when doing comparisons. Use one = only when assigning values.
"then" is not needed.
this just doesn't work... I've tried "int gotmoney" in game start and room start scripts, but it just doesn't work!
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.
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.");