BASIC MACROS FOR NOOBS..no, for real..BASIC macros

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
emirikol
Dragon
Posts: 708
Joined: Sun Jan 13, 2008 5:52 pm
Location: Lakewood, CO North America
Contact:

BASIC MACROS FOR NOOBS..no, for real..BASIC macros

Post by emirikol »

Here are some BASIC macros for those of you who do not want to become computer programmers:

I've put both types here:
1) No math shown...use { }
2) If your DM requires that Math be shown..use [ ]

* You can replace "mod" with your actual bonus instead of having to type it in.


INITIATIVE MACROS
=============================
Initiative: {d20+mod}
=============================
Initiative: [d20+mod]
==============================


BASIC MELEE ATTACK MACROS
==============================
Basic Melee Attack
<p>
To Hit: {d20+mod}
<p>
Damage if Hit: {d8 + mod}
==============================
Basic Melee Attack
<p>
To Hit: [d20+mod]
<p>
D8 Damage if Hit: [d8 + mod]
==============================

SKILL CHECK MACROS
==============================
Skill check: {d20+mod}
==============================
Skill check: [d20+mod]
==============================



Jay H
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com

User avatar
Stitched
Dragon
Posts: 274
Joined: Fri Jul 11, 2008 5:56 am
Location: Uppsala, Sweden

Post by Stitched »

Hey man,

Thanks for this. While I understand how to code and have written tools (see Character Tools forum) I prefer to simplify wherever possible.

Cheers!

/Stitched

User avatar
crowdosi
Kobold
Posts: 5
Joined: Sun Aug 10, 2008 5:20 am
Location: 60 mile south of Chicago

Post by crowdosi »

Thanks! A good idea, I reckon.
"Your end is written, man-things. You are already dead." - Merlokrep, the kobold king

Big_Mac
Dragon
Posts: 631
Joined: Thu Aug 17, 2006 10:37 am
Location: Brockton, MA
Contact:

Post by Big_Mac »

Wow, Now I understand. Somewhere along the way I missed the purpose of the curly braces.

Thanks emirikol
--
Big Mac

greyscale1
Kobold
Posts: 9
Joined: Wed Aug 06, 2008 12:51 am

Post by greyscale1 »

These have been really helpful, could you show how to do the most basic 'if -> then' type of functions?

I want to make my saving throw thing say PASS or FAIL automatically.

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 »

greyscale1 wrote:These have been really helpful, could you show how to do the most basic 'if -> then' type of functions?

I want to make my saving throw thing say PASS or FAIL automatically.
The first thing to realize is that if statements in Maptool ARE NOT the if/then statements people are used to seeing when programming.

example of what they are NOT

If color = green then
sprinklers = Turn Off
Lawn Mower = On

example of what they ARE

If sun = up then
Daytime = Yes
If sun ≠ then
Daytime = No

so, quick example for a simple pass/fail. This example will assume you want to roll the target number or LOWER using 3d6.

[Check = if (3d6 <= Target, 1, 0)][if(Check,"Pass","Fail")]

The first block asks the user (GM/player) for the Target number and if 3d6 is less than or equal to Target, Check = 1. If it is greater than Target then Check = 0.

The second block looks at Check if it is True (equal to 1)—note that I could also have written that as [if(Check = 1,"Pass","Fail")]—then it writes Pass, otherwise it writes Fail. Note that the output is very ugly.
« Check = if (3d6 = Target, 1, 0) = Check = 1 = 1 »« if(Check,"Pass","Fail") = Pass »
To make this macro a little nicer I would do this:

<!--[DRoll = 3d6][Check = if (DRoll <= Target, 1, 0)]-->You rolled {DRoll}, you {if(Check,"Pass","Fail")}.
You rolled 12, you Pass.
(Note, rolled against 14)
Now the HTML comments tags <!-- --> hide the ugliness. If you have questions about the pretty version, feel free to ask.

EDIT

We could take this one level further and show what the Target value was as well.

<!--[DRoll = 3d6][Target = Target][Check = if (DRoll <= Target, 1, 0)]-->You rolled {DRoll} against a target of {Target}, you {if(Check,"Pass","Fail")}.

Now we get
You rolled 14 against a target of 14, you Pass.
Notice that I had to add [Target = Target] for this to work. If I did not add that block, then Maptool would have asked for Target like it did before but would have ALSO asked for it in the {Target} block. Using [Target = Target] makes the value "stick" for the entire macro instead of for just the one block.
Last edited by Naryt on Wed Aug 13, 2008 4:17 pm, edited 2 times in total.
A wandering lost soul

User avatar
Xyll
Cave Troll
Posts: 30
Joined: Tue Jul 08, 2008 11:50 am

Post by Xyll »

Please explain more "common" elements that anyone should know :wink:

Thanks this is really helpful to me as I am not a programmer what so ever.

Like for example how do you make a random variable listed in the properties/stats work in a macro.

Melee Damage (MD)= 1d8
Damage bonus (DB)= +3

Damage= MD + DB
:D

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 »

You can use macros to set properties on a token.

