Getting InitTool 1.0 groups from DMGenie

Discussion of initiative tool.

Moderators: Azhrei, dorpond

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Getting InitTool 1.0 groups from DMGenie

Post by jay »

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.
Last edited by jay on Fri May 16, 2008 2:18 am, edited 1 time in total.

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

To add this to DMGenie as an action button do the following:
  1. Select Windows --> General Script Editor from the menu
  2. In the Source drop down select 'Action Buttons'
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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/09/2008: Added <notes> field to output
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.

Fobbo
Giant
Posts: 196
Joined: Wed Feb 01, 2006 2:11 pm

Post by Fobbo »

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.

User avatar
Azhrei
Site Admin
Posts: 12050
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Post by Azhrei »

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. :)

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

I'm trying to get 1.0 ready for release so I'd like to stay away from new functionality until it is ready. I will add a tracker for it though.

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

I just found a bug in my script. I've updated it in the code box above and removed it from the gallery.

Big_Mac
Dragon
Posts: 629
Joined: Thu Aug 17, 2006 10:37 am
Location: Brockton, MA
Contact:

Post by Big_Mac »

jay wrote:I just found a bug in my script. I've updated it in the code box above and removed it from the gallery.


Just remember Jay there is no such thing as bugs! :D Just :Undocumented Features that need product enhancement" :lol:
--
Big Mac

primarch
Cave Troll
Posts: 93
Joined: Sat Oct 28, 2006 11:50 am

Post by primarch »

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

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

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.

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

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
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
Cave Troll
Posts: 93
Joined: Sat Oct 28, 2006 11:50 am

Post by primarch »

jay wrote:
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
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'.


Hi!

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

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

primarch wrote:This change "fixed" it, since I no longer so an error.
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: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.

Here you go:
  1. 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.
  2. Press the action button that will execute the script. It should print out a lot of XML to the combat log.
  3. 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.
  4. 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.
  5. Save the file (Ctrl-S in Notepad). Give it a name that has a file type of .rpgrp.
  6. Start Init Tool and then select Tools --> Group Tool from the menu. This will pop up the Group Tool window.
  7. On the Group Tool Window select File --> Open --> Group Set...
  8. Find the file that you created above in the file dialog and press the 'Open' button. That should load your data into group tool.

dorpond
RPTools Team
Posts: 5530
Joined: Thu Jun 01, 2006 2:05 pm
Location: Buffalo, NY

Post by dorpond »

Hey Jay, this is really nice! I just tested it out and it worked well.

Do you plan on making this script grab the other custom properties like speed, attacks, qualities, etc?

This is cool!

Fobbo
Giant
Posts: 196
Joined: Wed Feb 01, 2006 2:11 pm

Post by Fobbo »

Modifing the script to get that information from DM Genie shouldnt be hard.

User avatar
jay
RPTools Team
Posts: 1765
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx
Contact:

Post by jay »

dorpond wrote:Do you plan on making this script grab the other custom properties like speed, attacks, qualities, etc?
Yes, I've not gotten around to it yet.

Post Reply

Return to “InitiativeTool”