Import Makro From Text Files (possibly function request?)

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

Post Reply
chillhelm
Kobold
Posts: 2
Joined: Fri Jul 15, 2011 9:02 am

Import Makro From Text Files (possibly function request?)

Post by chillhelm »

Hi there,

new to maptools and maybe there is a standard way to do this, so please appologize if this is a dumb question (I searched the forums&wiki already but couldnt find anything on the matter):

I want to be able to import makros from plain text files.

Thats all I need. So I figured: Write some sample Makros in Maptools, export them and try to deduce a sort of syntax from this.
Unfortunately when opening the exported files I only see strange symbols. So I assume, that maptools saves makros in some sort of binary code.
Is there a way to translate (aka compile?) makros into this code short of paste-copy them into the internal maptools editor?

The reason why I want to do this, you ask?
For my dnd campaign I want to create a short skript in python, that reads out the attacks including all relevant modifiers from the xml-character sheets provided by the official characterbuilder and produce makro code for them. The first part is easy (creating the makro code from the xml files). While the only option for the second part appears to be paste-copy.

Oh, and please don't tell me I should use char-tools or one of the campaign templates customized for dnd. I'm aware of this option, so don't bother telling me. I believe this feature would be useful for others as well.

Best,
Chilhelm

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Import Makro From Text Files (possibly function request?

Post by CoveredInFish »

There will not be an official maptool version anytime soon out there that supports this - if ever. The dev team sees severe security risks in handling files (and they're probably right). But you can never know what version 1.4 or 1.5 brings, but thats is long-term thinking.

So no other solution for your python hook in than somehow create some homebrew version of MT. Adding a macro function that could read or even write files would be no magic though, if you dont try to handle all potential risks -- if you do know any Java.

You should however check out the dropin RPEdit by aliasmask that lets you - like my outdated macroIO but way improved - import and export token macros to text that you can quickly copy and paste (all macros in one single pass). I'd say this is a must have at least for macro editing! So no total automated solution, but a very feasable one. And you find it in the user creation/dropins forum or if you follow the link in my sig (about my mt workings)

edit: man, third edit just to fix my stuff. I should go to bed :-P

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Import Makro From Text Files (possibly function request?

Post by jfrazierjr »

chillhelm wrote:The reason why I want to do this, you ask?
For my dnd campaign I want to create a short skript in python, that reads out the attacks including all relevant modifiers from the xml-character sheets provided by the official characterbuilder and produce makro code for them. The first part is easy (creating the makro code from the xml files). While the only option for the second part appears to be paste-copy.

Oh, and please don't tell me I should use char-tools or one of the campaign templates customized for dnd. I'm aware of this option, so don't bother telling me. I believe this feature would be useful for others as well.

Best,
Chilhelm
Another( and likely better long term) is to "parse" the powers down into meta data using your Python code and store this meta data as the macro.(ie, by default, it won't "do" anything since it's raw data). Then, write macros that PROCESS the data and spit out the results. Example:

Code: Select all

Name=Foo
NumAttacks=2
Attack1Bonus=7
Attack2Bonus=2
Attack1Damage=1d8
Attack2Damage=1d6
I would suggest building that structure up as a JSON variable which you then pass to your "attack" macro as a variable input to the macro. Basically, you build the engine ONCE and then just plug data into it as needed. Granted, you may have to go back and tweak the engine when a new scenario comes along, but such should take fairly little work in "most" cases if you think ahead to start with. Most of the frameworks work in this type of manner, so you can check them out to see what I am talking about.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: Import Makro From Text Files (possibly function request?

Post by neofax »

You do know the *.mtmacro is just a zipped up XML file? As for the code to make them, go look at Jays Character Builder as he does exactly this, but with Java for Veggie's FW. You could probably see how he does it and go from there.

Post Reply

Return to “Documentation Requests/Discussion”