Getting InitTool 1.0 groups from DMGenie
Getting InitTool 1.0 groups from DMGenie
I wrote a little script for DMGenie that will output the current group as an Init Tool Groups (.rpgrp) file. Just add it as one of the action buttons and it will output the XML for the group in the combatant log. Cut and paste that to a file and it can be loaded into GT.
You can get the script from the gallery: DMGenie2RPToolsGroup
The group that is created is for the default Init Tool D&D game. If anybody knows how I could write a file directly from DMGenie, I'll fix it to do that, otherwise it's cut and paste.
You can get the script from the gallery: DMGenie2RPToolsGroup
The group that is created is for the default Init Tool D&D game. If anybody knows how I could write a file directly from DMGenie, I'll fix it to do that, otherwise it's cut and paste.
Last edited by jay on Fri May 16, 2008 2:18 am, edited 1 time in total.
To add this to DMGenie as an action button do the following:
Edit 05/09/2008: Added <notes> field to output
Edit 05/15/2008: Fixed problem of forum removing text after dashes.
- Select Windows --> General Script Editor from the menu
- In the Source drop down select 'Action Buttons'
- In the Function drop down select 'ActionButton##' where ## is replaced with a number. Make sure you find one that isn't being used. Unused ones do not have any scripting between the 'Public Sub ActionButton##' and 'End Sub' lines.
- Set the 'Button Label' field to something so you can tell what it does like 'RPTools Group XML'. You can set the tooltip if you want.
- Copy the script in the code box below into the text area at the bottom of the dialog. Make sure it goes between the 'Public Sub ActionButton##' and 'End Sub' lines.
- Click the check syntax button to make sure you copied it right. A little message dialog should come up and say that no syntax errors were found.
- The button is now ready to use. It will be located on the Actions or Attacks Tabs in DMGenie. The Description and Hints text box may tell you where to look.
Code: Select all
func.AddToCombatLog "<group-set>"
func.AddToCombatLog " <game-name>Rodinia</game-name>"
func.AddToCombatLog " <groups>"
func.AddToCombatLog " <group>"
func.AddToCombatLog " <name>DMGenie Group</name>"
func.AddToCombatLog " <combatants>"
func.GetNextCreatureInit 0
Set MyCreature = func.GetNextCreature
While (Not MyCreature Is Nothing)
func.AddToCombatLog " <combatant>"
func.AddToCombatLog " <name>" & MyCreature.Name & "</name>"
func.AddToCombatLog " <count>1</count>"
func.AddToCombatLog " <init-modifier>" & MyCreature.InitBonus & "</init-modifier>"
func.AddToCombatLog " <player>" & MyCreature.Desc_PlayerName & "</player>"
func.AddToCombatLog " <type>PC</type>"
func.AddToCombatLog " <token/>"
func.AddToCombatLog " <notes>" & MyCreature.Desc & "</notes>"
func.AddToCombatLog " <alignment>" & MyCreature.Alignment & "</alignment>"
func.AddToCombatLog " <family>" & MyCreature.RaceName & "</family> <!-- TODO: Change family to race -->"
func.AddToCombatLog " <size>" & MyCreature.SizeStr & "</size>"
func.AddToCombatLog " <ac>" & MyCreature.AC & "</ac>"
func.AddToCombatLog " <touchAc>" & MyCreature.ACTouch & "</touchAc>"
func.AddToCombatLog " <flatFootedAc>" & MyCreature.ACFF & "</flatFootedAc>"
func.AddToCombatLog " <speed>" & MyCreature.SpeedStr & "</speed>"
func.AddToCombatLog " <baseAttack>" & MyCreature.CalculateBABFromClasses() & "</baseAttack>"
func.AddToCombatLog " <str>" & MyCreature.Str & "</str>"
func.AddToCombatLog " <dex>" & MyCreature.Dex & "</dex>"
func.AddToCombatLog " <con>" & MyCreature.Con & "</con>"
func.AddToCombatLog " <int>" & MyCreature.Intel & "</int>"
func.AddToCombatLog " <wis>" & MyCreature.Wis & "</wis>"
func.AddToCombatLog " <cha>" & MyCreature.Cha & "</cha>"
func.AddToCombatLog " <grapple>FIXME</grapple>"
func.AddToCombatLog " <fortSave>" & MyCreature.FortSave & "</fortSave>"
func.AddToCombatLog " <reflexSave>" & MyCreature.RefSave & "</reflexSave>"
func.AddToCombatLog " <willSave>" & MyCreature.WillSave & "</willSave>"
func.AddToCombatLog " <strBonus>" & MyCreature.StrMod & "</strBonus>"
func.AddToCombatLog " <dexBonus>" & MyCreature.DexMod & "</dexBonus>"
func.AddToCombatLog " <conBonus>" & MyCreature.ConMod & "</conBonus>"
func.AddToCombatLog " <intBonus>" & MyCreature.IntMod & "</intBonus>"
func.AddToCombatLog " <wisBonus>" & MyCreature.WisMod & "</wisBonus>"
func.AddToCombatLog " <chaBonus>" & MyCreature.ChaMod & "</chaBonus>"
func.AddToCombatLog " <gender>" & MyCreature.Gender & "</gender>"
func.AddToCombatLog " <levels>" & MyCreature.LevelStr & "</levels>"
func.AddToCombatLog " <height>" & MyCreature.Height & "</height>"
func.AddToCombatLog " <weight>" & MyCreature.Weight & "</weight>"
func.AddToCombatLog " <age>" & MyCreature.Age & "</age>"
func.AddToCombatLog " <damageReduction>" & MyCreature.DamageReductionStr & "</damageReduction>"
func.AddToCombatLog " <hp>" & MyCreature.HPBase & "</hp>"
func.AddToCombatLog " <fortBase>" & MyCreature.FortBase & "</fortBase>"
func.AddToCombatLog " <fortMagic>" & MyCreature.FortBonus & "</fortMagic>"
func.AddToCombatLog " <reflexBase>" & MyCreature.RefBase & "</reflexBase>"
func.AddToCombatLog " <reflexMagic>" & MyCreature.RefBonus & "</reflexMagic>"
func.AddToCombatLog " <willBase>" & MyCreature.WillBase & "</willBase>"
func.AddToCombatLog " <willMagic>" & MyCreature.WillBonus & "</willMagic>"
func.AddToCombatLog " <sizeBonus>" & MyCreature.SizeStr & "</sizeBonus>"
func.AddToCombatLog " <armorCheckPenalty>" & MyCreature.FinalCheck & "</armorCheckPenalty>"
Dim MySkill, i
for i = 1 to func.GetNumberOf_Skills
Set MySkill = func.GetSkillObj(CInt(i))
if func.ValidSk(MySkill) then
tag = lcase(MySkill.NameUcase)
tag = replace(tag, "(", "")
tag = replace(tag, ")", "")
words = split(tag)
if ubound(words) >= 0 then
tag = "skill." & words(0)
if ubound(words) > 0 then
for j = 1 to ubound(words)
tag = tag & func.Capital(words(j))
next
end if
func.AddToCombatLog " <" & tag & ".total>" & MyCreature.SkillTotal(i) & "</" & tag & ".total>"
func.AddToCombatLog " <" & tag & ".rank>" & MyCreature.SkillRanks(i) & "</" & tag & ".rank>"
func.AddToCombatLog " <" & tag & ".misc>" & MyCreature.SkillTotal(i) & "</" & tag & ".misc>"
else
func.AddToCombatLog " <!-- skipping a skill without a name -->"
end if
end If
next
func.AddToCombatLog " </combatant>"
Set MyCreature = func.GetNextCreature
Wend
func.AddToCombatLog " </combatants>"
func.AddToCombatLog " </group>"
func.AddToCombatLog " </groups>"
func.AddToCombatLog "</group-set>"
Edit 05/15/2008: Fixed problem of forum removing text after dashes.
Last edited by jay on Thu May 15, 2008 3:19 pm, edited 4 times in total.
Nicely done Jay, I was thinking of this very thing but having no time nor the correct skill to create it quickly had left it alone.
We can use this for either A. putting in the group into Init tool and then dragging the tokens into Maptool or B. creating an xml import in Maptool that use the same file.
We can use this for either A. putting in the group into Init tool and then dragging the tokens into Maptool or B. creating an xml import in Maptool that use the same file.
Jay, can InitTool get the XML directly from the cut buffer, ie. the clipboard?
I'm thinking it would be nice for the user to highlight a chunk of text, activate the InitTool window, then type Ctrl-V (or some other keystroke), and presto! the group now exists! And the user doesn't have to go through the pain of creating a file somewhere (on the desktop?), open it, paste into it, save it, then select File->Open... in InitTool, etc.
Thanks.
I'm thinking it would be nice for the user to highlight a chunk of text, activate the InitTool window, then type Ctrl-V (or some other keystroke), and presto! the group now exists! And the user doesn't have to go through the pain of creating a file somewhere (on the desktop?), open it, paste into it, save it, then select File->Open... in InitTool, etc.
Thanks.
I just cut and paste it into my action button 15 and it worked correctly. Is it possible that you typed in an extra character before you saved it? Or didn't copy everything?
If that is not the problem, then you might have a skill defined in your DMGenie instance that has a blank name. I added a blank skill name to my dmgenie data and it got the same error. To see if this is the problem select Windows --> Custom Data Editor --> Skills tab. See if there is a blank line in the skill list. I'll also put a check in the next incarnation of the script that handles that.
If that is not the problem, then you might have a skill defined in your DMGenie instance that has a blank name. I added a blank skill name to my dmgenie data and it got the same error. To see if this is the problem select Windows --> Custom Data Editor --> Skills tab. See if there is a blank line in the skill list. I'll also put a check in the next incarnation of the script that handles that.
I updated the script in the code box above to handle this case. It will now output a XML comment saying that it skipped a skill with a blank name. I also 'enhanced' a small 'undocumented feature' out of the script as well. I don't think it was breaking IT, but it needed 'enhancement'.primarch wrote:Hi!
Assuming the code in the box above is updated, I get a runtime error 9
subscript out of range: [number 0]
line 65 column 6
I made it an action button (number 15)
Primarch
Hi!jay wrote:I updated the script in the code box above to handle this case. It will now output a XML comment saying that it skipped a skill with a blank name. I also 'enhanced' a small 'undocumented feature' out of the script as well. I don't think it was breaking IT, but it needed 'enhancement'.primarch wrote:Hi!
Assuming the code in the box above is updated, I get a runtime error 9
subscript out of range: [number 0]
line 65 column 6
I made it an action button (number 15)
Primarch
This change "fixed" it, since I no longer so an error. My newbie question is after I click my custom button, what do I do next? I open ITool and don't see anything and I don't seem to be able to find a file anywhere.
Perhaps a step by step (idiot proof) instruction is in order.
Thanks for your help!
Primarch
Did you have a skill with a blank name in it? Because if that isn't the case there may be some other problem.primarch wrote:This change "fixed" it, since I no longer so an error.
Here you go:primarch wrote:My newbie question is after I click my custom button, what do I do next? I open ITool and don't see anything and I don't seem to be able to find a file anywhere.
Perhaps a step by step (idiot proof) instruction is in order.
- In DMGenie click on the combat log, hit Ctrl-A and then Delete. This will empty out your combat log to make it easier to grab the group that is being created.
- Press the action button that will execute the script. It should print out a lot of XML to the combat log.
- Click on the combat log in DMGenie again, hit Ctrl-A and then Ctrl-C. This will copy all of the XML output by the script on to the clipboard.
- Open up windows Notepad, or any other simple little file editor and hit Ctrl-V. This will paste all of the XML from DMGenie into the editor.
- Save the file (Ctrl-S in Notepad). Give it a name that has a file type of .rpgrp.
- Start Init Tool and then select Tools --> Group Tool from the menu. This will pop up the Group Tool window.
- On the Group Tool Window select File --> Open --> Group Set...
- Find the file that you created above in the file dialog and press the 'Open' button. That should load your data into group tool.