I keep getting a syntax error that says im missing an ) after argument list but it doesn't seem to be missing anywhere in the small amount of script i put in. Sorry if this is something stupidly obvious, i am very new to java and rpg maker.
syntax error
RPG Maker MZ SupportThis snippet is incorrect.
ID:012 is incorrect, but there are more problems. First, don't put numbers starting with zeroes, because JS will treat them as octal numbers. Also, $gameVariables.setValue doesn't return anything, so you're just putting empty values into those variables. Instead of ID:012 you should put mapId which is just a number (again, without leading zeroes).
Can you explain what you try to achieve here?
ID:012 is incorrect, but there are more problems. First, don't put numbers starting with zeroes, because JS will treat them as octal numbers. Also, $gameVariables.setValue doesn't return anything, so you're just putting empty values into those variables. Instead of ID:012 you should put mapId which is just a number (again, without leading zeroes).
Can you explain what you try to achieve here?
Hi! So first, there shouldn't be any leading zeroes in your variables. So it should look more like:
And then for the line right after that, there shouldn't be the "ID:" in front. I take it you're wanting to set variable 2 equal to the value of variable 12? To do that, it would be:
Additionally, if you're using the $gameVariables.setValue method to assign values to your variables, you don't need to use the "Control Variables" option. You're telling the event the same thing twice in your instance ("set variable 3 equal to set variable 3 to 99"), which doesn't make sense and might be what's throwing an error. ^^
So! You have two options:
1.) Just use the "Script" option on page 3 of the event commands and put the $gameVariables.setValue script calls into that. 🙂
2.) Use the Control Variables option, and simply put "99" for variable 3. And then put $gameVariables.value(12) for variable 2.
Code:
$gameVariables.setValue(3, 99);
And then for the line right after that, there shouldn't be the "ID:" in front. I take it you're wanting to set variable 2 equal to the value of variable 12? To do that, it would be:
Code:
$gameVariables.setValue(2, $gameVariables.value(12));
Additionally, if you're using the $gameVariables.setValue method to assign values to your variables, you don't need to use the "Control Variables" option. You're telling the event the same thing twice in your instance ("set variable 3 equal to set variable 3 to 99"), which doesn't make sense and might be what's throwing an error. ^^
So! You have two options:
1.) Just use the "Script" option on page 3 of the event commands and put the $gameVariables.setValue script calls into that. 🙂
2.) Use the Control Variables option, and simply put "99" for variable 3. And then put $gameVariables.value(12) for variable 2.
Thank you! I didn't even need to use the script. I was creating an edge detection event that would automatically transfer you to the next area, so I wouldn't have to spam transfer player events. I needlessly overcomplicated it with the script when all I needed to do was use the constant operand, it works fine now.
Original thread: https://forums.rpgmakerweb.com/threads/syntax-error.175056/