Set questions from xml to show up in the middle of the game

Get help using Construct 2

Post » Fri Jan 16, 2015 8:01 pm

Hi
I am making a game and after some time it will be interupted by a question. The user will answer it, continue to play, a new one will come up after some time etc

I want to set in my textboxes questions and answers from an xml file.
I want to count the number of questions and add their number to a variable
I want to shuffle answers and questions every time, but i dont want them to show up more than one time until the user losses (no more lives or time)
I want to set the algorithm to check if the question is right (in the xml) and procceed

my xml structure is like this

<?xml version=""1.0"" encoding=""utf-8""?>
<questions>
<question id=""1"" text=""blah blah"">
<answer qid=""2"" correct=""true"">a</answer>
<answer qid=""3"" correct=""false"">b</answer>
<answer qid=""4"" correct=""false"">c</answer>
<answer qid=""5"" correct=""false"">d</answer>
</question>

</questions>
I saw all the tutorials but i cant do what i want so far.
Thanks in advance
B
9
S
1
Posts: 12
Reputation: 509

Post » Sat Jan 17, 2015 5:23 pm

ps
The xml is loaded with ajax, set to xml with ajax.lastdata, but after this im completly lost (especially with the xml files in general)
B
9
S
1
Posts: 12
Reputation: 509

Post » Sat Jan 17, 2015 6:48 pm

Try RexRainbow's Hash plugin.

We use JSON inputs and parse it with Rex's Hash plugin, but I believe it accepts XML too.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Mon Jan 19, 2015 8:00 pm

Thanks
Anyway, i changed my xml to this and now it works like a charm

<?xml version="1.0" encoding="utf-8"?>
<appquestions>
<question>blah blah</question>
<answer id="11" correct="true">a</answer>
<answer id="12" correct="false">b</answer>
<answer id="13" correct="false">c</answer>
<answer id="14" correct="false">d</answer>

<question>duh duh duh</question>
<answer id="21" correct="true">2a</answer>
<answer id="22" correct="false">2b</answer>
<answer id="23" correct="false">2c</answer>
<answer id="24" correct="false">2d</answer>

</appquestions>


The only think that i need to do now is to load the next question after every one displayed
and to specify wich one is the correct
B
9
S
1
Posts: 12
Reputation: 509


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests