Page 3 of 4

Posted: Wed Aug 27, 2008 8:10 pm
by Mr. Pokeylope
Okay, well, as it stands there is code that tries to do the replacement but it's slightly wrong, so it doesn't work. I'm fine with it not doing it, it just looks like its supposed to.

Posted: Wed Aug 27, 2008 10:49 pm
by Norwolf
This might be useful to someone... I like files :)

http://gallery.rptools.net/v/contrib/No ... l.pdf.html

Posted: Fri Aug 29, 2008 2:44 pm
by Plissken
Are nested if statements possible?

Posted: Fri Aug 29, 2008 3:59 pm
by knizia.fan
Plissken wrote:Are nested if statements possible?
Yes, they are. For example, here's a way to convert a number from 1-3 into the matching ordinal number.

Code: Select all

[h: Num = Enter_Your_Number]
[if(Num==1, "first", if(Num==2, "second", if(Num==3, "third", "Number too big!")))]
You can carry on embedding if() functions like that until you get bored, or until your code becomes an unreadable black hole :)

Posted: Sat Sep 06, 2008 2:24 pm
by FdL
I love this macro in the explanation, it's what I was looking for to use in maptool.

But I see it doesn't work unless you make it as a token macro.

I'd prefer to have it as a campaign macro, for me to use with any token I select at that time.

I think it would require some major tweaking along the lines of using setting and reading token properties, but I haven't been able to do that succesfully (I'm new to scripting).

What I mean is so that I don't have to manually enter the macro in each token I make. I see there's no way to default this.

Also I'd prefer to have separate "Heal" and "Hurt" buttons.

Any pointers as to how to do these?

Edit: It makes a lot more sense to me to have positive numbers entered be interpreted as Healing, where negative ones would Hurt. It's more intuitive.

