Fixing a window closing issue.

Hey there I have been trying to figure out an issue with a plugin and have had no luck. I think it might be something simple but I don't know javascript myself so it's just been a lot of trying things so far. Since I would be editing the plugin to work with my game I am not sure what the rules would be so I figured I would just keep the name of the plugin out of it for the moment.

The issue is that plugin opens a window up but the only way to leave that window is by pressing the escape key. I was hoping to change that to work with the cancel or right click key. I have looked through the code and found the part that addresses escaping the window scene and I'll post that here. If there is some simple way to fix this code line or make it cancel the window I would love to hear it. If there isn't I am sorry to trouble you all with this. Here is the code.

if(Input.isTriggered("escape"))
{
SoundManager.playCancel();
SceneManager.pop();
}
Scene_Base.prototype.update.call(this);
}

Thanks for taking a look.🙂
if (Input.isTriggered("cancel")) 😀
Hey bud thanks for dropping in.🙂 So changing that to cancel was actually the first thing I tried and nothing changed. I just tried it again to be sure but it's still only the escape button that closes the window.🙁
Oh btw, earlier today I saw you put out some new videos, can't wait to watch them just waiting for the data cap to reset.

Edit:
Upon further testing the cancel does appear to work, just not for right clicking which is how I was trying to do it, But it will work with a controller now so that was the real issue thanks much bud you rock.🙂
OK, I took a look at it.
RPG core says that (for example) x is, just like Escape and others, escape, with no cancel keyboard key existing. Cancel is only on a gamepad. However, you can rename that in RPG core, from escape to cancel. It's key 88. Or you can define a new cancel key 😀 Or a key of totally unique name.
Then the code I provided should work.
Or you can try if (Input.isTriggered (88)), but I'm not sure if it works.

Btw. Thanks for the support 🙂 I'll make one more video, which will definitely close pixi basics... And then take a small break 😀
Yeah sorry bud I didn't get my edit in in time but it does work I was just testing it with right click and that doesn't work but it will work with a controller now which was the main issue. It's a little odd not being able to close the window with a right click but that probably wont be to much of an issue. Thanks again for that fix bud, sorry I made ya search for what you already knew.🙂
It's fine, didn't take long 🙂

Right mouse button is not input, but TouchInput, namely
TouchInput.isCancelled().
So to make it available for use on keyboard, controller and mouse, you can do this:
if (Input.isTriggered ("escape") || Input.isTriggered ("cancel") || TouchInput.isCancelled())
Awesome, Thanks so much bud. It works like a charm. If you don't mind I'll go ahead and post this fix on the plugins owner page, people there had been asking for a fix for it and he hasn't gotten around to it for some time so they would probably be stoked. I'll credit you of course.🙂 You're that best.
It was a very simple fix, so go ahead 🙂

Original thread: https://forums.rpgmakerweb.com/threads/fixing-a-window-closing-issue.86819/