i want to add this:
if (keycode == 361) SaveGameDialog(); but when i save game, it says :
Error (line 108): parse error:unexpected 'if'
:( help
Quote from: Reaper Games© on Sun 02/05/2004 11:44:43
if (keycode == 361) SaveGameDialog(); but when i save game, it says :
Error (line 108): parse error:unexpected 'if'
I think that there must be an error *before* the if... :)
bye
You'll have to post more of your script - post the surrounding lines so we can see where the problem is.
}
if (button == 3) {
// They pressed the OK button, close the GUI
GUIOff (INVENTORY);
SetDefaultCursor();
}
if ((button == 4) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
// scroll down
game.top_inv_item = game.top_inv_item + game.items_per_line;
}
if ((button == 5) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
}
}
if (keycode == 361) SaveGameDialog();
For me, that usually happens when I have accidentally placed more "close" braces than "open" ones, making the compiler think that you have ended the function before you actually meant to. When it finds an "if" outside the function, it returns an error. Unfortunately, you did not post enough of the code to check that. Try the "match brace" tool with the first brace in the function, and see what you get.
I think there's enough code there to hazard a guess:
You need to put the added line inside the on_key_press function, not (as it appears to be) at the bottom of the global script.
Look for a line that says
function on_key_press(int keycode) {
And put it with the other similar lines after that.