So I tweaked it into this (I don't use TempHP for now):

(hmm, can't post Code correctly, this eats some lines where I use color format)

Anyway, what I changed was pretty basic. Now positive numbers heal, negative numbers hurt.

Posted: Sun Sep 07, 2008 2:33 am
by Lindharin
FdL wrote:But I see it doesn't work unless you make it as a token macro. I'd prefer to have it as a campaign macro, for me to use with any token I select at that time.
You can do this now, though it is slightly annoying. Put the macro in a campaign button. Then select the token or tokens. Then RIGHT CLICK on the campaign macro button and in the pop-up context menu choose the option "Run as each selected". That will loop through all the selected tokens and run the macro as if it were a token macro. It is a little annoying but feasible. CAVEAT: Be VERY careful! The option right next to "Run as each selected" is DELETE, if I recall correctly. I've deleted a number of campaign macros by mistake by misplacing my mouse when I was trying to click on "Run as each selected."

In the next release, b42, this will no longer be necessary. There will be a new checkbox on the campaign and global macro config panels that will let you automatically apply the macro to selected tokens. If you check that checkbox, then you can just normally click the button and it will do the exact same thing as the current "Run as each selected".

Posted: Sun Sep 07, 2008 2:08 pm
by FdL
That sounds awesome. I'll be waiting for b42! Thanks!

Posted: Fri Sep 26, 2008 3:46 pm
by Crunchem
Just wanted to give props to the author of this. I spent waaay too many hours trying to parse macros to figure it out, and this has saved me a whole lot of time.

Thanks again!

Posted: Wed Oct 01, 2008 4:09 pm
by fuleng6021
Hello
I discovered maptool some time ago and also i had some difficulties inthe beginning now it seams at most is working. I also started to use macros. with them i have a problem, which is maybe too simple, but i did not find anyt solution on the forum.
a macro in [] like the one in the tutorial

Simple HTML example:
Code:
<b>Initiative roll:</b>
<br>My initiative is <span>[1d20+3]</span>.

should be output in the chat as:
Image

but my output only shows the
My initiative is = "final sum"
the only differents to a code with {} is the light blue backround.

Did i set some basic properties wrong or why is my [] macro output like the {}?

Posted: Wed Oct 01, 2008 4:21 pm
by the_meek
The rolls were changed somewhat a few builds back. If you mouseover your shaded output in the chat window, you'll get a tooltip showing the expanded roll. If you want the roll expanded in chat, you need to specify that in the roll, like this:

<b>Initiative Roll:</b><br>
My initiative is [E: 1d20+3].

to get:

Initiative Roll:
My initiative is « d20+3 = 13 + 3 = 16 ».

Posted: Wed Oct 01, 2008 7:04 pm
by FdL
I think there should be an option to set the default mode of display for rolls to solve that. I mean, it's hard for me as a DM to tell when the roll was a critical.

But anyway, I wanted some basic help or links to threads where I can learn to manipulate the health bar with scripts like the "Heal/Hurt" one I got.

Edit:

For criticals this seems to work (as pointed here http://forums.rptools.net/viewtopic.php?p=62405#62405)

My example application of this:

Code: Select all

[h: myroll=d20]

<b><span>Heavy Mace: [if(myroll>=threatrange, 'CRITICAL', myroll+5)]</span></b>, damage: <b><span>[1d8+1]</b></span>
This has the disadvantage that I can't get to see the result of the roll, nor I can add the bonus to it. I just tried this, I'm not great at scripting so it should be something dumb I'm not doing. (I don't remember how to output the roll AND a bit of text together for example :s I tried [something] & "text" but doesn't work)

Posted: Thu Oct 02, 2008 12:27 am
by fuleng6021
the_meek wrote:The rolls were changed somewhat a few builds back. If you mouseover your shaded output in the chat window, you'll get a tooltip showing the expanded roll. If you want the roll expanded in chat, you need to specify that in the roll, like this:

<b>Initiative Roll:</b><br>
My initiative is [E: 1d20+3].

to get:

Initiative Roll:
My initiative is « d20+3 = 13 + 3 = 16 ».
Thank you

Posted: Fri Nov 28, 2008 9:26 pm
by Mr_Rose
FdL wrote:I think there should be an option to set the default mode of display for rolls to solve that. I mean, it's hard for me as a DM to tell when the roll was a critical.

But anyway, I wanted some basic help or links to threads where I can learn to manipulate the health bar with scripts like the "Heal/Hurt" one I got.

Edit:

For criticals this seems to work (as pointed here *no linky for a poor n00b*)

My example application of this:

Code: Select all

[h: myroll=d20]

<b><span>Heavy Mace: [if(myroll>=threatrange, 'CRITICAL', myroll+5)]</span></b>, damage: <b><span>[1d8+1]</b></span>
This has the disadvantage that I can't get to see the result of the roll, nor I can add the bonus to it. I just tried this, I'm not great at scripting so it should be something dumb I'm not doing. (I don't remember how to output the roll AND a bit of text together for example :s I tried [something] & "text" but doesn't work)
So, I've been looking to create something like this, then I spot your work here and am inspired:
I still can't get the "if()" statement to take combinations of dicerolls easily, but it will accept variables as arguments.
The following seems to get most of the way there, but I am still new to maptool and macros in general, so it probably needs some refinement.

Code: Select all

[h: critbonus=d6]
[h: mydamage=d10+1]
[h: roll=d20]
<b>Longbow +1:</b> [myroll=roll+9] [if(roll>=20, 'CRITICAL HIT! Deals 11 damage +' +critbonus , 'damage:' +mydamage )]
This shows what you rolled (unexpanded unfortunately) and tells you the weapon's max damage plus any bonus it gets from crits (for being magic etc.) on a critical roll, or just rolls damage if it's a non-crit.

I expect that a lot of the variables could be altered to include token properties too...

Hope this helps.

Re: A (long) MapTool macro tutorial

Posted: Tue Dec 16, 2008 7:33 pm
by Lyve1
I have a question. I notice that when you mouse over the calculation results of a macro that is set in a field in the token properties menu. The results of the calculation are show in edition to the numbers added together. I realize that simply mousing over the single digit number will briefly display the same calculation so it seems kinda redundant to have it all display in the chat window. I simply want to see My attack rolls end results and damage displayed. Not necessarily the entire calculation.

How can I code my macro ...say my wp damage [1d8]+ whatever code is in my macro for the given ability combat bonuses ect... in my token property so it doesn't display the entire calculation in the chat window?

Re: A (long) MapTool macro tutorial

Posted: Tue Dec 16, 2008 9:18 pm
by ddrewitz
i believe you have to put the ! before and after the code to not print it.