Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cliffwhite

#1
Hey guys! Thanks so much!!!
#2
Once again, I'm having problems with scripting. In my GlobalScript, I have the code...

int game_var;
export game_var;

In my Global Script Header, I have the following code...

import int game_var;

In my Room2 RoomScript, I typed in the following code....

int game_var = 7;

and I get the following error message.....

Failed to save room room2.crm; details below
room2.asc(1): Error (line 1): Variable 'game_var' is already imported

If I remove "int" from the last entry and just type in....

game_var = 7;

then I get the following error message.....

Failed to save room room2.crm; details below
room2.asc(1): Error (line 1): Parse error: unexpected 'game_var'

I haven't been able to find any help in the docs, online or in the FAQ's. Can anyone tell me how to change a variable in room? Does this have to be in a function? And if so, does all coding have to occur in a function?  Thanks!
#3
I realize the code (if it worked) would move the character straight to room 2. I was just trying to display that I couldn't get the IF statement to work at all no matter how simple it was. I'll try Crimson Wizards suggestion to create a function and see if I can get that to work. Thanks for the assistance!!!!
#4
I have created two rooms and I want to move from Room 1 to Room 2. I used the default room names and I've set a Global Variable called "axe" to the value of 0. I have the following code in the Room 1 script,

Code: ags

// room script file
if (axe == 0){
player.ChangeRoom(2);
 }


When I try to run the game, I get the following error messages.

Failed to save room room1.crm; details below
room1.asc(2): Error (line 2): Parse error: unexpected 'if'

I'm not sure what I'm doing wrong. I can't add any IF statement without getting the error.
SMF spam blocked by CleanTalk