- Joined
- Jul 18, 2014
- Messages
- 222
- Reaction score
- 13
- First Language
- English
- Primarily Uses
- RMMV
Hi. Is it possible for us to pause at a particular part in code until another condition becomes true?
Or alternatively, prevent the playable character (and potentially other events) from moving until another condition becomes true?
For example:
> Text: Hello
> Change Variable 2 = 10
> Wait until [Shift] button is pressed
> Text: Bye
In the past I tried using a loop:
*Loop
> If: Button [Shift] is pressed down { do something }
> If: Button [Cancel] is pressed down { Break Loop }
*Repeat Above
But it can be laggy and I don't think it's quite efficient.
I also came across a setInterval method:
but after it reaches the code above, it moves on to the next Event Command (while outputting "Hi" every 2 seconds until I click somewhere).
What I am currently trying to achieve is to prompt the Player with "select where I should go", whereby the Player clicks somewhere on the map (via mouse or touch) and an event (the "I" from the message) - not the Player - moves to the coordinates of the click.
I'm not sure of a good way to "pause" the game to await a particular input.
Or alternatively, prevent the playable character (and potentially other events) from moving until another condition becomes true?
For example:
> Text: Hello
> Change Variable 2 = 10
> Wait until [Shift] button is pressed
> Text: Bye
In the past I tried using a loop:
*Loop
> If: Button [Shift] is pressed down { do something }
> If: Button [Cancel] is pressed down { Break Loop }
*Repeat Above
But it can be laggy and I don't think it's quite efficient.
I also came across a setInterval method:
Code:
var wait = setInterval(click, 2000);
function click() {
console.log("Hi");
if (TouchInput.isTriggered()) {
clearTimeout(wait);
}
}
What I am currently trying to achieve is to prompt the Player with "select where I should go", whereby the Player clicks somewhere on the map (via mouse or touch) and an event (the "I" from the message) - not the Player - moves to the coordinates of the click.
I'm not sure of a good way to "pause" the game to await a particular input.
