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:
After this, 'q' holds the question you were searching for.
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.
If this 'followup$' is empty, leave the function (Return)
This happens when this question is a last question
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.
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.