Need help with Gamebook-- how to conditionally display text on certain pages

Hello, newcomer here. I've started making a Gamebook on Quest, and I'm having trouble conditionally displaying text on certain pages.

For example, if a character talks to another character, versus, talks to the same character after having obtained a piece of information, how do I display both outcomes on the same page? I understand it has something to do with the "if" button, according to the help page, but I'm not sure how to use it.

Thanks!


K.V.

For example, if a character talks to another character, versus, talks to the same character after having obtained a piece of information, how do I display both outcomes on the same page?

Can you expound, possibly providing dialogue examples?


Hmm, I understand I may have been unclear with my response!

For example, if a person finds a dead body, I have a page stating "talk to the detective". However, there is another option allowing the player to search the body for clues, then an option to "talk to the detective".

How do I list the two scenarios (talking to the detective with clues/talking to the detective without clues) on the same "talking to the detective page", with only one showing up depending on which option was chosen by the player.


K.V.

Oh, I see. (I should have understood it the first way. I'm getting sleepy, I guess. Ha-ha!)

Create a new game, switch to full code view, delete what's there, and paste this in:

Revision 2

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="GamebookCore.aslx" />
  <game name="ExampleGamebook">
    <gameid>05dd883a-5f0a-4f15-a851-cd3fa004784e</gameid>
    <version>0.0.2</version>
    <firstpublished>2018</firstpublished>
  </game>
  <object name="Page1">
    <inherit name="scripttext" />
    <description>You can see a dead body here.</description>
    <options type="stringdictionary">
      <item>
        <key>Page2</key>
        <value>Continue...</value>
      </item>
    </options>
    <script type="script">
      player.hasclues = false
    </script>
    <object name="player">
      <inherit name="defaultplayer" />
    </object>
  </object>
  <object name="Page2">
    <description type="string"></description>
    <script type="script">
      // no script
    </script>
    <options type="stringdictionary">
      <item>
        <key>Page4</key>
        <value>Examine the body.</value>
      </item>
      <item>
        <key>Page3</key>
        <value>Talk to the detective.</value>
      </item>
    </options>
  </object>
  <object name="Page3">
    <inherit name="scripttext" />
    <description><![CDATA[{either not player.hasclues:The detective doesn't say much because you haven't found the clues.|You tell the detective about the clues you have found, and he enlightens you a little more on a few subjects.<br/><br/><h3><center>YOU HAVE WON!</center></h3>}]]></description>
    <script type="script">
      if (not player.hasclues) {
        AddPageLink (Page3, Page4, "Examine the body.")
      }
      else {
        RemovePageLink (Page3, Page4)
      }
    </script>
  </object>
  <object name="Page4">
    <inherit name="scripttext" />
    <description>You examine the body, finding a few clues.</description>
    <script type="script">
      player.hasclues = true
    </script>
    <options type="stringdictionary">
      <item>
        <key>Page3</key>
        <value>Talk to the detective.</value>
      </item>
    </options>
  </object>
</asl>

From there, you can switch back to the GUI and check out the way I did it.

Just drop a line, saying if this helps you or not. If not, there are other ways to handle it.


How do you get full code view online?


K.V.

Oh, I didn't see that you were editing with the web editor...

You have no Windows machine, I take it?


Nope.


K.V.

Maybe this will help:


image


image


image

Page3 continued:
image


image


I'm confused as to whether he uses Windows or not.
I am also confused on why that matters.
Besides that, K.V. seems to have this under control!


K.V.

K.V. seems to have this under control!

I don't know about all that...


I'm confused as to whether he uses Windows or not.

The OP does not have a Windows machine.


I am also confused on why that matters.

The OP cannot install the desktop version of Quest, therefore cannot enter full code view.


K.V.

This is the part that decides which response the detective gives, depending upon whether the player has the clues:

{either not player.hasclues:The detective doesn't say much because you haven't found the clues.|You tell the detective about the clues you have found, and he enlightens you a little more on a few subjects.<br/><br/><h3><center>YOU HAVE WON!</center></h3>}

http://docs.textadventures.co.uk/quest/text_processor.html


That worked, thank you!


K.V.

You are more than welcome!

Happy gaming!


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

Support

Forums