Help with touch controls (Swipe Input) (RPGMMV)

Note: You can skip to the end.

Hello, I am trying to make an intuitive touch control scheme for my game. So far I've used SRD's swipe input plugin with a script on a parralel common event to check whether one of the 4 directions is swiped.
SwipeInput.isPressed('direction')

If it returns true, I've set a movement route for the player to move 1 step. The problem is that it's a one swipe, one move and it interferes with other events (i.e when the show text is displayed, the actor can move).
I don't like the default touch controls since in my game you have to navigate a fog of war, and the default touch controls have an autopath that defeats the purpose.

So the question is; Is there some way that as long as the SwipeInput button is pressed the actor will keep walking until released,
OR,
If it's not possible, to disable the autopath when you move via click on the map?
You might wanna disable the autopath anyway so it doesn't intefere, but be aware that also disables the autopath for mouse clicks. But that can be fixed with a few edits to the code, albeit it's a tad more complicated so say if you need that.

Anyhow!!!

Open up rpg_scenes.js, find Scene_Map.prototype.processMapTouch and comment out $gameTemp.setDestination(x, y); (or delete if you're sure what you're doing)

So the whole object would now look like this:
JavaScript:
Scene_Map.prototype.processMapTouch = function() {
    if (TouchInput.isTriggered() || this._touchCount > 0) {
        if (TouchInput.isPressed()) {
            if (this._touchCount === 0 || this._touchCount >= 15) {
                var x = $gameMap.canvasToMapX(TouchInput.x);
                var y = $gameMap.canvasToMapY(TouchInput.y);
                //$gameTemp.setDestination(x, y);
            }
            this._touchCount++;
        } else {
            this._touchCount = 0;
        }
    }
};

Now the autopath should be disabled!

The editor move route is prioritized over events like show text etc. but you can use the very function you removed from processMapTouch to move your actor. So one step up would be $gameTemp.setDestination($gamePlayer.x, $gamePlayer.y - 1), down would be $gameTemp.setDestination($gamePlayer.x, $gamePlayer.y + 1), left would be $gameTemp.setDestination($gamePlayer.x - 1, $gamePlayer.y) and right $gameTemp.setDestination($gamePlayer.x + 1, $gamePlayer.y), you get it probably!

setDestination isn't prioritized over events last time I checked, so I'm fairly sure that should work.

I haven't used SRD's swipe input plugin but from what you tell it seems like it only checks the initial swipe and not when you hold a swipe. So that's why the actor only moves one step per swipe I think.

I'd try giving each direction its own switch, and let your swipe common event activate respective switch. Then have parallel common events activated by each switch.

So let's say you swipe right, then the "move right" switch is activated, and that triggers the "move right" parallel common event.

In the "move right" common event, have a conditional branch with an else branch return true if TouchInput._screenPressed === true;

And if it's true, move the actor right: $gameTemp.setDestination($gamePlayer.x + 1, $gamePlayer.y) and if the conditional is ELSE, turn the "move right" switch off, so the "move right" common event deactivates itself when the player is no longer touching the screen.

idk if this works in practice but try it if you wanna :popcorn:
Awesome! The move function did it well! As for the autopath, it works well for movement which also triggers events the character is facing. But this snippet that I found also works pretty well.
JavaScript:
Game_CharacterBase.prototype.moveStraight = function(d) {
    this.setMovementSuccess(this.canPass(this._x, this._y, d));
    if (this.isMovementSucceeded()) {
        if (TouchInput.isTriggered() || TouchInput.isPressed() || TouchInput.isLongPressed()) return;
        this.setDirection(d);
        this._x = $gameMap.roundXWithDirection(this._x, d);
        this._y = $gameMap.roundYWithDirection(this._y, d);
        this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(d));
        this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(d));
        this.increaseSteps();
    } else {
        this.setDirection(d);
        this.checkEventTriggerTouchFront(d);
    }
};

Anyway I did what you suggested, the move function works like a charm but when I used it into the Move Parallel Common Event, the character did not respond to swipe inputs anymore. (But the SwipeInput function still works)

1.PNG

2.PNG
Mmmmhm yes OK! Copy one setDestination for every direction and place before the switch call too, so the actor moves both when you swipe and when you hold the swipe.

Like this in TrackPlayer
Script : $gameTemp.setDestination($gamePlayer.x, $gamePlayer.y - 1)
Control Switches : #0026 MoveUp = ON
and so on!

Does that work?
@ozubon Yes, I've done that already, experimenting with other possible different configurations for all directions but character does not move anymore. Adding the move function before the switch is still one swipe one move.
I've also tried TouchInput.isPressed aside from TouchInput._screenPressed, but it resulted in a move loop that keeps on going despite touch is already released.

It's also pretty weird since I know a "pressed" input should be continuous compared to a one time "triggered" input, and yet SwipeInput.isPressed is still one swipe one move.
Maybe I've done something wrong in eventing? Or maybe it's how SRD's plugin is coded. I don't know much about JavaScript, but thanks again anyway, at least the touch autopath is gone. I'll update tomorrow if anything happens.
Hi, I would like to ask what manner could I use a swipe system to manage input control....I don't know if is there any existing plugin to achieve this?

Original thread: https://forums.rpgmakerweb.com/threads/help-with-touch-controls-swipe-input-rpgmmv.118925/