IMPORTANT To change token properties, you MUST do one of two things: Impersonate the token to be changed OR select the token(s) to be changed, RIGHT CLICK the macro button and use Run For Each Selected. The nice thing about using the Run For Each Selected option is that we can modify a large number of tokens at once.

Assume that you have a token property called HP and you want a macro that allows you to apply damage to the token without having to edit the token. Also assume that the original value of HP is 10. We'll also store that value in a token property called MaxHP; so:

HP = 10
MaxHP = 10

The most basic HP macro would look like this:

Code: Select all

[HP = HP - Damage]
When this macro is run, Maptool prompts for the value of Damage. In the example below, 5 points of damage were done.
« HP = HP - Damage = HP = (10 - 5) = 5 »
Now the token's HP is set to 5 and we have ugly output again. We'll deal with that in a moment.

We can also make a "Healing" macro:

Code: Select all

[HP = HP + Healing]
Heal 5 points:
« HP = HP + Healing = HP = (5 + 5) = 10 »
Now for a little macro fun! Our Healing macro would let us heal this token up to 5,000,000 HP without even batting an eye EXCEPT that we are going to make it stop at our MaxHP value (10 in this case). We will use the min(x,y) function to fix this. Our token will now only be able to be healed up to the minimum of MaxHP or whatever healing it receives.

Code: Select all

[HP = min(MaxHP, HP + Healing)]
OK we'll assume that 5 points of damage have already been done and then our zealous cleric does 15 points of Healing. Here's what we get:
« HP = min(MaxHP, HP + Healing) = HP = min(10, 5 + 15) = 10 »
Notice that MaxHP is automatically replaced by 10 from the token's MaxHP property. Min then calculates 5+15 which is 20 and decides which is the minimum 10 or 20.

If we had used 3 instead of 15, we would get:
« HP = min(MaxHP, HP + Healing) = HP = min(10, 5 + 3) = 8 »
It's the identical process as above but now min is checking for which is the lowest 10 or 5+3.

Finally, let's use a new variable, OldHP, to help us pretty up the macro:

Code: Select all

<!--
[OldHP = HP]
[Healing = Healing]
[HP = min(MaxHP, HP + Healing)]
-->
HP was {OldHP} and is now {HP} after receiving {Healing} points of healing.
The first line is an HTML comment used to hide the uglies.
The second line stores the value of HP BEFORE healing in OldHP.
The third line asks the user for the value of Healing.
The fourth line figures the new value of HP AFTER healing.
The fifth line closes the HTML comment.
The final line uses { } to tell us the values of OldHP, HP and Healing.
{Note in version b39 all of this needs to be on one line to avoid ugly spacing issues. The development version allows you to use line breaks as above without worrying about the blank space.}

Put it all in a macro button we get something like
HP was 2 and is now 9 after receiving 7 points of healing.
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 »

Xyll wrote:Like for example how do you make a random variable listed in the properties/stats work in a macro.

Melee Damage (MD)= 1d8
Damage bonus (DB)= +3

Damage= MD + DB
:D
Impersonate the token or select it and use Run For Each Selected from the macro button's context menu and then:

[Damage = eval(MD) + DB]

Note that the 1d8 is stored as a string. Using eval() tells the macro to EVALuate the string as if it were a function.
A wandering lost soul

User avatar
emirikol
Dragon
Posts: 708
Joined: Sun Jan 13, 2008 5:52 pm
Location: Lakewood, CO North America
Contact:

Post by emirikol »

Whew. The term "basic" just went out the window as soon as we start referencing tables and properties. :)

jh
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com

User avatar
Brigand
Read-only User
Posts: 1623
Joined: Thu Feb 14, 2008 8:57 am
Location: Nosy GM's can go frak themselves!

Post by Brigand »

Yeah, I was going to say that...

Leave the STP commands and tables out of this thread please. This is for BASIC macro's. Like this one for DM's:

/e <hr><center><font size=4><b>[Round]</b></font></center>

That's it. It will ask for a round number and then output it as:

<< Round => 1 >>

It will have a horizontal line above it and display the round number in an eye catching size, but not too big.

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 »

emirikol wrote:Whew. The term "basic" just went out the window as soon as we start referencing tables and properties. :)

jh
I disagree [HP= HP - Damage] is quite basic, references a property and is the basis for my first post above. BUT it's your thread. My PM box is still open for those wanting continued tutorials from me.
A wandering lost soul

User avatar
emirikol
Dragon
Posts: 708
Joined: Sun Jan 13, 2008 5:52 pm
Location: Lakewood, CO North America
Contact:

Post by emirikol »

I did have a guy use that one with success last night during the demo (before my ISP crashed) :) Feel free to post what you want. We're all just trying to help each other until we have some basic documentation again :)

jh
Last edited by emirikol on Wed Aug 13, 2008 6:50 pm, edited 1 time in total.
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com

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 »

emirikol wrote:I did have a guy use that one with success last night during the demo (before my ISP crashed) :)

jh
I actually wanted to pop into your demo just to lurk...how did it go...Wait, I'll ask that again over in your Demo thread so as not to derail this one.
A wandering lost soul

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

Post by Dedric »

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}

Post Reply

Return to “User Creations”