HELP WITH LOOP PROBLEM!

PLEASE HELP. In desperate need of a simple solution but can not figure it out on my own. All I need is to create a question that repeats asking said question until the user gets the answer right. Right now I have been entering in any possible answer combination by myself, but I know there has to be an easier way. This might take a one-on-one conversation to fix this problem because my knowledge of coding is so limited, so any help is greatly appreciated!


Sample code (Customize according to what you need)

To paste the code

  1. Startup your quest gamebook/textadventure, on the right side of the big play button, you can see a code view button </>
  2. Copy my code to replace the code in the text box, click code view button again.
  3. Viola, it is done, press play button to test out the game and modify the code to your preference.
<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="test6">
    <gameid>a7ad8e39-3a82-4b9f-89a0-1b7e8c6da44f</gameid>
    <version>1.0</version>
    <firstpublished>2024</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <enter type="script">
      question 1
    </enter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
  </object>
  <function name="question 1"><![CDATA[
    msg ("<br/>How many presidents are there in USA?<br/>From start to today, 18th july 2024")
    get input {
      if (result="46") {
        msg ("correct")
        question 2
      }
      else {
        msg ("That is not the correct answer<br/>Boo hoo<br/><br/>But, please try again")
        question 1
      }
    }
  ]]></function>
  <function name="question 2"><![CDATA[
    msg ("<br/>Very smart, onto question 2<br/>How many eyes does a blind man have?")
    get input {
      if (result="2") {
        msg ("correct")
        question 3
      }
      else {
        msg ("Ding ding<br/>That is not the correct answer<br/><br/>But, please try again")
        question 2
      }
    }
  ]]></function>
  <function name="question 3"><![CDATA[
    msg ("<br/>Well, Im impressed, but you will not make pass this final question.<br/>Well, why is the sky blue?")
    get input {
      if (result="blue light") {
        msg ("correct<br/>What? <br/>You completed all the questions!<br/><br/>Should I give you a medal or a kiss?")
      }
      else {
        msg ("That is really close to the answer,<br/>Note that the correct have two words: b??e  l???t<br/>But, please try again")
        question 3
      }
    }
  ]]></function>
</asl>

Hi! I entered this code and it said it caused an internal error. If you would be comfortable helping me out one-on-one (I am in desperate need because of a due date), please email me at [email protected]

Thank you so much!


On enter room

question 1

Create 3 functions, named question 1, question 2, question 3

question 1

msg ("<br/>How many presidents are there in USA?<br/>From start to today, 18th july 2024")
get input {
  if (result="46") {
    msg ("correct")
    question 2
  }
  else {
    msg ("That is not the correct answer<br/>Boo hoo<br/><br/>But, please try again")
    question 1
  }
}

question 2

msg ("<br/>Very smart, onto question 2<br/>How many eyes does a blind man have?")
get input {
  if (result="2") {
    msg ("correct")
    question 3
  }
  else {
    msg ("Ding ding<br/>That is not the correct answer<br/><br/>But, please try again")
    question 2
  }
}

question 3

msg ("<br/>Well, Im impressed, but you will not make pass this final question.<br/>Well, why is the sky blue?")
get input {
  if (result="blue light") {
    msg ("correct<br/>What? <br/>You completed all the questions!<br/><br/>Should I give you a medal or a kiss?")
  }
  else {
    msg ("That is really close to the answer,<br/>Note that the correct have two words: b??e  l???t<br/>But, please try again")
    question 3
  }
}

I am interested in the problem you are facing though, are you using the online editor?
Whenever I use the online editor, it keeps spinning forever and the page wouldn't load so I dunno how it is like,
but if people are copying my codes into the online editor and getting internal error, it would totally be my fault XD

So, I guess next time, I should be writing:


Sample code (Customize according to what you need)

To paste the code

  1. Download quest for windows at https://textadventures.co.uk/quest
  2. This is the offline editor (Online editor is not able to copy and paste the whole game code)
  3. Startup your quest gamebook/textadventure, on the right side of the big play button, you can see a code view button </>
  4. Copy my code to replace the code in the text box, click code view button again.
  5. Viola, it is done, press play button to test out the game

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

Support

Forums