Trying to have an and function in QuestBook

Basic rundown: I'm trying to make it so if you've seen two pages a link to a new page gets added, and I can't figure out the specific coding for it.

My girlfriend knows javascript, and suggested using && as such:

if (HasSeenPage(CHECK BAG) && HasSeenPage(FEEL WALLS)) {
  AddPageLink (Page1, Page2, "continue")
}

But when I try implementing it in the game, I just get an error message. Any suggestions for a work around that QuestBook would like?


K.V.

Hello.

Try this (it's Questese instead of Javascript):

if (HasSeenPage(CHECK BAG) and HasSeenPage(FEEL WALLS)) {
  AddPageLink (Page1, Page2, "continue")
}

K.V.

Thank you! I just tried that, and while I didn't get an error message this time, the page didn't get added while in-game.


K.V.

Hrmm...

Have you seen "CHECK BAG" and "FEEL WALLS"?

If yes, are you trying to add "continue" to Page1? Because that should be working.


Here is a working example game in which "Go back to Page 1" only prints on Page3 when you've seen Page1 and Page2:

<!--Saved by Quest 5.8.6702.19121-->
<asl version="550">
  <include ref="GamebookCore.aslx" />
  <game name="And Tester">
    <gameid>fa763e53-ed0a-4394-87b2-074aba388494</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
  </game>
  <object name="Page1">
    <description>This is page 1. Type a description here, and then create links to other pages below.</description>
    <options type="stringdictionary">
      <item>
        <key>Page2</key>
        <value>This link goes to page 2</value>
      </item>
      <item>
        <key>Page3</key>
        <value>And this link goes to page 3</value>
      </item>
    </options>
    <object name="player">
      <inherit name="defaultplayer" />
    </object>
  </object>
  <object name="Page2">
    <description>This is page 2. Type a description here, and then create links to other pages below.</description>
    <options type="stringdictionary">
      <item>
        <key>Page3</key>
        <value>Go to Page3</value>
      </item>
    </options>
  </object>
  <object name="Page3">
    <inherit name="scripttext" />
    <description>This is page 3. Type a description here, and then create links to other pages below.</description>
    <script type="script">
      if (HasSeenPage(Page1) and HasSeenPage(Page2)) {
        AddPageLink (Page3, Page1, "Go back to Page 1")
      }
    </script>
    <options type="stringdictionary">
      <item>
        <key>Page2</key>
        <value>Go to Page 2</value>
      </item>
    </options>
  </object>
</asl>

Yeah, I checked it multiple times. I had it so it didn't clear pages when you went to a new one so I could see everywhere I'd been, too.

Your code is mimics pretty much exactly what I have. I'm going to play with it more when I get home and hopefully I'll have it figured out soon.

Thank you!


K.V.

If you can't get it, post the code here, and we'll get you fixed up.

(If it's too much text to post (or if you'd rather everyone not see it), you can message me for my email address and send it there.)


After playing around with a test game, I figured out what I was doing wrong.

I was putting a HasSeenPage(FEEL WALLS) ON the page labeled FEEL WALLS , which would mess up the coding.

I am a fool who is very slowly learning and thank you so much K.V. ahahaha


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

Support

Forums