Don't have an account yet? Then register once and completely free of charge and use our wide range of topics, features and great options. As a registered member on our site, you can use all functions to actively participate in community life. Write posts, open topics, upload your pictures, put your videos online, talk to other members and help us to constantly improve our project and grow together! So, what are you waiting for? Become a part of us today!
To get support for a technical issue such as installing the software, to query a purchase that you've made/would like to make, or anything other than using our software, please visit our Customer Service Desk:
Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
I have a basic extension idea, and it'll need to use XML files to store data. The files don't need opening in third party apps, so I'm not too concerned about validating the code produced.
Anyone got any suggestions on an easy but powerful library?
I've never used JSON. Below is a mockup of how a data file might look in XML - it's a little long, but can you do a small excerpt of how it might look in JSON?
Code
<chatter>
<speaker name="Daniel">
<node if="Location('Town') and !HasQuest('DuckQuest')" then="GiveItem('Duck')" next="Daniel's Quest">
Hi there, I'm Daniel! I hate the town. Here - have a duck!
</node>
<node if="Location('Forest') and !HasQuest('DuckQuest')" then="GiveItem('Duck')" next="Daniel's Quest">
Hi there, I'm Daniel! I love this forest. I found this duck - take it!
</node>
<node if="!HasQuest('DuckQuest')" label="Daniel's quest" then="AddQuest('DuckQuest')" next="END">
Take the duck to my Auntie Madge. She loves duck. Not to suggest that she'll eat it or anything.<line />
I mean she might.<line />
There's a chance of it, yeah.<line />
Okay yeah, she'll eat it. What can I say, it's nature?
</node>
<node if="HasQuest('DuckQuest') == Active">
Did you give the duck to Aunt Madge yet?
<say next="DuckQuest-A">Yep, I did</say>
<say next="DuckQuest-B">No, I did not</say>
</node>
<node if="HasQuest('DuckQuest') == Active and !QuestComplete('DuckQuest')" label="DuckQuest-A" next="END">
What's that poking out of your bag?...<line />
My duck!<line />
You liar, take it to my Aunty already, she needs it!
</node>
<node if="HasQuest('DuckQuest') == Active and QuestComplete('DuckQuest')" then="GiveItem('Money', 100) and HasQuest('DuckQuest')=Done" label="DuckQuest-A" next="END">
Well done, here's your reward.
</node>
<node if="HasQuest('DuckQuest') == Active" label="DuckQuest-B" next="END">
Okay, well get on and do it quickly.
</node>
</speaker>
</chatter>
Display More
It's for RPG conversations, the extension will have a handy editor which makes these files easier to prepare (all point-and-clicky), but basically the IF attribute triggers a condition in MMF that you name yourself, and it has an action that returns true, false, or a value. If the expression in IF is false, the node is skipped and the next one is evaluated.
The NEXT attribute jumps to a specific node, by its LABEL attribute, or keyword END being end of conversation.
THEN triggers an action of your choice when this node of conversation ends. It triggers a named event, as with IF.
(any suggestions on a better system are appreciated too XD )
JSON is a different beast, but here's an idea of how some of it might look:
Code
{ "speakers":
[
{ 'name': 'Daniel',
'nodes':
[
{ 'if': 'Location('Town') and !HasQuest('DuckQuest')',
'then': 'GiveItem('Duck')',
'next': 'Daniel's Quest',
'lines':
[
'Hi there, I'm Daniel! I hate the town. Here - have a duck!'
]
},
{ "if": "Location('Forest') and !HasQuest('DuckQuest')",
"then": "GiveItem('Duck')",
"next": "Daniel's Quest",
"lines":
[
'Hi there, I'm Daniel! I love this forest. I found this duck - take it!'
]
},
{ "if": "!HasQuest('DuckQuest')",
"label": "Daniel's quest",
"then": "AddQuest('DuckQuest')",
"next": "END",
"lines":
[
'Take the duck to my Auntie Madge. She loves duck. Not to suggest that she'll eat it or anything.',
'I mean she might.',
'There's a chance of it, yeah.',
'Okay yeah, she'll eat it. What can I say, it's nature?'
]
},
{ "if": "HasQuest('DuckQuest') == Active",
"lines":
[
'Did you give the duck to Aunt Madge yet?'
],
"options":
[
{ 'next': 'DuckQuest-A',
'content': 'Yep, I did'
},
{ 'next': 'DuckQuest-B',
'content': 'No, I did not'
}
]
}
]
}
]
}
Display More
As for a parser, Please login to see this link. is the one used in the Edif SDK.
I too think you should use JSON for this - it will have a smaller file size, it will be much easier to type and read, and James has already written a parser that, if you're using EDIF, you already have in your project. If you're not using EDIF, you're missing out
Well JSON is nice. I don't find it particularly more readable than your XML example. Obviously JSON has it's advantages on the web (in the context of JavaScript and file size before compression), but there is a lot of XML-hate going around at the moment which is unwarranted in general, along with a general notion that writing less is always better, and significant whitespace is all the hype, man. I don't advocate either option. Just consider your use case and how quickly existing tools will help you get the job done. For JSON I would suggest trying James' JSON parser, but I don't know if it can encode for saving JSON to a file (i.e. it is just a parser and not an encoder). For XML I would definitely suggest TinyXML, it's so simple and manages its own memory so you don't have to worry too much about leaking, and can load and save xml files very easily without too much hassle. I used it because all I wanted was a file format that could be read in plain text and a well developed library that would abstract most of the hassle of loading and saving a document structures, and TinyXML does this. Someone should suggest a JSON library that is equally agile, but I don't personally know of any.
Well I meant someone with experience of a suitable implementation should highlight it. I can't do that because I haven't tried out any of the 21 JSON parsers you mention, and just pointing at them (I was aware before hand anyway) doesn't make it any more obvious which ones are worth using. I can easily strike off those that only parse JSON, but I wouldn't be able to say which of these libraries are nice to use when encoding and parsing JSON, and that's essentially what the question is asking for. Hence someone should suggest one that they know from experience matches the quality of a library like TinyXML.
Check my Signature where it says "Write Extensions with EDIF!", there are two different hyperlinks. The first is the main post, the second explains it.