Hello,
I have been working on learning scripting using the RPG MAKER Script Calls document and other various tutorials. I am starting to get the hang of it, however I am completely lost when it comes to 'Show Choices'. I do not know if this changes anything, but I am calling this script from a 'Common Events'. I apologize if this has been addressed before on the forum, but I was unable to find a solution.
The Problem:
I am attempting to store the choice 0 or 1 in variable 40 so that I can reference the variable later and call additional messages. I have posted the code I have written below. While it prompt's the choice menu, it seems to already move onto the next section (as if I already selected 'Continue'.
Can someone please advise what I am doing wrong with my script? Also if you can please help me understand why this.setWaitMode('message'); isn't forcing the game to allow the player to make a choice before moving forward.
Please let me know if I need to clarify anything.
Thank you for your help.
I have been working on learning scripting using the RPG MAKER Script Calls document and other various tutorials. I am starting to get the hang of it, however I am completely lost when it comes to 'Show Choices'. I do not know if this changes anything, but I am calling this script from a 'Common Events'. I apologize if this has been addressed before on the forum, but I was unable to find a solution.
The Problem:
I am attempting to store the choice 0 or 1 in variable 40 so that I can reference the variable later and call additional messages. I have posted the code I have written below. While it prompt's the choice menu, it seems to already move onto the next section (as if I already selected 'Continue'.
Can someone please advise what I am doing wrong with my script? Also if you can please help me understand why this.setWaitMode('message'); isn't forcing the game to allow the player to make a choice before moving forward.
Please let me know if I need to clarify anything.
Thank you for your help.
JavaScript:
//Check if energy is at or below 0.. if so warn player
if ($gameVariables.value(1) <= 0) {
$gameMessage.add("Are you sure you want to continue?");
$gameMessage.setChoices(['Continue', 'Stop'], 0, -1);
$gameMessage.setChoicePositionType(2);
$gameMessage.setChoiceCallback(n => {$gameVariables.setValue(40, n);});
this.setWaitMode('message');
}
//selecting Continue option
if ($gameVariables.value(40)==0){
$gameMessage.add("\\n[2] gained sword making experience.");
this.command115(); // exit
}
//selecting No option
if ($gameVariables.value(40)==1){
$gameMessage.add("\\n[2] stops training for now.");
this.command115(); // exit
}