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

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""?>
<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>

I saw all the tutorials but i cant do what i want so far.
Thanks in advance
Posts: 12
Reputation: 359

Post » Sat Jan 17, 2015 5:23 pm

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)
Posts: 12
Reputation: 359

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.
Company name changed to avoid Facebook-type shenanigans

"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."
Posts: 1,414
Reputation: 4,822

Post » Mon Jan 19, 2015 8:00 pm

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

<?xml version="1.0" encoding="utf-8"?>
<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>


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
Posts: 12
Reputation: 359

Return to How do I....?

Who is online

Users browsing this forum: ksiads, marcinkowski, mehrshadfarahani, mtnboy22, Rable and 4 guests