The text code to wait for a switch is part of a plugin I'm working towards releasing, which will eventually be up on itch.io; however, if you don't want to wait, this is the subset of that plugin that just handles the one code:
JavaScript:
(function() {
const old_process_msg_escape = Window_Message.prototype.processEscapeCharacter;
Window_Message.prototype.processEscapeCharacter = function(code, state) {
if(code == 'Q') {
var sw = this.obtainEscapeParam(state);
if(sw) {
this.startSwitchWait(sw);
}
} else old_process_msg_escape.call(this, code, state);
};
Window_Message.prototype.startSwitchWait = function(sw) {
this._waitCount = 1; // So everything else knows the message is waiting
this._waitSwitch = sw;
this._waitSwitchVal = $gameSwitches.value(sw);
};
const old_msgWait = Window_Message.prototype.updateWait;
Window_Message.prototype.updateWait = function() {
if(this._waitSwitch) {
if($gameSwitches.value(this._waitSwitch) == this._waitSwitchVal) {
return true;
}
this._waitSwitch = 0;
this._waitCount = 0;
return false;
} else {
return old_msgWait.call(this);
}
};
})();
If you load that as a plugin, you can use the text code
\Q[12] to wait until switch 12 has been toggled. That means that, if it's currently ON, it waits until it's OFF; and if it's currently OFF, it waits until it's ON. You can then toggle switch 12 in your move route to keep the text and movement in sync.
Are there other types of wait you'd like to see as text codes? I may even add more before I finally get to releasing my plugin.
For this, you could use my SFG_Wait and the "Wait for Movement" plugin command. Or, if you want to prevent the text from closing until the movement is complete, you could use the above text code.