Wrathgon Spell Manager Update

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

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

Wrathgon Spell Manager Update

Post by neofax »

I have spent quite a bit of time updating Wrathgon's Spell Manager to learn MTScript better and to hopefully make it a solid Spell Manager. Please try to break it so I can make it better. In the meantime, I plan to fix the remaining last bit of correcting the spell database and add some features I would like.

Due to having to break the way the code was wrote in many places tokens from previous versions will not work!

Update procedures:

1. Ensure the campaign properties match the following (notice I changed EH to System to better represent what the property is being used for) (Also, you can see that everything is broken out between 3.5 and Pathfinder. This allows flexibility to possibly even add other systems like Trailblazer.):

Code: Select all

---|Wrathgon|---
BloodlineList
BloodlineListPF
ClassDetail
ClassDetailPF
DomainList
DomainListPF
System
SchoolSpells
SchoolSpellsPF
SLATemplate
SLATemplatePF
SpellCastingInfo
SpellCastingInfoPF
Spells
SpellsPF


2. Replace old Lib:Magic token with my version and ensure that the properties are on the token and contain data.
3. Replace the code on the campaign window for the Wrathgon macros with the below respectively.

Code: Select all

@@ @<b>Cast</b> Wrathgon
@[email protected] fontColor=white ; autoExecute=true ; fontSize=11pt ; sortBy=1.2 ; color=blue ; playerEditable=true ; applyToSelected=true ; group= ; tooltip=Wrathgon ; minWidth=80 ;
[H: ids = getSelected()]
[H: countIDs = listCount(ids)]
[H: abort(if(ids == "" || countIDs > 1, 0, 1))]
[H: tokenID = ids]
[H: classInfo = getProperty("CasterInfo")]
[H: tclassData = json.isEmpty(classInfo)]
[H, if(tclassData == 0): classList = json.fields(classInfo)]
[H, if(listCount(classList) > 1): classViewed = listGet(classList, 0)]
[H, if(listCount(classList) <= 1): classViewed = classList]
[R, if(tclassData == 0), CODE:
   {
   [H: tVar = json.append("", ids, classViewed)]
   [macro("Get [email protected]:Magic"): tVar]
   [H: tclassData = macro.return]
   [H: tokenName = getName(tokenID)]
   [Frame(tokenName+" Spells"):
      {
      [H: macroVar = json.append("", tokenID, classViewed, 1)]
      [macro("Spell Cast [email protected]:Magic"): macroVar]
      }]
   }; {
   [R, S: "You are not a spellcaster!"]
   }]

!!


Code: Select all

@@ @<b>SLA</b> Wrathgon
@[email protected] fontColor=white ; autoExecute=true ; fontSize=11pt ; sortBy=1.3 ; color=blue ; playerEditable=true ; applyToSelected=true ; group= ; tooltip=Wrathgon ; minWidth=80 ;
[H: ids = getSelected()]
[H: countIDs = listCount(ids)]
[H: abort(if(ids == "" || countIDs > 1,  0, 1))]
[H: tokenID = ids]
[H: classInfo = getProperty("CasterInfo")]
[H: tclassData = json.isEmpty(classInfo)]
[H, if(tclassData == 0): classList = json.fields(classInfo)]
[H, if(listCount(classList) > 1): classViewed = listGet(classList, 0)]
[H, if(listCount(classList) <= 1): classViewed = classList]
[R, if(tclassData == 0), CODE:
   {
   [H: tVar = json.append("", ids, classViewed)]
   [macro("Get [email protected]:Magic"): tVar]
   [H: tclassData = macro.return]
   [H: tokenName = getName(tokenID)]
   [Frame(tokenName+" Spells"):
      {
      [H: macroVar = json.append("", tokenID, classViewed)]
      [macro("Spec Abil Main [email protected]:magic"): macroVar]
      }]
   }; {
   [R, S: "You are not a spellcaster!"]
   }]

!!


Code: Select all

