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

"If roll < spell level, X happens"

I know the title reads like a math problem, but it is much simpler - i'm just stupid and bad with words, so i'll explain around it: I want a macro that 1) asks the player to input a number (what level of spell they just casted), 2) rolls 1d10 and checks whether the roll is lower than the number it asked for, and 3) prompts a text message if 2 is true. Example: Player A casts a level 3 spell, clicks the macro, chooses "3", the macro rolls 5 on a d10, everything is fine, nothing else happens. Player B casts a level 5 spell, clicks the macro, chooses "5", the macro rolls a 2 on the d10, a message about "something ominous happens..." appears in the chat. So far i figured out how to get 1 and 2 working, but i have no idea about 3. I used&nbsp;[[ 1d10&lt;[[?{Spell Level |1|2|3|4|5}]] ]] for this, but i haven't got a clue as to how to go on from that point. Help is much appreciated, thanks in advance!
1585003643

Edited 1585003726
Ziechael
Forum Champion
Sheet Author
API Scripter
You are off to a good start, to get the desired output you'll need to utilise some rollable tables. One called 0 and one called 1. When you run your macro you should get a 0 or 1 output for the success so what you can do is run this macro: [[ 1t[ [[ 1d10&lt;[[?{Spell Level |1|2|3|4|5}]] ]] ] ]] With the tables having entries with your desired text in them you will get an output based on those tables instead of the basic numerical options.
1585035020

Edited 1585037732
Ziechael said: You are off to a good start, to get the desired output you'll need to utilise some rollable tables. It seems like tables are the answer to all of these questions 99% of the time, yet i didn’t think of this solution. Thanks a lot, i‘ll try that! Edit: It works for what i asked for, yet it looks a bit ugly, although this is fine and functional, so i'm not complaining here! From googling around a bit i suppose there isn't any way of putting a /em command or any other formatted text (not even another macro) into a rollable table item, is there...?
1585040548

Edited 1585040646
Ziechael
Forum Champion
Sheet Author
API Scripter
Nope... BUT you can put the table item into an /em command ;) /em Bob casts a spell and [[ 1t[[[ 1d10&lt;[[?{Spell Level |1|2|3|4|5}]] ]]] ]] With the results being something that would nicely finish that sentence. It'll still be a bit ugly, thats just the nature of an inline table result but it'll have some nice context and stand out in the chat log.
I thought of that, but it still gives that yellow background to the table part of the text... ah well, form follows function, as long as it works (which it does, thanks again!) its look isn't that important. Thanks for your time!