Expressions & XML

0 favourites
  • 4 posts
  • New C3 user here.

    I'm using bbenny93's to study XML, and to look at one way of implementing a dialogue system.

    I think I understand in general terms what bbenny93 is doing: creating a JSON dictionary, and setting the key values to XML attributes in order to call lines of dialogue, and whatever functions might be related to that dialogue (animations, audio, cursor object, etc.). However, I can't understand the expressions bbenny93 is using to go about this, or why certain steps are necessary.

    Some questions:

    1)Line 50: ProjectVariables sets the key "name" equal to Function.Param(0). Which function is this does this apply to? "dialogue"? "create box"? Does it matter that "create box" doesn't seem to have any parameters? What will the value of "name" be at this point in, say, the Demo layout?

    2) Line 50: System sets the "dialogue" parameter, "dialogue_box_project_prefix" to... what? What does the expression "&ProjectVariables.Get("name")&"']/@ mean?

    3)Line 78: What in the wide wide world of sports is a'going on here? RegexMatchCount and all that follows it look like Greek to me.

    I've read this XML introduction, this tutorial on XML Parsing and this one on using XML for dialogue I've also recreated and played around with the event sheets for the C3 tutorials myself. The latter tutorial says, "I hope you already understand the use of &ReferencingAVariableLikeThis&, if not, look into the Text Box tutorials as they can provide insight." So far these directions have proven too nebulous to be helpful. I also tried the Expressions and XML sections of the manual, but they weren't much help.

    If anybody can help me to understand the above, or point me in the direction of resources that might provide more comprehensive explanations of the problems in question, I'd be very grateful.

  • 1) Function.Param(0) applies to "dialogue" function. If you call this function with the parameter "John", then the "name" key in the dictionary will be set to "John".

    2) This variable is used to store XML XPath. "&ProjectVariables.Get("name")&"']/@ means add a value from the dictionary to the string. So the result will look like this:


    3) It uses Regex to search for something and extract some sub-strings. You can use any of the online regex parsers to try to decipher what's going on there.

    I must say, this tutorial seems unnecessary complicated to me. You can study it, but maybe it would be better to build your own dialogue system.

  • Ah these examples are great, but can get a bit complicated as you've seen. If you're willing to give JSON a try, my tutorial course might help. It builds new mechanics in slowly to hopefully give you an idea of what's going on, and I've commented each example as best I can.

    Displaying Dialogue in Games

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your replies, dop2000 and Laura_D. Given the complexity of the dialogue box, I'll try your JSON tutorials, Laura_D.

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