By means of tokenat you can make tons of self made array approaches.
simple approach:
a text variable:
you can create an array by using a comon character like a comma or pipe sign on which you can itterate through the sections.
like
text = 1,2,3,4,5,6,7
tokenat arrays start counting at 0, so keep that in mind.
tokenat(text, 0 , ",") = 1
tokenat(text, 1 , ",") = 2
etc
This would all be sinle level arrays without keys, but straight up pieces of content.
Extending this, making each piece alse have a list of options by means of a different comon character.
text = 1,2,3,4 | 5,6,7,8,9 | 45,46,47
This takes the second chunk of data from text:
tokenat(text, 1, "|") = 5,6,7,8,9
now, if I want the 8 from the second chunk of data, we simply nest the tokenat calls:
tokenat(tokenat(text, 1, "|"), 2, ",") = 7
tokenat(tokenat(text, 1, "|"), 3, ",") = 8
tokenat(tokenat(text, 1, "|"), 4, ",") = 9
this way it references single pieces from the second chunk, but you could easily loop through it:
for each "looptokes"
from: 0
to: tokencount(tokenat(text, 1, "|"), ",")
create text,
set text tokenat(tokenat(text, 1, "|"), loopindex ,",")
With the above approach, if you keep a uniform structure, like adding a question type first, then a question, then which of the following anwsers is correct, then some awnsers: either one or more. You have a full system that can dynamically expand as you add more.
Or you could use objects having a text variable with these sets.
example:
obect questiontext, has instance variable awnser int()
obect awnsertext, has instance variable awnser int()
textvariable = multiplechoicetext,which is faster,0,train,horse,man|multiplechoiceimage,which color is red,2,image0,image1,image2,image3|inputquestion,how many cm are in a M,0,100
The above variable shows examples of 3 type of questions.
Looping through them with
for each "looptokes"
from: 0
to: tokencount(textvariable, "|")
sub of loop
compare 2 variables
tokenat(tokenat(textvariable, loopindex, "|"), 0 ,",")
equals
"multiplechoicetext" : action spawn questiontext, set text: tokenat(tokenat(textvariable, loopindex, "|"), 1 ,",") //Set question
set questiontext instance variable awnser: tokenat(tokenat(textvariable, loopindex, "|"), 2 ,",") // Text instance variable now holds correct awsner
set tempvariable: tokenat(textvariable, loopindex, "|") //use a temp to avoid loopindex issues in the next loop
sub of compare
for each loop to create the questions awnsers:
from: 3 // First three entries were type, question and awnser
to: tokencount(tempvariable, ",")
action: spawn awnsertext, set text = tokenat(tempvariable, loopindex, ",") // sets the questions
set awnsertext instance variable awnser: loopindex
Onclick awnsertext
compare 2 variables
questiontext.awsner
equals
anwerstext.awnser
action: awnser correct
else: action: incorrect
A bit advanced, but can work really well without any further extras.