[Help] Maptool Macro Help Here

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

[Help] Maptool Macro Help Here

Post by Naryt »

If you have a macro question, basic or not, feel free to drop it here, trained electrons will then do their best to display the proper answer. :lol:
A wandering lost soul

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

The first question goes to Dedric:
Dedric wrote:How would you set this up?

Roll a 1d20+mods (check to see if just the 1d20 was a 20) if true Critical Hit{14+1d6} if not {1d10+4}
Ugly Macro

Code: Select all

[DiceRoll = 1d20]
[DiceRoll + Modifier]
[if(DiceRoll == 20,14+1d6,1d10+4)]
Line by line
  1. Rolls 1d20 and stores it in DiceRoll
  2. Prompts the user for the Modifier, adds it to DiceRoll
  3. Checks the value of DiceRoll, if it is 20 then roll 14+1d6 otherwise roll 1d10+4
Ugly Output
« DiceRoll = 1d20 = DiceRoll = 17 = 17 » « DiceRoll + Modifier = 17 + 4 = 21 » « if(DiceRoll == 20,14+1d6,1d10+4) = 6 »
Note that you can verify that the proper dice roll is used for 20s by changing line 1 to be [DiceRoll = 20]

Beautimufied Macro

Code: Select all

<!--[DiceRoll = 1d20]
[Modifier = Modifier]-->
You rolled {DiceRoll} on 1d20 with a {if(Modifier > 0,"+","")}{Modifier} for {DiceRoll + Modifier}.  That's a {if(DiceRoll == 20, "Critical Hit", "Normal Hit")} of {if(DiceRoll == 20,14+1d6,1d10+4)}.
Block by block
Remember that [ ] and { } are both macro blocks
  • Use <!-- --> around the ugly bits to hide them
  • Set DiceRoll = 1d20 (set it to = 20 to test Critical Hits)
  • Get the value of Modifier from the user and store it for later use
  • {DiceRoll} prints the value of the 1d20 rolled
  • {if(Modifier > 0,"+","")} will print a + if the Modifier is positive and do nothing if it is negative
  • {Modifier} shows the value of the Modifier the user entered
  • {DiceRoll + Modifier} gives us the total roll
  • {if(DiceRoll == 20, "Critical Hit", "Normal Hit")} if DiceRoll was 20 then print Critical Hit otherwise print Normal Hit
  • {if(DiceRoll == 20,14+1d6,1d10+4)} if DiceRoll was 20 then roll 14+1d6 otherwise roll 1d10 + 4
Pretty Output
You rolled 13 on 1d20 with a +4 for 17. That's a Normal Hit of 8.
Last edited by Naryt on Thu Aug 14, 2008 11:26 am, edited 1 time in total.
A wandering lost soul

Sepp
Dragon
Posts: 251
Joined: Fri Jul 25, 2008 7:41 pm

Post by Sepp »

{if(DiceRoll == 20, "Critical Hit", "Normal Hit")}

What would you do to make it show a Critical Miss?
I have been using this, but it's two if statements. How can I make it one?
{if(roll>=20," Critical Hit! ","")}{if(roll<=1," Critical Miss! ","")}

User avatar
tektonik
Dragon
Posts: 299
Joined: Mon Jul 21, 2008 1:21 pm

Post by tektonik »

furthermore what happens on a crit range of 19-20

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

tektonik wrote:furthermore what happens on a crit range of 19-20
Just change DiceRoll == 20 to DiceRoll > 18
A wandering lost soul

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

Sepp wrote:{if(DiceRoll == 20, "Critical Hit", "Normal Hit")}

What would you do to make it show a Critical Miss?
I have been using this, but it's two if statements. How can I make it one?
{if(roll>=20," Critical Hit! ","")}{if(roll<=1," Critical Miss! ","")}
First, I wouldn't use roll as a variable as the parser uses roll internally. It MIGHT not cause you problems but then again.

{if(DiceRoll>=20," Critical Hit! ",if(DiceRoll<=1," Critical Miss! ",""))}

Basically, just put your second if statement into the first one in place of the "" in the false section.
A wandering lost soul

Sepp
Dragon
Posts: 251
Joined: Fri Jul 25, 2008 7:41 pm

Post by Sepp »

Oh, I see. Now I have to go change all my macros... *sigh*

Thanks for clearing that up, though.

User avatar
torstan
Great Wyrm
Posts: 1887
Joined: Wed Sep 27, 2006 6:50 am
Contact:

Post by torstan »

Naryt wrote: [*]Prompts the user for the Modifier, adds it to DiceRoll and stores that in FullRoll
No FullRoll mentioned in the macro. Just thought I'd point it out to avoid confusion.

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

