playMaker

Author Topic: Just a few Datamaker questions  (Read 2055 times)

braintapgames

  • Playmaker Newbie
  • *
  • Posts: 20
Just a few Datamaker questions
« on: January 29, 2016, 02:53:39 PM »
So I'm working on a quiz game at the moment and have been researching a lot about Datamaker. I came across this thread which has helped a lot, but I have a few more questions if anyone could help:

http://hutonggames.com/playmakerforum/index.php?topic=7287.0
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<root>
<Level Name="01" Max="12">
      <card>
        <answer>4</answer>
        <question>3+1</question>
        <question>1+3</question>
        <question>2+2</question>
        <question>4+0</question>
        <question>0+4</question>
      </card>
      <card>
        <answer>5</answer>
        <question>3+2</question>
        <question>2+3</question>
        <question>1+5</question>
        <question>5+1</question>
        <question>0+5</question>
      </card>
</Level>
</root>

Using the example that OP gave, let's say I used:
Code: [Select]
/root/Level[@Name="01"]/card[1]/question[3]
and it gave me "2+2" for the question. How do I also save the answer (which is "4") as well? Do I need to do the xPath query again in another Select Single Node action? Or is there another way to do this with Select Nodes? Or perhaps through the properties?

If I stop at
Code: [Select]
/root/Level[@Name="01"]/card[1]how do I get the property of "answer" and still set it to get a random "question" from this action?

Any help would be appreciated. Thanks in advance!

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Just a few Datamaker questions
« Reply #1 on: January 29, 2016, 03:18:47 PM »
I believe if you just add "/answer" you'll get the property of the answer node:

/root/Level[@Name="01"]/card[1]/answer

Have you tried that?

Cheers,

==rr

braintapgames

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Just a few Datamaker questions
« Reply #2 on: January 29, 2016, 06:07:04 PM »
I believe if you just add "/answer" you'll get the property of the answer node:

/root/Level[@Name="01"]/card[1]/answer

Have you tried that?

Cheers,

==rr

Right, but does that mean I'll have to do two separate xPath queries or is it possible to get both the "answer" and a random "question" in one action?

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Just a few Datamaker questions
« Reply #3 on: January 29, 2016, 08:25:25 PM »
In your FSM, you can put an XMLSelectNodes action on one state, and define the path down to where your properties are.

Then, in the next state, include an XMLGetNextNodeListProperties action. That action will let you define multiple properties at one time.