Can't get C2 to read an XML tag.

Get help using Construct 2

Post » Sun Oct 02, 2016 8:57 am

So I followed a little tutorial on how to make an RPG like text box, and it worked like a charm, no problem at all. It was a series of events that read some tags from an XML file in the form of <dialog><line></line></dialog>. Now, I wanted to have more than a single character for this (and I am going to have a lot more), so I made another set of tags, <character></character>, this way I can have more than one set of dialogues, but I can't seem to make it work. It's not writing anything and the text box just says ''Text''. I tripled checked the events sheet to make sure I haven't done any mistake, but I couldn't identify any. If anybody can notice a problem in the XML code and the C2 code then that would be great, because right now I am stuck in this phase.
Code: Select all
<character id='1'>
   <dialog id='1' type="normal">
      <line id='1' >This is a mere prototype</line>
      <line id='2' >why u so mean.</line>
      <line id='3' >don't judge us.</line>
      <line id='4' >plz.</line>
<dialog id='2' type="end">

And the c2 code used to extract the text (there are dozens of these, but they all have this form so I'll only post this one).
Code: Select all
XML.StringValue("/MyGame/character[@id=" & curCharacter & "]/dialog[@id=" & curDialog & "]/line[@id=" & curLine & "]/text()")

I also feel like pointing out that when you interact with that NPC, curCharacter's value is set to 1.
If there isn't any mistake here then I'll post the entire event sheet.
I will also post the tutorial I followed (which includes a capx).
I can't post the link so here is the video id: /watch?v=BntLd2YUg4c&ab_channel=ScirraVideos
Posts: 5
Reputation: 189

Post » Sun Oct 02, 2016 10:25 am

If I understand correctly ...
it seems to work...


Posts: 1,519
Reputation: 11,094

Post » Sun Oct 02, 2016 5:24 pm

Message: Lunastras can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
korbaach wrote:If I understand correctly ...
it seems to work...

Image xmlCharacters.capx

Thank you for the reply!
You confirmed me that I wasn't looking deep enough at the capx. I started thinking out of the box, instead of "Why isn't it working now'' I started thinking ''Did it even work to begin with?''. When I ctrl z'd everything I've realised it wasn't working anymore. I don't have a clue when I broke it, but now it's working like a charm.
Posts: 5
Reputation: 189

Return to How do I....?

Who is online

Users browsing this forum: Metathronos and 9 guests