RPTools.net

Discussion and Support

Skip to content

It is currently Wed Oct 18, 2017 6:58 pm 




Forum rules


Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)



Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Great Wyrm
 
Joined: Tue May 26, 2009 7:51 pm
Posts: 2060
Location: Philadelphia, PA
 Post subject: Create a macro to quickly toggle mod-Sets
PostPosted: Sun May 30, 2010 2:22 pm 
aliasmask wrote:
I wish there was an easily programmable way to call your code to activate/deactivate mod sets.


This will toggle a mod set.
Code:
[MACRO("subModToggle@Lib:libDnD35Pathfinder"): json.set( json.set( json.set( "{}", "tokenID", tToken ), "setID", tmID ), "setType", 0 ) ]  


  • tToken = Token ID of the token you want to toggle the mod-set on.
  • setID = The "name" of the mod-set (for example: "Bulls Strength" ).
  • setType = 0 for mod-set; 1 for item.

If you want to set it one way or the other, you must first discover if it is set, and if so, then you know if you should toggle it or not. Here is a code snippit to determine if a mod-set is active.

Code:
[H: tModSet = "Bulls Strength" ]

[
H: aTMS = json.get( PrivateJSON, "ActiveTempModSets" ) ]
[
H, IF( json.type( aTMS ) == "UNKNOWN" ), CODE: {
   [ PrivateJSON = json.set( PrivateJSON, "ActiveTempModSets", "[]" ) ]
   [ aTMS = "[]" ]
}]

[
H: msIsActive = if( json.contains( aTMS, tModSet ), 1, 0 ) ]  


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Mon Sep 10, 2007 10:49 am
Posts: 33
 Post subject: Re: Create a macro to quickly toggle mod-Sets
PostPosted: Mon Jun 14, 2010 4:43 pm 
I just upgraded to this version of the framework with the new toggle mod-sets. I am so grateful for the framework and the support here.

I am having trouble connecting the dots with these code snippets. Could you provide a full sample macro for toggling the mod? I am not seeing how I can pass through the selected tokens or arguments into the appropriate macro. If you can provide one example, then I can set up all my other spells/states. I just need that first complete example.


Top
 Profile  
 
 Offline
Great Wyrm
 
Joined: Tue May 26, 2009 7:51 pm
Posts: 2060
Location: Philadelphia, PA
 Post subject: Re: Create a macro to quickly toggle mod-Sets
PostPosted: Mon Jun 14, 2010 5:21 pm 
Most Conditions/Spell/DR-ER are already provided. The above is for creating a button that allows the GM to turn on a particular mod with just a button. So, if your PC's use Bless alot, it would be easier to make a macro that does a foreach grabbing the token ids, checks if the mod is already applied and set the mod, instead of a three step manual process. I haven't used the above yet.


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Mon Sep 10, 2007 10:49 am
Posts: 33
 Post subject: Re: Create a macro to quickly toggle mod-Sets
PostPosted: Mon Jun 14, 2010 9:05 pm 
neofax wrote:
Most Conditions/Spell/DR-ER are already provided. The above is for creating a button that allows the GM to turn on a particular mod with just a button. So, if your PC's use Bless alot, it would be easier to make a macro that does a foreach grabbing the token ids, checks if the mod is already applied and set the mod, instead of a three step manual process. I haven't used the above yet.


Right, that is exactly what I am trying to accomplish. I want a macro button on my campaign pane which will toggle the mod. I currently have the button in the campaign pane which will call the macro stored in a library and it will toggle the mod just fine.

But I can only get it to toggle a single token. I cannot select more than one token and have it apply the macro to each one. I'd like help with the loop. How do I get the macro to run for each of the selected tokens.

Here is the macro for the campaign pane:
Code:
[MACRO("BullsStrength@Lib:PathfinderSpells"):""]


And the macro for the library is:
Code:
[H: tmID = "Bulls Strength"]
[H: tToken = getSelected()]

[H: numTList = listCount(tToken)]
[H: abort(numTList)]

[MACRO("subModToggle@Lib:libDnD35Pathfinder"): json.set( json.set( json.set( "{}", "tokenID", tToken ), "setID", tmID ), "setType", 0 ) ] 


Can anyone help with having it sort through all the selected tokens?

Also this routine takes about 9 seconds to run on my computer. Using my old macros and not the mod-set was nearly instantaneous.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 3 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman