RPTools.net

Discussion and Support

Skip to content

It is currently Tue Sep 16, 2014 4:40 am 






Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Dragon
 
Joined: Sun Jan 13, 2008 5:52 pm
Posts: 859
Location: Lakewood, CO north america
 Post subject: BASIC MACROS FOR NOOBS..no, for real..BASIC macros
PostPosted: Mon Aug 11, 2008 11:59 pm 
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

_________________
Maptool Stuff: http://gallery.rptools.net/v/contrib/emirikol7/
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Jul 11, 2008 4:56 am
Posts: 305
Location: Uppsala, Sweden
 Post subject:
PostPosted: Tue Aug 12, 2008 2:34 am 
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


Top
 Profile  
 
User avatar  Offline
Kobold
 
Joined: Sun Aug 10, 2008 4:20 am
Posts: 5
Location: 60 mile south of Chicago
 Post subject:
PostPosted: Tue Aug 12, 2008 3:31 am 
Thanks! A good idea, I reckon.

_________________
"Your end is written, man-things. You are already dead." - Merlokrep, the kobold king


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Thu Aug 17, 2006 9:37 am
Posts: 627
Location: Brockton, MA
 Post subject:
PostPosted: Tue Aug 12, 2008 8:04 am 
Wow, Now I understand. Somewhere along the way I missed the purpose of the curly braces.

Thanks emirikol

_________________
--
Big Mac


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Aug 05, 2008 11:51 pm
Posts: 12
 Post subject:
PostPosted: Wed Aug 13, 2008 12:43 am 
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.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Oct 26, 2007 7:55 am
Posts: 523
Location: Near a tree, in a cave, under a rock.
 Post subject:
PostPosted: Wed Aug 13, 2008 7:51 am 
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.

Quote:
« 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")}.

Quote:
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
Quote:
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.

_________________
A wandering lost soul


Last edited by Naryt on Wed Aug 13, 2008 3:17 pm, edited 2 times in total.

Top
 Profile  
 
User avatar  Offline
Cave Troll
 
Joined: Tue Jul 08, 2008 10:50 am
Posts: 30
 Post subject:
PostPosted: Wed Aug 13, 2008 3:12 pm 
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


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Oct 26, 2007 7:55 am
Posts: 523
Location: Near a tree, in a cave, under a rock.
 Post subject:
PostPosted: Wed Aug 13, 2008 3:53 pm 
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:
[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.
Quote:
« 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:
[HP = HP + Healing]
Heal 5 points:
Quote:
« 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:
[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:
Quote:
« 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:
Quote:
« 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:
<!--
[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
Quote:
HP was 2 and is now 9 after receiving 7 points of healing.

_________________
A wandering lost soul


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Oct 26, 2007 7:55 am
Posts: 523
Location: Near a tree, in a cave, under a rock.
 Post subject:
PostPosted: Wed Aug 13, 2008 3:55 pm 
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


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Jan 13, 2008 5:52 pm
Posts: 859
Location: Lakewood, CO north america
 Post subject:
PostPosted: Wed Aug 13, 2008 4:05 pm 
Whew. The term "basic" just went out the window as soon as we start referencing tables and properties. :)

jh

_________________
Maptool Stuff: http://gallery.rptools.net/v/contrib/emirikol7/
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com


Top
 Profile  
 
User avatar  Offline
Read-only User
 
Joined: Thu Feb 14, 2008 8:57 am
Posts: 1742
Location: Nosy GM's can go frak themselves!
 Post subject:
PostPosted: Wed Aug 13, 2008 4:20 pm 
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.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Oct 26, 2007 7:55 am
Posts: 523
Location: Near a tree, in a cave, under a rock.
 Post subject:
PostPosted: Wed Aug 13, 2008 4:23 pm 
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


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Jan 13, 2008 5:52 pm
Posts: 859
Location: Lakewood, CO north america
 Post subject:
PostPosted: Wed Aug 13, 2008 4:59 pm 
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

_________________
Maptool Stuff: http://gallery.rptools.net/v/contrib/emirikol7/
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com


Last edited by emirikol on Wed Aug 13, 2008 5:50 pm, edited 1 time in total.

Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Oct 26, 2007 7:55 am
Posts: 523
Location: Near a tree, in a cave, under a rock.
 Post subject:
PostPosted: Wed Aug 13, 2008 5:01 pm 
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


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Fri Jul 04, 2008 12:31 pm
Posts: 41
 Post subject:
PostPosted: Wed Aug 13, 2008 9:22 pm 
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}


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

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 is 1 user online :: 0 registered, 0 hidden and 1 guest (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 1 guest





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman