Asmodeus's Forum Posts

  • 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:

    <img src="https://dl.dropbox.com/u/7439411/errorImages/errXML123.jpg" border="0" />

    Example Data:

    <?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>
    
    

    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
  • That's exactly what I'm doing now, actually.

    I'm making use of XPath predicates and saving all the text for the current variable "DialogueBlockIndex" into an array.

    The initial hesitation to do this was based on performance concerns, but I've since decided to just do it and see what happens.

  • I think the objective here is to have an easily readable text file to edit for creating dialogues, and to avoid re-querying with Xpath just to advance from one text block to another.

  • Right, that sounds like the array idea, where you bring the file data into memory for processing. Instead of arrays though, you would use a single string variable and use TokenAt to navigate it. I may end up having to do something like this if there's no way to remember where I left off in the XML file and avoid re-querying with XPath.

    So then, what if your conversation looks like this?

    <?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>
           <nextDialogue>EscapeFromTheCity_Minsc_001</nextDialogue>
          <normal>
             <blocks>
                <element>
                   <portrait>Minsc</portrait>
                   <text>
                      <element>I'm Minsc.</element>
                      <element>I love my hamster, Boo!</element>
                   </text>
                </element>
           ??   <element>
                   <portrait>MainCharacter</portrait>
                   <text>
                      <element>Minsc, you and Boo are in trouble.</element>
                      <element>You have to get out of here!</element>
                   </text>
                </element>
           ??   <element>
                   <portrait>ShadowyFigure</portrait>
                   <text>
                      <element>I've found you...</element>                  
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToMinsc>
    </root>
    
  • How would you step through a dialogue with an NPC, if your conversation is in XML? The screenshot is of a work in progress, but hopefully you get the gist. Would you store the dialogue text into an array from the xml first? Or can you somehow pause the file traversal until more user input is received?

    Example logic:

    <img src="https://dl.dropbox.com/u/7439411/stepThroughXML.jpg" border="0" />

    Example data:

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <TalkToMinsc>
          <normal>
             <blocks>
                <element>
                   <portrait>Minsc</portrait>
                   <text>
                      <element>I'm Minsc.</element>
                      <element>I love my hamster, Boo!</element>
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToMinsc>
    </root>
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For now I've just decided to move on with XML.

    If anyone is interested in writing their logic in JSON, you can convert it to XML just by clicking a button: freeformatter.com/json-to-xml-converter.html

  • I'm trying to design a dialogue system, and I believe I'd prefer to use JSON over XML. I feel like I need the ability to use nested structures, but from what I understand C2 supports a limited dialect of JSON which can be seen when using the Download action on Arrays and Dictionaries.

    It appears I can get nesting in XML, so I will use it as a last resort.

    scirra.com/tutorials/354/xml-parsing

    However, if anyone knows how one could load the following JSON dialogue and parse it let me know. I tried loading it into a Dictionary but it never worked for me.

    Also, here's a link explaining why JSON is better than XML: json.org/xml.html

    {
        "fallingFromTheMountain001": {
            "normal": {
                "blocks": [
                    {
                        "portrait": "Kain",
                        "text": [
                            "I'm fine, thank you..",
                            "You know you really didn't have to do all of this.."
                        ]
                    },
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Oh no worries at all.  A life is a valuable thing.",
                            "I'm just glad these old bones were still up to such a task, haha.",
                            "So tell me, why were you trying to climb that mountain?"
                        ],
                        "options": [
                            {
                                "response": "It's none of your business.",
                                "goto": "fallingFromTheMountain002",
                                "type": "wary"
                            },{
                                "response": "Something terrible happened there..I'm looking for answers.",
                                "goto": "fallingFromTheMountain002",
                                "type": "normal"
                            }
                        ]
                    }
                ]
            }
        },
        "fallingFromTheMountain002": {
            "normal": {
                "blocks": [
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Oh?  Well then take this..."                      
                        ],
                        "itemGet":"OldCaveKey"
                    }
                ]
            },
            "wary": {
                "blocks": [
                    {
                        "portrait": "Kain",
                        "text": [
                            "I don't know who you are and there are people after me for what I know.",
                            "So I don't trust you yet."
                        ]
                    },
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Fine by me. Take as much time as you like."
                        ]
                    }
                ]
            }
        }
    }
  • I have the opposite problem with Chrome. Fullscreen (F11) is 60 FPS, but otherwise it drops to the 25 - 30 range and gets jumpy.

    Firefox has no issues in either case.

    I tried updating my Radeon HD 4800 graphics driver to fix the Chrome issue but it didn't help.

  • JeZLee, this is a great start! The overall package seems solid. The background FX are a very nice touch.

    If this were intended to be more than a test project, I think it would benefit from a joystick control scheme, as pressing spacebar to shoot is noisy and awkward.

    I have also just recently acquired a personal license for C2, and I have a microproject in mind to help me learn the ropes.

  • Hello all,

    I'm Asmodeus.

    I grew up drawing, painting, sculpting, and eventually realized that video games were where I wanted to make my visions real. I hate dogma, and when I see words like 'Iconoclast' a happy fire spirit dances around in my chest.

    Armed with 2 degrees in Comp Sci., a Wacom tablet, a licensed Photoshop suite, and a recently purchased license of C2, I plan to unleash hell on the games marketplace.

    I hope to meet a few really talented, really focused C2 devs here with a similar mission. As Lenneth from Valkyrie Profile always says, "Come to me, dark warriors. Battle awaits us..!"