torstan wrote:
Naryt wrote: [*]Prompts the user for the Modifier, adds it to DiceRoll and stores that in FullRoll
No FullRoll mentioned in the macro. Just thought I'd point it out to avoid confusion.
Doh...thanks, I took it out for simplicity and then forgot to remove it from the list.
A wandering lost soul

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

Post by jfrazierjr »

Sepp wrote:{if(DiceRoll == 20, "Critical Hit", "Normal Hit")}

What would you do to make it show a Critical Miss?
I have been using this, but it's two if statements. How can I make it one?
{if(roll>=20," Critical Hit! ","")}{if(roll<=1," Critical Miss! ","")}
Can't. This is not a true scripting language, so you have to do the extra work and step by step manually.
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
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Post by jfrazierjr »

Naryt wrote:
tektonik wrote:furthermore what happens on a crit range of 19-20
Just change DiceRoll == 20 to DiceRoll > 18
Better: Assuming you are using some type of properties to store weapon damage, modifiers, etc, add a property for the CritRangeMin and test for that INSTEAD of hard coding into the macro itself. This gives you flexibility. This is especially useful if you have properties for storing the "current" weapon(in which case you need a similar property for each weapon and the "current" variant) so when you switch weapons, your crit range just works. At least thats what I do.
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
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

jfrazierjr wrote:
Sepp wrote:{if(DiceRoll == 20, "Critical Hit", "Normal Hit")}

What would you do to make it show a Critical Miss?
I have been using this, but it's two if statements. How can I make it one?
{if(roll>=20," Critical Hit! ","")}{if(roll<=1," Critical Miss! ","")}
Can't. This is not a true scripting language, so you have to do the extra work and step by step manually.
Sure you can jfrazier, see my post above where I do combine them into one nested statement.
A wandering lost soul

User avatar
kat2cute
Dragon
Posts: 297
Joined: Wed Jan 30, 2008 3:46 pm

Post by kat2cute »

So I am trying to create a table format that takes the skill roll and then does math functions to it later in the macro. Seems easy, but it keeps asking me to input the value of alchemyroll every time it appears in the token macro. What am I doing wrong so that it doesn't ask for ANY user input?

Code: Select all

Per day roll: AlchemyRoll*DC > Cost in coppers<br>
alchemyroll=[1d20+Alchemy+2]
<table width=400><tr><td>Acid: </td><td>{alchemyroll*15}>1000</td><td>{alchemyroll/1000*100}% done</td></tr>
<tr><td>Alchemist Fire/SmokeStick:</td><td> {alchemyroll*20}>2000</td><td>{alchemyroll/2000*100}% done</td></tr>
<tr><td>Tindertwig:</td><td> {alchemyroll*20}>100</td><td>{alchemyroll/100*100}% done</td></tr>
<tr><td>Sunrod: </td><td>{alchemyroll*25}>200</td><td>{alchemyroll/200*100}% done</td></tr>
<tr><td>Thunderstone:</td><td> {alchemyroll*25}>3000</td><td>{alchemyroll/3000*100}% done</td></tr>
<tr><td>Tanglefoot bag:</td><td> {alchemyroll*25}>5000</td><td>{alchemyroll/5000*100}% done</td></tr></table>
Quote from an underwater D&D fight:
Alright fighter, it's your turn. What do you do?
Fighter: What do you think I do? I FAIL MY F**KING SWIM CHECK

Dedric
Cave Troll
Posts: 37
Joined: Fri Jul 04, 2008 1:31 pm

Post by Dedric »

I'm breaking my skull with a critical hit setup.

What I'm trying to do.
Roll a 1d20+StrBonus+EnhancementBonus+LevelBonus

Check to see if the 1d20 is a critical hit (20)

If true: CriticalHit
Show the roll in full and MaxDamage1(stored in properties) after a line break.
If False
Show the roll in full and Weapon1Damage.(stored in properties) after a line break.

User avatar
Mrugnak
Dragon
Posts: 745
Joined: Mon Jul 21, 2008 7:38 pm

Post by Mrugnak »

Dedric wrote:I'm breaking my skull with a critical hit setup.

What I'm trying to do.
Roll a 1d20+StrBonus+EnhancementBonus+LevelBonus

Check to see if the 1d20 is a critical hit (20)

If true: CriticalHit
Show the roll in full and MaxDamage1(stored in properties) after a line break.
If False
Show the roll in full and Weapon1Damage.(stored in properties) after a line break.
Try this:

Code: Select all

<!-- [DieRoll = 1d20]  -->
[Result=Dieroll+StrBonus+EnhancementBonus+LevelBonus]<br>
[if(DieRoll>19,eval(MaxDamage1),eval(Weapon1Damage))]

Post Reply

Return to “User Creations”