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

default roll template. question

1593294761

Edited 1593295983
Hello guys. Im new to roll20 and coding as well. Tried into manuals, but still, I've got several dumb questions. So, atm my final roll template code looks like: &{template:default} {{name=TEST YOUR MIGHT ?{TEST|STR|DEX|INT|CHAR|EMP} }} {{RESULT=[[ 2d6 ]] }} {{MOD= ?{TEST} }} And the attributes are   current output looks like:  what output I want to achieve : (1st question) So, when you run the roll, system asks for the attribute name to choose(str, dex, etc) ?{TEST|STR|DEX|INT|CHAR|EMP} For example, user choose str, so now variable 'TEST' contains value 'STR', right? Please, tell me how should I code to get the value from attribute 'STR' ? I've tried different ways {{MOD= ?{TEST} {{MOD= @?{TEST} {{MOD= @{?{TEST}} Hope you guys understood. Second question: The critical roll from 2d6 is 12. If it hits, system should additionally roll 1d100, so expected output looks like: How to achieve it?  Im really sorry for bad English, please help.
1593303744
GiGs
Pro
Sheet Author
API Scripter
You get attribute values like this @{STR}, if running from an ability on the character sheet. If you want to make a universal Macro, the best way is to do @{selected|STR}. Selected means that you click a token, and if the token represents a character, it will use the value of that character. That allows you to create one macro for all characters. For your query, something like this: ?{TEST| STR,@{selected|STR}| DEX,@{selected|DEX}| INT,@{selected|INT}| CHAR,@{selected|CHAR}| EMP,@{selected|EMP}} The line breaks arent necessary there, but it does make it more readable.
1593303910
GiGs
Pro
Sheet Author
API Scripter
Eugene said: Second question: The critical roll from 2d6 is 12. If it hits, system should additionally roll 1d100, so expected output looks like: How to achieve it?  Im really sorry for bad English, please help. There's no way to do conditional tests in roll20 macros. You cant have "if roll is 12, do this". You can have the roll be made all the time, and just ignore it when its not needed.