Not working; bug: XML.NodeCount

Get help using Construct 2

Post » Tue Mar 05, 2013 6:28 am

I would like to count the number of text elements using XML.NodeCount but nothing I try is working. The action slightly below it saying Set LastParam3 to "I got here" never fires.

EDIT: I changed the loop to start at 0 and changed loopindex to loopindex + 1 and that at least fires "I got here".

See highlighted action:




Example Data:

[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<root>
   <TalkToImoen>
      <normal>
        <blocks>
            <element>
               <portrait>Imoen</portrait>
               <text>
                  <element>I'm so glad to be out of that place..</element>                           
               </text>
            </element>
        </blocks>
      </normal>
   </TalkToImoen>
   <TalkToMinsc>
      <normal>
        <blocks>
            <element>
               <portrait>Minsc</portrait>
               <text>
                  <element>I'm Minsc.</element>
                  <element>I love my hamster, Boo!</element>
                     <element>I</element>
                     <element>can</element>
                     <element>talk</element>
                     <element>for</element>
                     <element>days! :D</element>
               </text>
            </element>
        </blocks>
      </normal>
   </TalkToMinsc>
</root>

[/CODE]


What I've tried:
  1. Wrapping the expression with int( )
  2. Adding 0 to the end of the expression
  3. Ensuring ".../element[1]" instead of beginning with element 0 in XPath strings
B
9
S
2
Posts: 25
Reputation: 1,050

Post » Tue Mar 05, 2013 5:31 pm

You seem to be missing a "/" in your highlighted action.

[CODE]Set linesOfText to XML.NodeCount("//" & NPCs.dialogueTag & "/normal/blocks/element[" & NPCs.dialogueBlockCurIndex & "]/text")[/CODE]Magistross2013-03-05 17:32:09
B
46
S
17
G
18
Posts: 847
Reputation: 13,802

Post » Tue Mar 05, 2013 8:51 pm

'doh, thanks. Will try it later. Also noticed that I need to manage the size of the array..Asmodeus2013-03-06 03:11:30
B
9
S
2
Posts: 25
Reputation: 1,050


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, Nifl and 28 guests