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 .
×

Using T/F result as Query Variable?

I'm attempting to make a macro that makes an appraise check, compares it to a DC, and then outputs the value the PC thinks the item they've just appraised is. In general, 3.5 rules state that on a failed appraise check the PC believes the item is worth (2d6+3) x 10% of the actual value. (Meaning anywhere from 50% to 150% of actual value). It's, in theory, a simple enough if/then type problem. If only Roll20 used that kind of syntax. Anyway! I've got three parts to the macro. I just can't figure out how to combine them into something that actually works. The first bit is pretty straightforward. Whisper to selected player and a query to say what the item being appraised is. Works as expected. /w @{selected|character_name} You believe the ?{Item} to be worth Next, the check itself versus the DC. Makes a check based on the selected character's appraise skill and compares it to the DC, as chosen by selecting the item's "rarity." If the check is less than the DC, it returns a value of 0. If the check is equal to, or greater than, the DC, it returns a value of 1. [[{ 1d20 + @{selected|appraise} }>?{Rarity|Common,12|Uncommon,15|Rare,20|Exotic,25}]] I did try playing around with using roll tables, and while I can get this part to call on different tables, the table results only show up as text, and don't seem to be able to be used as an inline roll/calculation. As you can see in the above picture, the roll table simply types out the formula instead of actually running it. Which leads to the final part. I've made it a drop-down query for the time being, allowing me to manually select "fail" or "success." But what I need/want is to have it reference the previous bit of macro/the skill check vs DC, and then output either [[ [[2d6+3]] * 0.10]] or 1 based on that. (As that number is then multiplied by the value to give us the "appraised value") [[ ?{Value} * [[ ?{Check|Fail,[[ [[2d6+3]] * 0.10]]|Success,1} ]] ]] Thoughts, comments, and/or suggestions?
As you noted the macro syntax doesn't support if/then functionality. However this can be handled mathematically. Instead of choosing between 1 and a random value 0.5 to 1.5 you can start with 1 but then add a value from -0.5 to 0.5. On success that random value can be multiplied by 0 giving a total of 1. On failure that random value can be multiplied by 1 giving a total of 0.5 to 1.5. Thus the macro [[ ?{Value} * (1+0.10*(2d6-7)*{1-({ 1d20 + @{selected|appraise} }>?{Rarity|Common,12|Uncommon,15|Rare,20|Exotic,25})}) ]] You may want an extra layer of [[ ]] to hide the calculation from your players.
RainbowEncoder said: As you noted the macro syntax doesn't support if/then functionality. However this can be handled mathematically. Instead of choosing between 1 and a random value 0.5 to 1.5 you can start with 1 but then add a value from -0.5 to 0.5. Thank you so much! Knew there was a way to do this :) The macro you gave didn't quite work. Not sure why. The first bit is the code as is, the [[9] is what I get by adding another layer of brackets to it. Weirdness. But it was just what I needed! My final macro ended up being: /w @{selected|character_name} You believe the ?{Item} to be worth [[ [[ ?{Value} * [[1 + [[0.10 * (2d6-7) * [[{ 1d20 + @{selected|appraise} }<?{Rarity|Common,11|Uncommon,14|Rare,19|Exotic,24}]] ]] ]] ]] ]] gp Works a treat! All calculations are hidden from the player too :)
Dungeon M. said: Thank you so much! Knew there was a way to do this :) You're welcome The macro you gave didn't quite work. Not sure why. The first bit is the code as is, the [[9] is what I get by adding another layer of brackets to it. Weirdness. You appear to have cut-off the final ] so it wasn't rolling properly. But you got it working and that's what counts.
1683154015
Andrew R.
Pro
Sheet Author
Dungeon M. said: I'm attempting to make a macro that makes an appraise check, compares it to a DC, and then outputs the value the PC thinks the item they've just appraised is.  Thoughts, comments, and/or suggestions? Since you are a Pro subscriber, I suggest you install ScriptCards and write your macro as a ScriptCards script. It has all the conditionals and control flow that you need.