I am currently working on a small program that helps users create Quests for use with our open source MMO and Virtual World Platform.
I want to be able to put entries from the form attached to this post (questcreator_screen.jpg), into something similar to the below Python code:
collectQuest = MarsCollectionQuest() collectQuest.setName("Get some skins") collectQuest.setDesc("Kill a wolf and bring me the skin and bones") collectQuest.setObjective("Collect 1 Wolf Skin and 1 Wolf Bones") collectQuest.addQuestPrereq("Welcome Ashore") collectQuest.addCollectionGoal(MarsCollectionQuest.CollectionGoal("Wolf Skin", 1)) collectQuest.addCollectionGoal(MarsCollectionQuest.CollectionGoal("Wolf Bones", 1)) collectQuest.addReward("Leather Boots")
'collectQuest' is the Unique Name
'MarsCollectionQuest()' is the type of quest, will be this if the Collection radio is selected, and 'MarsKillQuest' if the Kill radio button is selected.
'welcomeQuest.setName()' is set by Quest Name
'collectQuest.setDesc()' is set by Description
'collectQuest.setObjective()' is set by Objective
'collectQuest.addQuestPrereq()' is set by Required Quest?
'collectQuest.addCollectionGoal(MarsCollectionQuest.CollectionGoal(Item,Number))' is set by one of the Item fields in the Collect Quest section on the right, and the Number/quantity of items is set by the integer control next to it.
'collectQuest.addReward()' is set by Reward
Sorry if I was stating the obvious at times then!
So, each field is related to a piece of the Quest template.
I've worked out how to print text to a file, but I don't know how I'd go about linking each field to each python declaration. So, if I wrote 'findJonDoe' in the Unique Name field, it would put 'findJonDoe' where 'collectQuest' is in the Python file, then selecting the Kill radio button would put 'MarsKillQuest()' after, creating the first line as 'findJonDoe = MarsKillQuest()', and so on and so forth.
I'm not really sure where to start - can someone help me out?