Closed Bharat0112 closed 6 months ago
You have to insert your desired code to the function called Scene_InputDialog.prototype.cancelResult (1126 line)
for example, you can use Event Script Calls like as below the link (E.G. common event)
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
Is there anyway to call from Game script ? Because calling self switches depend on map id as well event id. $gameSelfSwitches.setValue([1, 3, 'A'], false)
Edit : I am also using another plugin to get data from a text file, instead of retriving from pre-stored value in variable, such as password.
Create a toggle variable, and set that toggle variable to true when the cancel button is pressed. Then, in your conditional branch, check to see if the toggle variable is 'true' and if so, make the value of that toggle variable false again.
const TOGGLE_VAR_ID = 100;
Scene_InputDialog.prototype.cancelResult = function () {
if (SceneManager._stack.length > 0) {
$gameVariables.setValue(TOGGLE_VAR_ID, true); // add here
TouchInput.clear();
Input.clear();
this.popScene();
}
};
Once you've done that, check the value for variable 100 in the conditional branch. If it's true, you've hit the cancel button. Put whatever code you want in there, and make the variable false again at the end.
I changed the code as you suggested in the plugin. Then created an event. Page 1 of the event sets Self Switch ON on Action Trigger. Now while opening InputDialog and clicking on cancel button on Page 2 of the event doesn't make Self Switch A to OFF. (Both pages have different event image so I can know.) I can see that the value of 100th variable is set to true, but still it doesn't work.
◆Plugin Command:InputDialog text Please enter the string... ◆Plugin Command:InputDialog variableID 8 ◆Plugin Command:InputDialog open ◆If:Script:$gameVariables.value(100) == "true" ◆Control Self Switch:A = OFF ◆ :End
You don't seem to know JavaScript very well. "true" is not the same as true of boolean.
Try again with the solution below, which I've found works.
const TOGGLE_VAR_ID = 1;
Scene_InputDialog.prototype.cancelResult = function () {
if (SceneManager._stack.length > 0) {
$gameVariables.setValue(TOGGLE_VAR_ID, true);
TouchInput.clear();
Input.clear();
this.popScene();
}
};
In my initial project, the maximum value for the variable number was 20, so 100 didn't seem to work, so I changed it to 1.
Thank you, it's working now.
Hi, Is there any way to check if cancel button was pressed in RS_InputDialog plugin ? I am using parallel event, and needs to set self switch off if cancel button was pressed. Thank you.