Cancelling a global Regular expression?

XanMag
25 Jun 2018, 20:16

So... 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:53

You 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:54

You 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:03

Bingo. So simple! Thanks!


XanMag
25 Jun 2018, 21:03

Both - so easy!


jmnevil54
25 Jun 2018, 21:25

I 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
}