@@ @<b>Spell Menu</b> W
@[email protected] fontColor=white ; autoExecute=true ; fontSize=11pt ; sortBy=1.1 ; color=blue ; playerEditable=true ; applyToSelected=true ; group= ; tooltip=Wrathgon ; minWidth=80 ;
[H: ids = getSelected()]
[H: countIDs = listCount(ids)]
[H: abort(if(ids == "" || countIDs > 1, 0, 1))]
[H: macroVar = json.append("", ids, "None")]
[H, macro("Spell [email protected]:Magic"): macroVar]

!!


Code: Select all

@@ @Clear Class Info
@[email protected] fontColor=white ; autoExecute=true ; fontSize=11pt ; sortBy=ZZZ ; color=blue ; playerEditable=true ; applyToSelected=false ; group= ; tooltip=Wrathgon ; minWidth=80 ;
[H: ids = getSelected()]
[H: countIDs = listCount(ids)]
[H: abort(if(ids == "" || countIDs > 1, 0, 1))]
[H: macroVar = json.append("", ids, "None")]
[macro("[email protected]:Magic"): macroVar]
[macro("Spell [email protected]:Magic"): macroVar]

!!


4. Drop token on map and have at it!
Attachments
LibMagic12E.rptok
Fixed maxKnownSpells error for Inquisitor
Fixed Alchemist so it actually preps spells
Fixed problem with Special Groups
(420.93 KiB) Downloaded 159 times
Last edited by neofax on Tue Oct 23, 2012 7:17 pm, edited 4 times in total.
Image
Time-Zone information UTC -5

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

Re: Wrathgon Spell Manager Update

Post by jfrazierjr »

One thing I would suggest since the code is fairly small(and you noted it was not backwards compatible anyway) is to
  • use some type of prefix for your properties(see below)
  • ditto "local" variables within each macro, like say:

    Code: Select all

    [h: nf.local.domainlist = getProperty("nf.props.Domainlist")]
  • (I think you do this already) but use getProperty and setProperty instead of direct variable modification.

Just some advice to keep your drop in from breaking someone else's framework and visa versa...
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: Wrathgon Spell Manager Update

Post by neofax »

jfrazierjr wrote:One thing I would suggest since the code is fairly small(and you noted it was not backwards compatible anyway) is to
  • use some type of prefix for your properties(see below)
  • ditto "local" variables within each macro, like say:

    Code: Select all

    [h: nf.local.domainlist = getProperty("nf.props.Domainlist")]
  • (I think you do this already) but use getProperty and setProperty instead of direct variable modification.

Just some advice to keep your drop in from breaking someone else's framework and visa versa...

All good advice. What do you mean by "local"? Variables that are only used within the block of code and do not "share" across macros? If so, no I did not do this, but I plan to continue maintaining this Spell Manager so I will work these in.
Image
Time-Zone information UTC -5

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Wrathgon Spell Manager Update

Post by aliasmask »

neofax wrote:
jfrazierjr wrote:One thing I would suggest since the code is fairly small(and you noted it was not backwards compatible anyway) is to
  • use some type of prefix for your properties(see below)
  • ditto "local" variables within each macro, like say:

    Code: Select all

    [h: nf.local.domainlist = getProperty("nf.props.Domainlist")]
  • (I think you do this already) but use getProperty and setProperty instead of direct variable modification.

Just some advice to keep your drop in from breaking someone else's framework and visa versa...

All good advice. What do you mean by "local"? Variables that are only used within the block of code and do not "share" across macros? If so, no I did not do this, but I plan to continue maintaining this Spell Manager so I will work these in.

He means, don't refer to the token props directly in your macro writing. Since you don't know what may be a token prop from a random framework, he suggests using a prefix to make your variables unique. So, that big long list of variable names you give for token props disappears and is irrelevant because you will be using getProperty and setProperty for all the token variables. He suggests using names in your macros with prefixes so as to not inadvertently overwrite a token property. This is also called "scoping".

I only scope when I think it may be an issue, like when a macro calls another macro that shares the "scope" (see [wfunc]defineFunction[/wfunc]), or if I think it will conflict with a token property. What I suggested was kind of the opposite, instead of worring about scoping your macros, just scope the token properties. If I were writing a spell manager, I would save my variables on the token as am.sm.propertyName. Also, to help in keeping your variables unique, be descriptive in the name of the variable as well. Don't use acronyms, for example.

