if statement / help with a macro

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
fantasmamore
Kobold
Posts: 5
Joined: Fri Dec 20, 2013 9:40 am

if statement / help with a macro

Post by fantasmamore »

Hello all!

I am a total newbie in programming, so what I ask may be already somewhere and I can't find it because I don't know how to search for it. I apologise in advance.

I want to write an attack for a monster in 13th Age system. The attack is a macro related to the specific token.
<p><strong>Mandibles</strong></p>
<p>[1d20+5] vs. AC / <strong>[3] damage.</strong></p>
<p>Natural 16+: The target also takes [1d3] ongoing acid damage.</p>

I don't want to auto-calculate if the attack succeeds or anything that advanced, I just want the macro to look at 1d20 result (without the modifier) and then if it's 16 or bigger to show me the last line.

As I understand it (after like two hours of studying the wiki and that's my entire career as a developer) I have to name "1d20" somewhat and then tell the system that if "x" is bigger than 15 then show"<p>Natural 16+: The target also takes [1d3] ongoing acid damage.</p>"

Could you help me?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: if statement / help with a macro

Post by wolph42 »

well, you were on the right track:

Code: Select all

[h:result    = 1d20]
<p><strong>Mandibles</strong></p>
<p>[result+5] vs. AC / <strong>[3] damage.</strong></p>
[r,if(result > 15), code:{
    <p>Natural 16+: The target also takes [1d3] ongoing acid damage.</p>
}] 
UNTESTED

fantasmamore
Kobold
Posts: 5
Joined: Fri Dec 20, 2013 9:40 am

Re: if statement / help with a macro

Post by fantasmamore »

You are amazing! Thank you very very much!

Post Reply

Return to “Macros”