I've obviously done something daft here, can anyone help?
I've defined an int called gamelevel in the global script, exported it and then imported to all rooms in the script header.
e.g.
// main global script file
int gamelevel = 0;
export gamelevel;
&
// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.
import int gamelevel;
Ok, so far so good, I've managed to use the variable in character interactions and object interactions fine.
Problem I've had is that I wanted to set gamelevel to a certain number during some dialogue. When the player asks a certain question I wanted gamelevel to be set to 1, I did this;
within dialogue script...
BIGJON: "Cheers mate, that would be a great help. You could save the day!"
EGO: "Well, I'd better get a move on, catch you soon."
BIGJON: "Laters Dude."
option-off-forever 2
run-script 1 // run the dialogue request to set gamelevel to 1
stop
Then in the dialogue request function ;
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int par) {
if (par==1) {
gamelevel = 1; //set gamelevel to 1
}
I saved the game got the following error;
"There was an error compiling your script. The problem was in Global Script
Error line 171 : Nested functions not supported(you may have forgotten a closing brace."
I'm confused by this as line 171 is the next function down from my dialogue request function,
#sectionstart character1_a // DO NOT EDIT OR REMOVE THIS LINE
function character1_a() {
}
Its blank, I haven't touched it, and at this point in my AGS understanding, I've no idea what it does or how to use it, so why on earth am I getting an error with it???
I've defined an int called gamelevel in the global script, exported it and then imported to all rooms in the script header.
e.g.
// main global script file
int gamelevel = 0;
export gamelevel;
&
// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.
import int gamelevel;
Ok, so far so good, I've managed to use the variable in character interactions and object interactions fine.
Problem I've had is that I wanted to set gamelevel to a certain number during some dialogue. When the player asks a certain question I wanted gamelevel to be set to 1, I did this;
within dialogue script...
BIGJON: "Cheers mate, that would be a great help. You could save the day!"
EGO: "Well, I'd better get a move on, catch you soon."
BIGJON: "Laters Dude."
option-off-forever 2
run-script 1 // run the dialogue request to set gamelevel to 1
stop
Then in the dialogue request function ;
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int par) {
if (par==1) {
gamelevel = 1; //set gamelevel to 1
}
I saved the game got the following error;
"There was an error compiling your script. The problem was in Global Script
Error line 171 : Nested functions not supported(you may have forgotten a closing brace."
I'm confused by this as line 171 is the next function down from my dialogue request function,
#sectionstart character1_a // DO NOT EDIT OR REMOVE THIS LINE
function character1_a() {
}
Its blank, I haven't touched it, and at this point in my AGS understanding, I've no idea what it does or how to use it, so why on earth am I getting an error with it???