Spells is a horrible name for a token property because it is very likely that the name will be used somewhere else by another programmer somewhere in their macro writing. Since they intend it to be only local and don't expect it as a "visible" token property, this will cause some problems. I can think of one with my own code. Ideally, you wouldn't want to have any token visible properties. Instead you'd use hidden property and use the get/set method. Those hidden props would also have your own unique prefix added so another programmer won't accidentally overwrite your "spells" property (although they should be using prefixes too).

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

Re: Wrathgon Spell Manager Update

Post by neofax »

Thanks! I will change the code this weekend and update the thread.

Would people be interested in having the ability to change output styles? I like having color coding and icons in the output for school, SR, saving throw, components... Similar to some of the 4E style frameworks or just plain bold, italic black and white text.
Image
Time-Zone information UTC -5

User avatar
lmarkus001
Great Wyrm
Posts: 1865
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: Wrathgon Spell Manager Update

Post by lmarkus001 »

I am going to incorporate this iteration into my framework as the base Wrathgon code is just to buggy to be used generally and this fork seems to have some ongoing support!

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

Re: Wrathgon Spell Manager Update

Post by neofax »

lmarkus001 wrote:I am going to incorporate this iteration into my framework as the base Wrathgon code is just to buggy to be used generally and this fork seems to have some ongoing support!

I will send you my latest update.

**UPDATE: Most recent code is in the first post.
Image
Time-Zone information UTC -5

Ulijikaru
Kobold
Posts: 3
Joined: Mon Oct 15, 2012 6:58 pm

Re: Wrathgon Spell Manager Update

Post by Ulijikaru »

I have no idea how much work has been put into this but thank you. Having a difficult time with the inquisitor, trying to use the auto pilot to set one up and i get this for an error:

java.lang.IndexOutOfBoundsException: Index: 6, Size: 1 error executing expression knownMaxLvl = json.get(knownMax, FullCL).

my code reading skills are quite limited and I have no idea how to fix this. I am Using 12D and have followed the instructions to the letter. Not sure if there is some other macro or function i need to run to get it smoothed out or some other silly thing i missed. Any help with this issue would be greatly appreciated.

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

Re: Wrathgon Spell Manager Update

Post by neofax »

Ulijikaru wrote:I have no idea how much work has been put into this but thank you. Having a difficult time with the inquisitor, trying to use the auto pilot to set one up and i get this for an error:

java.lang.IndexOutOfBoundsException: Index: 6, Size: 1 error executing expression knownMaxLvl = json.get(knownMax, FullCL).

my code reading skills are quite limited and I have no idea how to fix this. I am Using 12D and have followed the instructions to the letter. Not sure if there is some other macro or function i need to run to get it smoothed out or some other silly thing i missed. Any help with this issue would be greatly appreciated.

I have version 12E that works better and fixes alot of Inquisitor problems, but one remains that I have encountered with it's domain spells. I will work on this again when I get more time. If you want my current release, send me an email at neofax99 <AT> gmail DOT com.
Image
Time-Zone information UTC -5

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

Re: Wrathgon Spell Manager Update

Post by neofax »

Updated OP with 12E which fixes Ulijikaru's problem.
Image
Time-Zone information UTC -5

User avatar
rgwynnjr
Cave Troll
Posts: 59
Joined: Wed Oct 05, 2011 11:03 am
Location: Warminster, PA

Re: Wrathgon Spell Manager Update

Post by rgwynnjr »

Is your latest Wrathgon Spell Manager update included in IMarkus001's MT1.3b87.02 Campaign Framework (LATEST VERSION)? If not, Can your latest update just be dropped in?

viewtopic.php?f=53&t=19985

Edit: I think I answered my own question. It had the 12B version, so I download the new 12E version, removed the 12B and dropped in the 12E.
Yeah... I'm a Druid. No... I don't hung trees, I kick a**.

Post Reply

Return to “Drop-In Macro Resources”