Can't get C2 to read an XML tag.

0 favourites
  • 3 posts
From the Asset Store
A cool way for kids to write and practice English Alphabets
  • 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.

    <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).
    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
  • If I understand correctly ...

    it seems to work...


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I understand correctly ...

    it seems to work... 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.

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