I'm trying to make an XML script parser using AS3 (which my game is being developed in) to handle NPC interactions and down the road to assist with scripting battle sequences. My goal is to develop a system which is similar to that used within the RPG Maker series of programs, in that you script events and they run on interacting with said event. I've created a small list of commands which I want to start out with, but I am having difficulty trying to figure out how to specifically start. Basically for the purpose of NPC conversation, the NPC script will be attached the NPC movieclip, and when the player interacts then it will run/implement the script/commands through the XML parser.
Here is a small example of what the command structure within the NPC would be like.
<text face=TRUE ID=0 loc="LEFT">Good day sir. Loving morning out there.</text>
<qstchk ID=0 status=0 oper=">=">
<qstchk ID=0 status=1 oper="==">
<text face=TRUE ID=0 loc="LEFT">I see you have my 5 Iris'. Thank you very much. Here is your reward.</text>
<qstset id=0 status=2></qstset>
<text face=TRUE ID=0 loc="LEFT">You've given me my Iris', I cannot help you anymore.</text>
<choices num=2 ques="I've got something I could use your help with. Do you mind assisting me?">
<opt id=0 text="I'd be more than willing to help, what can I do?">
<text face=TRUE ID=0 loc="LEFT">Excellant. I'm in need of some flowers. Can you collect me 5 Iris'. Thanks.</text>
<qstset id=0 status=0>
<opt id=1 text="I'm sorry, I haven't the time right now. Maybe later">
<text face=TRUE ID=0 loc="LEFT">Very well, maybe next time.</text>
Most if not all of the commands would relate to specific AS3 functions that would display text on the screen, etc while a few others (qstchk) would just basically be an if statement to compare the progress in a quest with a specific value and then based on this value the script would continue in either the TRUE or FALSE direction.
Any assistance with this would be greatly appreciated.