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

A little help with roll queries

Hello, I've never set up a roll query by myself so I need a bit of help with this. I've installed the Random Hoard Generator Script, so I have to write !mtt # in the chat window (where # is a number that represents the challenge level) to get a random hoard table. I'd like to do so with a simple roll query that asks me for the level to input through a dropdown menu. Can you give me a tip to understand how it works? I know is very simple, but this is my very first time. Thanks!
1493044172
The Aaron
Pro
API Scripter
Yup!  It runs in 2 basic formats.  The whole of ?{...} will be replaced by the value of the query.  In both cases, a unique label is only queried once, then all instances with the same label are replaced with the value from the first query (more on that later). Free text (possibly with default) ?{<label>|<optional default text>} Example: ?{What should I say} Will give you an empty box with the prompt "What should I say?". Example: ?{What should I say|Death to rogues!} Will give you the same box as above, but will have the text "Death to rogues!" pre-populated in it. Drop Down  ?{<label>|<option <name,value>>|<option <name,value>>|...} In this case, the part after the | (when you have 2 or more | ) will each be a selection in a drop down: Example: ?{What CR Encounter|1|2|3|4|5|6|7|8|9} Will give you a dropdown with the values 1-9, with 1 selected. Example: ?{Modifiers|Level Ground,+0|High Ground,+2|Low Ground,-2} Will give you a drop down with Level Ground, High Ground, Low Ground in it, but will be replaced with +0,+2,-2 respectively. Using the Same Label You can use the same label multiple times to use the result in multiple places: [[1d20?{Modifiers|Level Ground,+0|High Ground,+2|Low Ground,-2}]] | [[1d20??{Modifiers}]] Will prompt the user for what the Modifiers are, but then apply them to 2 rolls.  You only need the | part on the first one, which makes it much cleaner.
1493044413

Edited 1493044442
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sure thing. Roll queries are made up of two parts: The prompt and the options. The prompt is separated from the options by a bar and options are separated from each other by bars as well. The roll query ends at the first } that it runs into. If one or fewer options are provided, the query will be a free text entry (defaulting to the single option if provided or 0 if not: ?{Prompt|option 1|option 2|option 3|...|option N} Options can further be divided into two subgroups; option name and option value which are separated by a comma. You can only have one value per option: ?{Prompt|option 1 name, value 1|option 2name, value 2|option 3 name, value 3|...|option N name, value N} If you use the option name/value syntax, the option name will be displayed in the drop down, but will result in the value associated with it. For your use case, a simple roll query like this should work: ?{CR|1|2|3|4|5|6|7} for a dropdown query or ?{CR} for a freetext query -Scott EDIT: Ninja'd by Aaron's much more detailed post :)
1493046022
The Aaron
Pro
API Scripter
MUHAHAHAHA!!!!
Thinks are so easy with you guys :D. So I wrote something like this:   !mtt ?{CR|0-4, 4| 5-9, 9| 10-14, 14| 15-20, 20} It seems to work. Is it possible to insert the result in a template or add some text like: "you've found..."?
1493046441
The Aaron
Pro
API Scripter
That will depend on the !mtt script.   RecursiveTable is often used for a similar purpose, which does support doing some cool formatting in the new version.
Mmmmmm need to experiment!