GAH!! MY BRAIN HURTS!

Blitz3D Forums/Blitz3D Beginners Area/GAH!! MY BRAIN HURTS!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Well, if you put the first question in a string, say 'questiontoask$', you could use this to search for the TQuestion that holds this question:
questiontoask$ = "How are you ?" ;<-- first question

;reset 'q' to empty before searching
q.TQuestion = null

;scan all TQuestions
For temp.TQuestion = Each TQuestion

  ;if temp's question is the question to ask, then select temp and leave loop
  if temp\question$ = questiontoask$ Then q = temp: Exit

Next

if q = Null then Return ;--> the question was not found


After this, 'q' holds the question you were searching for.
Print q\question$

q\answer1$, q\answer2$, q\answer3$ are the possible answers

After the user picks one of them (1/2/3), get the followup$ that belongs to this answer
q\followup1$, q\followup2$, q\followup3$

--> I would start off with a simple Input, so you can enter 1, 2 or 3 directly. Later on, you can replace this with a mouse interface.

user = Input(">")
if user = 1 then followup$ = q\followup1$
if user = 2 then followup$ = q\followup2$
if user = 3 then followup$ = q\followup3$

If this 'followup$' is empty, leave the function (Return)
This happens when this question is a last question
If followup$ = "" Then Return


This 'followup$' is the new 'questiontoask$' that can be inserted at the start again.

You can use a Repeat..Forever loop as well as a Function.