Nobody is responding probably because nobody wanted to dive into your heavy code. It's not super easy.
Now than I read it a bit, I know that you're not doing it the right way if you want to repeat stuff over and over with more text content.
When you see yourself copying stuff many times to achieve the same kind of display, you should try to find what is common and how to only change what is not.
The things that are common are :
- a text with a question in it
- two possible clickable answers Or a clickable "Next"
In short we can say that the Next is like an answer because in both case you will display the next text
So basically you need 3 text object.
You can either make them 3 instance with an instance variable 'type' to tell them apart (type = "question", type="answer1", type = "anwser2")
Or
Use 3 different object and group them in a family 'dialog'
This way you can make the 3 object appear at the same time and avoid most of the repeated "set visible" lines
Then the only thing you have to care about is how to grab the proper string and put it in the proper text object
That's where it's complicated. If you have a dialog tree like :
Question0
-> answer 0
-> Question 1
-> answer 2
-> Question 3
-> answer 6
-> [END OF CONVERSATION]
-> answer 7
-> [END OF CONVERSATION]
-> answer 3
-> [END OF CONVERSATION]
-> answer 1
-> Question 2
-> answer 4
-> [END OF CONVERSATION]
-> answer 5
-> [END OF CONVERSATION]
You will need to structure your data in a way that associate each question with its possible answer and each possible answer to the possible next question or end of converstation.
One way to do it is to have two variable, one for question and one for answers
Global text questions = ""
Global text qnswers = ""
+System: on start of layout
-> System: set questions to "Question0|0|1
Question2|2|3
Question3|4|5
Question4|6|7"
-> System: set answers to "answer0|1
answer1|2
answer2|3
answer3|end
answer4|end
answer5|end
answer6|end
answer7|end"
And then use another global variable to know which question and then which answer to display (I will use the "all text object are instances with variable type to tell them apart" aforementionned option)
You'll also need a 'nextQ' instance variable (type text) for the text object answer. We will store the next question information in it
Global number Qi = 0 //index of the current question
Global text curA="" //list of current possible answer
System:Qi > 0
Text: type = "question"
Local text Q = "" //line which hold the question and its possible answer's index
-> System: set Q to tokenat(questions,Qi,newline)
-> Text: set text to tokenat(Q,0,"|")
-> System: set curA to replace(Q,Text.text&"|","")
System: for "" from 0 to tokenCount(curA,"|")-1
Text: type = "answer"&loopindex+1
Local number Ai = 0 //current answer index
Local text A = "" //line which hold the answer and its associated next question
-> System: set Ai to int(tokenat(curA,loopindex,"|")
-> System: set A to tokenat(answers,Ai,newline)
-> Text: set text to tokenat(A,0,"|")
-> Text: set nextQ = tokenat(A,1,"|")
Mouse: On click on Text
Text: nextQ not equal to ""
-> set Qi to int(Text.nextQ)
Text:nextQ equal "end"
-> set Qi to -1