Letting the game know you're running a walkthrough.

K.V.

Have you ever wished there was a way to tell Quest that a walkthrough is running so you could make the scripts behave differently? (Like when you have a SetTimeout() in a script or something of that nature?)

There may be a built-in way to do it, but I couldn't dig anything up, so I did this:


1. Create a function.

  <function name="SetWalkthrough" parameters="bool">
    if (bool ="true") {
      game.wt = true
    }
    else {
      game.wt = false
    }
  </function>

2. Call that function from your walkthrough.

  <walkthrough name="kv">
    <steps type="simplestringlist">
      event:SetWalkthrough;true
      jump
      l
      z
      n
      event:SetWalkthrough;false
    </steps>
  </walkthrough>

3. Use the attribute:

    <firstenter type="script"><![CDATA[
      if (not game.wt) {
        SetTimeout (4) {
          if (game.pov.parent=bedroom) {
            JS.addTextAndScroll ("<br/>You can hear someone talking in the living room.")
          }
        }
      }
      else {
        msg ("<br/>You can hear someone talking in the living room.")
      }
      Fred.visible = true
      Ethel.visible = true
    ]]></firstenter>

An example game:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="wt">
    <gameid>cff27ed4-50eb-43f3-a56d-361e3d089b28</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <wt type="boolean">false</wt>
  </game>
  <object name="living room">
    <inherit name="editor_room" />
    <beforeenter type="script">
    </beforeenter>
    <enter type="script">
      if (Fred.visible) {
        msg ("Fred and Ethel appear to be having a slight disagreement.  (Ethel seems to be winning the argument.)")
      }
    </enter>
    <description>You've just moved in, and there's nothing in here yet.</description>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="bedroom">
      <inherit name="northdirection" />
    </exit>
    <object name="Fred">
      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <visible type="boolean">false</visible>
      <look>He is arguing with Ethel.</look>
      <speak>{once:"Oh, shut up, will ya', Ricky?!?" Fred explodes.  "Can't you see that Ethel and I are busy?"}{notfirst:"Stow it!" he yells.}</speak>
    </object>
    <object name="Ethel">
      <inherit name="editor_object" />
      <inherit name="namedfemale" />
      <visible type="boolean">false</visible>
      <look>She is arguing with Fred.</look>
      <speak>{once:She gives you a stern look, hands on her hips.  "I'm a little busy with Fred right now, Ricky!"}{notfirst:"Later," says Ethel, waving you off.}</speak>
    </object>
  </object>
  <object name="bedroom">
    <inherit name="editor_room" />
    <description>You've just moved in, and there's nothing in here yet.</description>
    <firstenter type="script"><![CDATA[
      if (not game.wt) {
        SetTimeout (4) {
          if (game.pov.parent=bedroom) {
            JS.addTextAndScroll ("<br/>You can hear someone talking in the living room.")
          }
        }
      }
      else {
        msg ("<br/>You can hear someone talking in the living room.")
      }
      Fred.visible = true
      Ethel.visible = true
    ]]></firstenter>
    <exit alias="south" to="living room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <function name="SetWalkthrough" parameters="bool">
    if (bool ="true") {
      game.wt = true
    }
    else {
      game.wt = false
    }
  </function>
  <walkthrough name="kv">
    <steps type="simplestringlist">
      event:SetWalkthrough;true
      jump
      l
      z
      n
      event:SetWalkthrough;false
    </steps>
  </walkthrough>
</asl>

K.V.

You can also use assert:.

assert:not game.wt

If game.wt is true:

image


If game.wt is false:

image


http://docs.textadventures.co.uk/quest/guides/walkthroughs.html


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums