XML - Quiz

  • This almost works

    BUT simply cant figure out how to trigger the next Q in xml

    [attachment=1:2sdujqu7][/attachment:2sdujqu7]

    Here is the capx [attachment=0:2sdujqu7][/attachment:2sdujqu7]

    Cheers

  • Hi, please try it now. note that I added the function object to the project

    Also it might be better to restructure your xml

    <correct>paris</correct>

    <answer="lyon">Lyon</answer>

    <answer="marseille">Marseille</answer>

    <answer="paris">Paris</answer>

    Then it is more reliable to compare the string rather than indexes as all the nodes don't have unique identifiers.

    Then you can check answer with:

    if (XML.StringValue("//question//correct/text()") == "paris")

    And try to use both ' and "... i don't think this is nested correctly: "/questions/question"

  • JUST - GREAT ... thanks

    I see that your function easy gives me the possiblity to add

    more answers

    I would like to optimize the xml as you suggest, and Ive done

    the xml as you show - but cant figure out when to use the

    [quote:3b0fqn6j]Then you can check answer with:

    if (XML.StringValue("//question//correct/text()") == "paris")

    hope you get time to give it a look

  • I haven't looked at the capx yet.

    <answer="paris">Paris</answer>

    <correct>paris</correct>

    the "correct" value = paris

    you set one answer button's text to paris

    So when the user clicks on a button, you read the button's text value and compare it to the "correct" tag's contents so if they are both == paris, then it is true, else false

    hope that makes sense... its getting late

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • OKAY .. See our point, just cant get it work

    Ohhh --- another timezone

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)