A (long) MapTool macro tutorial
Moderators: dorpond, trevor, Azhrei
Hello,
I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?
For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points
If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.
Thanks for the help!
E
I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?
For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points
If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.
Thanks for the help!
E
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Elorebaen wrote:Hello,
I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?
For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points
If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.
Thanks for the help!
E
No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.
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..
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..
What I have done (not really macro related, but) is create a separate property set for monsters/NPCs. Then (among other stuff), I set this property in there:Elorebaen wrote:Hello,
I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?
For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points
If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.
Thanks for the help!
E
*#HP
Every macro that changes HP works with it, because it's the same property name, but it'll only show the NPC's HP (on the statsheet) to the GM.
-
- Giant
- Posts: 197
- Joined: Wed Jul 30, 2008 3:43 pm
As jfrazier said, you can't have players and GMs see different parts of the output. However, you can comment out the second line (using <!-- -->)so that the effect takes place but nothing is printed to the chat window.Elorebaen wrote:Hello,
I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?
For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points
If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.
Thanks for the help!
E
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
This is on my to-do list of things to fix (allowing multiple commands within a macro), but based on the evaluation I did while waiting on roll syntax feedback, it'll take a fair bit of effort to get it workingjfrazierjr wrote:No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.
So, eventually, maybe.
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:Mr. Pokeylope wrote:This is on my to-do list of things to fix (allowing multiple commands within a macro), but based on the evaluation I did while waiting on roll syntax feedback, it'll take a fair bit of effort to get it workingjfrazierjr wrote:No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.
So, eventually, maybe.
/me does super foo [/gm "I actually user super bar instead"]
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..
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..
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
Nah, it'd just be done using the multi-line macro editor, and each line would be a separate command. In theory you're supposed to be able to use newlines to automatically insert <br> tags, but since there's a bug that prevents that from working at the moment, I don't feel too bad about changing the (intended) behavior.jfrazierjr wrote:Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:
/me does super foo [/gm "I actually user super bar instead"]
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Mr. Pokeylope wrote:Nah, it'd just be done using the multi-line macro editor, and each line would be a separate command. In theory you're supposed to be able to use newlines to automatically insert <br> tags, but since there's a bug that prevents that from working at the moment, I don't feel too bad about changing the (intended) behavior.jfrazierjr wrote:Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:
/me does super foo [/gm "I actually user super bar instead"]
Ummm what? What bug are you talking about, cause it may not be a bug....
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..
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..
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
{state.Bloodied = if (HP==30, 1, 0) }Plissken wrote:Hi, I'm trying to make it so that when a monster reaches its bloodied value, the bloodied state will show up. I tried this and variants of this but wouldn't work.
{ if (HP==30, [state.Bloodied = 1], [state.Bloodied = 0] ) }
What is the correct way to do this?
Although {state.Bloodied = if (HP <= MaxHP / 2, 1, 0) } would probably be a better way to do it? (Assuming you've got a MaxHP property set.) Using <= so that the monster doesn't have to be exactly at the bloodied value for it to be set.
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
If you have the following macro:jfrazierjr wrote:Ummm what? What bug are you talking about, cause it may not be a bug....
Code: Select all
foo
bar
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Pretty sure it's NOT a bug. Basically, if I remember corretly, this was changed to NOT insert a br automatically because that messes upformatting of tables when someone tries to "prettify" their HTML code. everywhere there is a br tag, the table gets another empty cell that's about 3 px wide...Mr. Pokeylope wrote:If you have the following macro:jfrazierjr wrote:Ummm what? What bug are you talking about, cause it may not be a bug....the documented behavior is that it will replace the newline with a <br> tag. The code to do this exists, but there's a bug in it and the replacement doesn't actually happen. So instead of "foo<br>bar" you get "foo\nbar" (where "\n" represents a newline), which when rendered as HTML is printed as "foo bar".Code: Select all
foo bar
Talk to Orchard who originally reported the problem (though I had noted it before and had just not tracked down the cause) to make sure what you are doing won't cause his tables to go haywire...
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..
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..
I have to say that I really prefer newlines in the macro code to NOT cause automatic <br> tags. That will just make macros so much harder to read, if the macro commands have to be on one long line or have random <br> tags in them.
But I admit I'm biased because I don't do much typing in the chat window directly. It's all in the macro editor, and losing line breaks there will make that little text area that much harder to work with.
If people want that functionality back, at least consider some way to turn it off, maybe with some option/code at the start of the macro or something.
But I admit I'm biased because I don't do much typing in the chat window directly. It's all in the macro editor, and losing line breaks there will make that little text area that much harder to work with.
If people want that functionality back, at least consider some way to turn it off, maybe with some option/code at the start of the macro or something.