Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Conditional evaluation without ExtendedExpressions?

1463167267

Edited 1463168310
Is there a way to do conditional evaluation in macros without using ExtendedExpressions? i.e. if a roll is greater than 15, do x; otherwise, do y I'm not a pro user and absolutely can not become one because I simply don't have any money to spare. Yes, I realize it's not expensive; I am legitimately that poor. EDIT: Maybe it would help if I explained what I was trying to do. I'm making a Fire Emblem tabletop, and I want to make a macro for experience. However, the script varies based on what the level difference between the two units is. 20 + (LD x 3) + Character bonus [if LD >= 0] 20 + Character bonus [if LD = -1] Max[26 + (LD x 3) + Character bonus, 7] [if LD <= -2] How would I do this?
1463168624

Edited 1463168696
Silvyre
Forum Champion
Here's a way to create "budget conditional statements" (for conditionally outputting text strings; figuring out a function is often easier for purely numerical outputs): Create a few Rollable Table named something like "Result-0", "Result-1", etc. Each Rollable Table represents a different outcome; give each Table Item(s) reflecting this outcome. Conditionally roll one of the Tables via a roll expression like /r 1t[Result-[[ 1d2 - 1 ]]]], etc. (Note: needs that extra closing bracket for some reason). Leafia B. said: I'm making a Fire Emblem tabletop, and I want to make a macro for experience. However, the script varies based on what the level difference between the two units is. 20 + (LD x 3) + Character bonus [if LD >= 0] 20 + Character bonus [if LD = -1] Max[26 + (LD x 3) + Character bonus, 7] [if LD <= -2] How would I do this? Okay, since your output is purely numerical, I think we can work out a mathematical function.
1463168644
The Aaron
Pro
API Scripter
You can do something like this as a summation of terms.  The basic idea is, you calculate all of it, then use some mathy goodness to cause the terms that don't apply to become 0 and sum it all up to get the answer.  I think with more details about what attributes you're considering and how the other parts are calculated it would help others come up with the right formulas for you. Try setting out a working formula for each of the ways in which the experience value can be calculate, then note along with it under what values of which attributes that should be used.  Someone can surely help you then figure out the full expression to use to get the right value (Probably Silvyre because he's awesome at that!)
1463168656
The Aaron
Pro
API Scripter
(BWHAHAHHAAHHAAH, told ya!)
1463169229

Edited 1463169804
Silvyre
Forum Champion
The Aaron said: (BWHAHAHHAAHHAAH, told ya!) :O So, here are the tools we're going to use. From the Roll20 Wiki: 17.4 Grouped Rolls 17.5 Grouped Roll Modifiers 17.5.1 Keep / Drop khN/klN/dhN/dlN [[ {26 + (LD x 3) + Character bonus, 7}kh1 ]] covers "Max[26 + (LD x 3) + Character bonus, 7]". 17.5.2 Target Number / Successes (B,F) - CP This is the bread-and-butter of numerical "budget" conditionals, IMO. [[ {LD + d0}>0 ]] equals 1 if LD >= 0. Else, it equals 0. [[ {-1 * (LD) + d0}=1 ]] equals 1 if LD = -1. Else, it equals 0. I think that's enough to get you started with this. Let me know if you'd like a push forward!
1463170330

Edited 1463171179
Silvyre said: So, here are the tools we're going to use. From the Roll20 Wiki: 17.4 Grouped Rolls 17.5 Grouped Roll Modifiers 17.5.1 Keep / Drop khN/klN/dhN/dlN [[ {26 + (LD x 3) + Character bonus, 7}kh1 ]] covers "Max[26 + (LD x 3) + Character bonus, 7]". 17.5.2 Target Number / Successes (B,F) - CP This is the bread-and-butter of numerical "budget" conditionals, IMO. [[ {LD + d0}>0 ]] equals 1 if LD >= 0. Else, it equals 0. I think that's enough to get you started with this. Let me know if you'd like a push forward! Okay, so let me try to work this out... I meant to take the Character Bonus thing out, so I'll do that here. There are 3 cases, all of them centered around -1. [[{LD + d0}>-1 ]] * [[ 20 + (LD * 3) ]] [[{LD + d0}=-1 ]] * [[ 20 ]] [[{LD + d0}<-1 ]] * [[ {26 + (LD * 3), 7}kh1 ]] To put the whole thing together: [[ [[{LD + d0}>-1 ]] * [[ 20 + (LD * 3) ]] + [[{LD + d0}=-1 ]] * [[ 20 ]] + [[{LD + d0}<-1 ]] * [[ {26 + (LD * 3), 7}kh1 ]] ]] Is that correct? Silvyre said: Here's a way to create "budget conditional statements" (for conditionally outputting text strings; figuring out a function is often easier for purely numerical outputs): Create a few Rollable Table named something like "Result-0", "Result-1", etc. Each Rollable Table represents a different outcome; give each Table Item(s) reflecting this outcome. Conditionally roll one of the Tables via a roll expression like /r 1t[Result-[[ 1d2 - 1 ]]]], etc. (Note: needs that extra closing bracket for some reason). I'm interested in knowing more about this - it could be used to pick a random line to be displayed when getting a critical hit. How would you go about outputting a text string like this?
1463171864

Edited 1463172293
Silvyre
Forum Champion
Leafia B. said: Okay, so let me try to work this out... I meant to take the Character Bonus thing out, so I'll do that here. There are 3 cases, all of them centered around -1. [[{LD + d0}>-1 ]] * [[ 20 + (LD * 3) ]] [[{LD + d0}=-1 ]] * [[ 20 ]] [[{LD + d0}<-1 ]] * [[ {26 + (LD * 3), 7}kh1 ]] To put the whole thing together: [[ [[{LD + d0}>-1 ]] * [[ 20 + (LD * 3) ]] + [[{LD + d0}=-1 ]] * [[ 20 ]] + [[{LD + d0}<-1 ]] * [[ {26 + (LD * 3), 7}kh1 ]] ]] Is that correct? That should almost do it! Two things: Remember that {LD + d0}>0 actually means {LD + d0}>=0, etc. as Roll20 uses inequality signs inclusively. You'll just have to change stuff like {LD + d0}>-1 to {-1 * (LD) + d0}<1 etc. to avoid errors. Leafia B. said: Silvyre said: Here's a way to create "budget conditional statements" (for conditionally outputting text strings; figuring out a function is often easier for purely numerical outputs): Create a few Rollable Table named something like "Result-0", "Result-1", etc. Each Rollable Table represents a different outcome; give each Table Item(s) reflecting this outcome. Conditionally roll one of the Tables via a roll expression like /r 1t[Result-[[ 1d2 - 1 ]]]], etc. (Note: needs that extra closing bracket for some reason). I'm interested in knowing more about this - it could be used to pick a random line to be displayed when getting a critical hit. How would you go about outputting a text string like this? You could have three Rollable Tables; one for missing, one for hitting, one for critting. e.g. Attack-0, Attack-1, Attack-2, respectively. Each could use multiple Table Items for your "random lines". Then, use something like: Result: [[ 1t[Attack-[[ 1d20>20f<[[@{target|AC} - 1]] + 1 ]]]] ]] You'd need to use 3D Dice to view the exact roll result.