MV (Solved) Why does my plugin think touch input is triggered (when it's not)?

Heya! I'm having another problem with the plugin I'm writing haha.

So... so far, everything works. But the current problem is that it's working every single frame - which of course causes massive lag. It's supposed to only run the main function if touch input is triggered, but when I open the console I can see it's constantly running everything over and over again (I can tell by console.log() checks I dispersed throughout the main function).

So I added a console.log() check to the part that checks for touch input and... well, apparently it thinks there's always touch input triggered, even when I haven't clicked a singe thing.

Does anyone have any clue why this might be happening?? Could my testing on a laptop with a touchscreen have anything to do with it (and no, nothing is physically touching the screen either)?

Thanks in advance, as always!

Code:
    $.Scene_Map_updateScene = Scene_Map.prototype.updateScene;
    Scene_Map.prototype.updateScene = function() {
        $.Scene_Map_updateScene.call(this);
        if (!SceneManager.isSceneChanging()) {
            if (TouchInput.isTriggered) {
                console.log('input triggered');
                this.checkClickableEvents();
            } else {
                console.log('no input');
            }
        }
    };

screenshot.png

if (TouchInput.isTriggered) {
This says "is TouchInput.isTriggered truthy?" Since it is a function (i.e. object), this is always true.

Try this instead:

if (TouchInput.isTriggered()) {
I.e. "is the result returned from TouchInput.isTriggered() truthy?"

if (TouchInput.isTriggered) {

This says "is TouchInput.isTriggered truthy?" Since it is a function (i.e. object), this is always true.

Try this instead:

if (TouchInput.isTriggered()) {

I.e. "is the result returned from TouchInput.isTriggered() truthy?"

OH oh my goodness it was that simple 😢

This works, and makes so much more sense, thank you!!
You're welcome! The only reason I noticed so quickly was because I've made the same mistake many times myself. 😊

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-why-does-my-plugin-think-touch-input-is-triggered-when-its-not.146611/