Conversation with NPC

Hello, I am working on my first game and running into an issue I have yet to resolve. I would like for my player to have a discussion with Christian Doppler in which they are making observations about light waves. When the player makes a correct observation, Doppler asks another question. (This piece I am okay with.) When the player makes an incorrect observation, Doppler asks them to look more closely and asks the question again. I cannot seem to get an incorrect answer to loop back to the previous question, and I am not sure if I am missing something simple or if there is a more elegant way to approach these types of conversation. Here is the code. Thank you in advance for your assistance in this matter.

      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <look type="script">
        picture ("Christian_Doppler.jpg")
      </look>
      <speak type="script">
        Ask ("Hello!  Would you like to help me study the way light and sound waves change as an object moves?") {
          if (true) {
            msg ("Great!  Let's look at this simulation.")
            DisplayHttpLink ("Simulation", "http://zonalandeducation.com/mstm/physics/waves/dopplerEffect/dopplerEffect.html", false)
            msg ("Mute (uncheck) the Snare drum sound. Try snapping your fingers every time a sound wave is produced. For now, let’s call this the frequency of waves emitted by the source.")
            msg ("Is the frequency of waves emitted by the source constant, or does it change as the source moves?  In other words, does the way you snap your fingers get faster, slower, or it is constant as the source moves along the screen?")
            menulist = NewStringList()
            list add (menulist, "slower")
            list add (menulist, "faster")
            list add (menulist, "constant")
            ShowMenu ("What do you think?", menulist, false) {
              if (result="slower") {
                msg ("Are you sure.  Take another look, and make sure your sound is muted.")
                ShowMenu ("What do you think?", menulist, false) {switch}
              }
              else if (result="faster") {
                msg ("Are you sure.  Take another look, and make sure your sound is muted.")
              }
              else if (result="constant") {
                msg ("Great! So what you are saying is that the waves emitted from the source have a constant frequency.")
              }
            }
          }
          else if (false) {
            msg ("Oh. Okay.  I'll keep working then.  If you have any questions about waves, you know where to find me!")
          }
        }```

here's some of the conversation/dialogue guides/libraries I've found so far:

http://textadventures.co.uk/forum/samples/topic/3909/response-library
http://textadventures.co.uk/forum/games/topic/4883/spondre (the 'spondre' game by jaynabonne, it's really advanced dialogue/CYOA game coding, 'spondre' is a re-arrangement of 'response')
http://textadventures.co.uk/forum/samples/topic/4889/spondre-source (jaynabonne awesomely made his game's source code available for us to use/study!)
https://github.com/ThePix/quest/wiki/Conversations:-Library
http://textadventures.co.uk/forum/samples/topic/5510/updated-convlib (might be same code as the link above)
http://textadventures.co.uk/forum/samples/topic/6000/npcs-reactions
http://textadventures.co.uk/forum/samples/topic/5497/better-dialogue-library
http://textadventures.co.uk/forum/samples/topic/4261/updated-convlib-with-showmenu

and also some related stuff (but not specifically conversations/dialogues, but they could stlll help you for doing conversations/dialogue):

https://github.com/ThePix/quest/wiki/Keeping-a-Journal
http://textadventures.co.uk/forum/samples/topic/0bbkbdbpikkx4cesylv34q/pixies-journal-library (this might be the same code as the above link)
http://textadventures.co.uk/forum/samples/topic/yizejfucr0kuh-3vejl9ra/look-description-etc-like-responses-handling
http://textadventures.co.uk/forum/samples/topic/vlpnofgpquokwe_s2yvc9g/quest-task-mission-award-trophy-etc-system


okay, I'm getting tired of scouring the 'libraries and code samples' forum board... that's where all these links are from, so if you want, you can go do so through where I stopped at if you want to look if there's more links on this stuff.


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

Support

Forums