Restrict/Remove UNDO

GAGE HOLSTON
13 Dec 2017, 04:20

In my game there are some gambling mini-games.
However, the undo command completely breaks it as the player can use it to undo an lost and repeat until they win.
I was wondering if there was a way to either
A) Restrict the undo command. Maybe when they start one of the gambling games, the game disables undoing somehow.
B) Get rid of it entirely.

I'd honestly like option A more than option B, but I will do B if necessary.


K.V.
13 Dec 2017, 05:19

You can make a command with the pattern undo that is specific to a room. If you want to let the player undo at any point during that scene, you can just put undo in your script (probably twice), and Quest will invoke the undo script.


I have to put undo twice here, but that may be due to the get input:

Command name: no_undo_cmd

Pattern: undo

Script:

msg ("Please enter your employee ID.")
get input {
  if (result = "69105") {
    undo
    undo
    game.notarealturn = true
  }
  else {
    msg ("You have entered an nonexistent employee ID.  Security has been dispatched.  Thank you.")
    SecurityProtocolFunction(game.pov)
  }
}

I move the command I created to override undo around in this example. (I don't know why the floor boss can give me an undo pass. It just seemed like a fun way to show how it could work.)


See the details for the example game's code:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="No Undo!!!">
    <gameid>86c936a9-4017-49b6-aee0-60cd3b8b9eb6</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <feature_asktell />
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="into the Gambling Hall" to="Gambling Hall">
      <inherit name="indirection" />
    </exit>
  </object>
  <object name="Gambling Hall">
    <inherit name="editor_room" />
    <enter type="script"><![CDATA[
      msg ("\"Welcome to the gambling hall!\" booms {object:the Floor Boss}.<br/><br/>\"You have lost your {command:UNDO} privileges!\"")
    ]]></enter>
    <beforeenter type="script">
      MoveObject (the Floor Boss, this)
      no_undo_cmd.parent = this
    </beforeenter>
    <exit alias="out" to="room">
      <inherit name="outdirection" />
    </exit>
    <object name="the Floor Boss">
      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <usedefaultprefix type="boolean">false</usedefaultprefix>
      <speak>"What'd'ya need, pal?" grumbles the floor boss.  "An {command:UNDO} pass?  Just {command:ask him about an undo pass:ASK ME ABOUT IT}, if that's what ya' need, buddy!"</speak>
      <ask type="scriptdictionary">
        <item key="undo pass"><![CDATA[
          no_undo_cmd.parent = the Floor Boss
          RemoveObject (the Floor Boss)
          msg ("\"Got my last {command:UNDO} pass right here!\" he proclaims, handing it to you and wandering away.<br/><br/>You start to add the object to your inventory, but it suddenly disappears with a soft <i>sphhlllmphhmp.</i><br/>")
        ]]></item>
      </ask>
    </object>
    <command name="no_undo_cmd">
      <pattern>undo</pattern>
      <script>
        msg ("YOU CAN'T DO THAT HERE!")
      </script>
    </command>
  </object>
</asl>