Cewl feat: fully auto create macros on token

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

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

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Cewl feat: fully auto create macros on token

Post by wolph42 »

At least I think its a cewl feat 8) ...

Thanks to patoace target.campaign I got the idea of creating token macros fully automatic, so no buttons to push, just drag a token on the map, deselect it, then select it again (click on it) and all the macro buttons 'magically' appear.

I've embedded the function in my current DH framework. The trick is in the property: Initiate and in the macro Initiate on the DH:Lib. These two are the only things you need to make this work.

The howto:
Add:
*Initiate:[macro("[email protected]:DH"):""]
to your token properties ("lib:DH" needs to be replaced with the name of your lib token)
and add the following macro to your lib token
[spoiler=Initiate]

Code: Select all

<!--requires macros to be user defined on lib token-->
[
h:createMacro("Use Skill","[r:UseSkill()]", "group=Manage Character; color=default; fontColor=black; sortBy=3; playerEditable=0")]

<!--
Alternative: doesnt require them to be user defined:-->
[
h:createMacro("Show Char adjustments","[macro(&quot;Edit [email protected]:DH&quot;):&quot;&quot;]", "group=Manage Character; color=default; fontColor=black; sortBy=5; playerEditable=0")]

repeat for other macros

[r:setProperty("Initiate", "")]  
[/spoiler]
It's insanely simple and possibly done before but I haven't encountered it yet...hence this post!

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: Cewl feat: fully auto create macros on token

Post by Rumble »

Very cool. I was just going to ask how you kept it from repeating the process, when I noticed the last line.

That's an ideal addition to a framework. I'm going to adopt it for my D&D framework, too. A little tedious to get coded, but once it's done, it's in 'ere.

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Cewl feat: fully auto create macros on token

Post by wolph42 »

obviously I found something for the tedious part as well 8)

added xls file. Put the xml part of the macros of a 'macroed' token in the excel file (Sheet1) and start copy pasting, first into word where you can use search and replace ^p^p with ^p to remove all excess linebreaks and then paste it into Sheet2.

Make sure the lines correspond or things get fu.

It takes a bit of figuring out, but it saves the tedious hassle of coding every macro...
Attachments
Token Macros Initializer.zip
(22.2 KiB) Downloaded 119 times

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: Cewl feat: fully auto create macros on token

Post by Rumble »

Interestingly...it won't stop doing it for me, even with the code at the end there to overwrite the property.

Ah, nevermind - an error in the code was preventing it from getting that far.

koralas
Kobold
Posts: 24
Joined: Wed Jun 23, 2010 1:19 pm

Re: Cewl feat: fully auto create macros on token

Post by koralas »

Very cool, only, for me, it doesn't work if you have the "playerEditable=0" parameter enabled. With this, I get an error "setMacroProps(): You do not have permission to change player editable status". Is there something else I need to set somewhere for this to work properly?

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Cewl feat: fully auto create macros on token

Post by wolph42 »

koralas wrote:Very cool, only, for me, it doesn't work if you have the "playerEditable=0" parameter enabled. With this, I get an error "setMacroProps(): You do not have permission to change player editable status". Is there something else I need to set somewhere for this to work properly?


i have absolutely no clue. One thing you could try though is download my Framework drag a token to map to see if it works. If it does then you're indeed doing something wrong. If not its due to a setting. Mind that it took me quite some trouble to get it to work. It does need some tinkering.

hope this helps

koralas
Kobold
Posts: 24
Joined: Wed Jun 23, 2010 1:19 pm

Re: Cewl feat: fully auto create macros on token

Post by koralas »

wolph42 wrote:
koralas wrote:Very cool, only, for me, it doesn't work if you have the "playerEditable=0" parameter enabled. With this, I get an error "setMacroProps(): You do not have permission to change player editable status". Is there something else I need to set somewhere for this to work properly?


i have absolutely no clue. One thing you could try though is download my Framework drag a token to map to see if it works. If it does then you're indeed doing something wrong. If not its due to a setting. Mind that it took me quite some trouble to get it to work. It does need some tinkering.

hope this helps


I'll do some more testing, see if I can find anything. Thanks.

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Cewl feat: fully auto create macros on token

Post by Irrlicht »

This is no doubt a very good idea, but I have a little issue (maybe this is a noob thing, and I hope it is, so that it may be easily overcome): how can I differentiate PCs and NPCs macros?
I mean: at present, I have two different sets of macros, one for PCs and one for NPCs, that I load as needed when adding a new PC or NPC token. The two sets have mostly the same macros, for example "Fortitude Save" or "Acrobatics Skill"; the difference is that all the macros in the NPC set begin with "/self", so that only the GM can see their results.
So, how could I differentiate the PC and NPC macros with the method presented here? (Don't tell me that NPC macros' results are automatically hidden to players, that would be hilarious...)
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."


User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Cewl feat: fully auto create macros on token

Post by Irrlicht »

Seems that using [if(isNpc()): "/self"; ""] at the beginning screws the code up.

I could use:

Code: Select all

[if(isNpc()), code:
{
[g: A]
[g: B]
};
{
[r: A]
[r: B]
};]


But that would only result in a single heavy macro with a double code in it, rather than two lighter macros (as is now). Is there an easier solution?
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

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

Re: Cewl feat: fully auto create macros on token

Post by jfrazierjr »

Irrlicht wrote:Seems that using [if(isNpc()): "/self"; ""] at the beginning screws the code up.


slash commands CAN ONLY be at the beginning of the first called macro. Embedding a slash command somewhere else is a fruitless trial. However, there are several roll options that might do what you need....
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..

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Cewl feat: fully auto create macros on token

Post by wolph42 »

I should have read better what you posted. What you want is indeed easily solved with roll options:

Code: Select all

[s:A...]
[s:B...]
This will show result only to self (and gm, if not to gm, make it [s,g:A..])
If you actually want to run different code for pc and npc, you'll need my former post

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Cewl feat: fully auto create macros on token

Post by Irrlicht »

Nope, the code is the same, but I need PC things to be visible to all (not just self and GM), and NPC things only to GM. I take it there is no solution other than having a single heavy macros or two lighter macros, until counterproof.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

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

Re: Cewl feat: fully auto create macros on token

Post by Azhrei »

Irrlicht wrote:Nope, the code is the same, but I need PC things to be visible to all (not just self and GM), and NPC things only to GM. I take it there is no solution other than having a single heavy macros or two lighter macros, until counterproof.

Did you read the list of roll options on the wiki? In particular, [gm:]?

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Cewl feat: fully auto create macros on token

Post by Irrlicht »

Yep, but how can I make it so that if the token is a PC things are displayed with r: and if it is a NPC those same things are instead displayed with g:/gm: without writing the same code two times, once for r: and once for g:/gm:?
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

Post Reply

Return to “Macros”