Cancelling a global Regular expression?
XanMag
25 Jun 2018, 20:16So... I have this regular expression set to run on the start script.
^undo$ followed by a print message which prevents the undo option.
If I give the player the option to HAVE the undo command available, is there a way I can cancel the Regular Expression?
Or, could I stuff the regular expression in my get input/switch scripts to run only if the player chooses not to have the option to undo? Can you do that with a command?
The Pixie
25 Jun 2018, 20:53You could have a flag set on the game object. Your custom UNDO command can check that and either run the script on the built-in UNDO or not (as long as you give your custom UNDO a diferent name).
mrangel
25 Jun 2018, 20:54You can disable a command by moving it into a container that isn't the player's parent, or by changing its pattern.
XanMag
25 Jun 2018, 21:03Bingo. So simple! Thanks!
XanMag
25 Jun 2018, 21:03Both - so easy!
jmnevil54
25 Jun 2018, 21:25I would try something like The Pixie said, but I would just disable the disable command. If that makes sense.
if game.playeroption = true {
DisableUndo
}
if game.playeroption = false {
CustomUndo
}