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

Skill Macro

1585057255

Edited 1585057334
Hi, i'm only just starting with roll20 and need some help with a macro. Our group is using the Mythras 2.7 character sheet and I want to set up a roll query where the user inputs the skill name and difficulty in this format: evade or evade_easy or evade_hard and so on to match the attributes. The output I want is 74   against evade_hard  of 80 Here is what I have so far: /r [[1d100]] against ?{skillName_difficulty} of @{tokenName|{?{skillName_difficulty}} I get the response before I've input the variable that tokenName has no attribute ?{skillName_difficulty} I feel I'm very close...
1585085114
GiGs
Pro
Sheet Author
API Scripter
This syntax: @{tokenName|{?{skillName_difficulty}} doesnt work on roll20. Also tokenName isnt valid, unless your token is actually called tokenName. If you want to do something like that, you;d have to do a complex query, that looked something like this: /r [[1d100]] against ?{difficulty| Athletics,Athletics of @{selected|Athletics}| Dodge,Dodge of @{selected|Dodge}| Willpower,Willpower of @{selected|Willpower}} After the | you put each option.  The first part, before the comma, is what gets displayed to the user in the dropdown. The part after the comma, is what the script actually prints to chat. For this particular version, you need to have a token selected when you use it. If you want to hardcode it to a character named Frodo, you can use their name /r [[1d100]] against ?{difficulty| Athletics,Athletics of @{Frodo|Athletics}| Dodge,Dodge of @{Frodo|Dodge}| Willpower,Willpower of @{Frodo|Willpower}}
1585100327

Edited 1585100577
Hi GiGs, Thanks very much for that. The plan was to have the macro as a token action, but it would be easier to make it a general action and have the target 'selected'. tokenName was just a variable I concocted for the example, I realise I would need to type the actual token name. Likewise, skillName_difficulty is also just a variable name for the example though it does follow the syntax of the character sheet attributes, e.g. a player running the macro would input "evade" for a standard roll or "evade_easy" for an easy roll and so on. The modified skill values are calculated via coding based on the parent skill, in this example, evade. Does this help explain what I'm trying to do and would your examples above still work?
1585101084
GiGs
Pro
Sheet Author
API Scripter
If you make them token actions, this macro i provided (using selected, with corrected skill names) would work for every character. That's probably the best approach. You have to use the full call for each attribute (eg @{selected|skill-name} - you cant build them from parts in macros. There's no way to do, for instance, @{?{charactername}|?{skillname}}. This is because of the macro order of operations. when you launch a mcro, here's the order these things happen: roll20 looks through the macro, sees attribute references and looks them up, and replaces them with the found value everywhere they appear in the macro. roll20 now does queries, asks the user for their pick, and then replaces the query with the resulting value. With this syntax @{tokenName|{?{skillName_difficulty}} roll20 first  tries to find an attribute named @{tokenName|{?{skillName_difficulty}}, then tries to do the query ?{skillName_difficulty}. Obviously this will always fail, because the query needs to be done first, and roll20 doesnt do them in that order. Back to your question, if hard, easy, etc are standard difficulty modifiers, what you could do is something like this /r [[1d100]] against [[?{difficulty| Athletics,Athletics of @{Frodo|Athletics}| Dodge,Dodge of @{Frodo|Dodge}| Willpower,Willpower of @{Frodo|Willpower}} + (?{Difficulty| Easy,20| Standard,0| Hard,-20}) ]] The user would be prompted twice - to choose a skill and a difficulty, and it would then show the actual number.
Thank you very much GiGs for your help and detailed explanation, that makes sense to me now. I'll give that a shot using the simplified skill grades which are straight addition & subtraction. Trying to use the standard ones would be too hard as they're a multiplication, i.e. x 1.5 or x 0.666 with fractions rounded up.
1585113249
GiGs
Pro
Sheet Author
API Scripter
You can do rounding in roll20 macros. Enclose the calculation insider round(), so the above would be /r [[1d100]] against ?{difficulty| Athletics,Athletics of [[round(@{Frodo|Athletics}| Dodge,Dodge of [[round(@{Frodo|Dodge}| Willpower,Willpower of [[round(@{Frodo|Willpower}} * ?{Difficulty| Easy,1.2| Standard,1| Hard,0.8}) ]] By the way, in my previous post I put the opening [[ in the wrong place. See above for where it should be.
Mate, thank you very much for your help. I just realised that the character sheet is far more advanced than I thought (I didn’t see the multiple tabs!) and worked just fine with minimal tinkering.
1585124987
GiGs
Pro
Sheet Author
API Scripter
It is much easier when the sheet does it for you :)