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

Ability (macro) incorporating user's Attributes

I'm trying to compose an ability that all characters can use, and vary in results depending on user's attributes. So far I saw two ways of doing that, both with it's downsides: Adding this ability for each character separately and inserting it's full code there - very problematic, since if I want to change it later on I need to go over every character using it - and since it's something everyone should be able to use, I'd need to change literally every character in the game Creating one universal ability (using prefix trick and macro character) and making abilities on other sheets just invoke it - could technically work, but since the ability would be parsed, it will use the macro character's attributes and that is not desrable I tried the second way, but it (obviously) failed. For example, let's say this was the "universal ability", named Sanity-Roll on my macro hauler sheet whose SanityPoints attribute had a value of 0: &{template:default} {{name=Sanity Roll}} {{result=[[d100<@{Macros|prefix}@{character_name}|SanityPoints}]]}} And I tried to call it from another character's (with attribute SanityPoints set to 60) sheet with another ability, whose entire content was this: %{Macros|Sanity-Roll} If the die rolled 55, it would show a failure since the result was compared against macro hauler's SanityPoints of 0 instead of character's SanityPoints of 60. Not surprising since Roll20 would parse the Sanity-Roll contents when it was called from macro hauler's sheet. I also tried making the same thing with a macro instead (that is, making Sanity-Roll a general macro instead of ability on macro hauler's sheet) but the result was similar - "u undefined", since macro was parsed immediately when calling it. What surprised me was that it even happened if I tried using backticks "`" in front of the entire ability code. Thus my question is if there's some way of making this work - that is, making a single ability or macro that will be called from other sheets in their abilities, yet still use their attributes. I already tried looking at Stupid Tricks but didn't find one which would solve such problem. As mentioned copying entire content is viable, but making changes would be a nightmare. I can provide more information on my specific case if that's needed. Also, if there's already a fix for that anywhere on the forums, feel free to point me in the right direction.
1635528763
Kraynic
Pro
Sheet Author
It sounds like you are wanting to use the macro character and chat menu tricks from the thread you mentioned.  I make extensive use of this for one game system I run, allowing me to have macro sheet for each of the various types of magics in that game system that every caster uses. The first thing that you need to be aware of is that you will have to do things a certain way for all this to work.  You will need sheets with tokens attached for every character (PC or NPC) that will be making use of these macros.  This is because you need to write all your macros using the "selected" syntax of attribute calls. Instead of @{character_name}, you would be using @{selected|character_name}.  A "selected" attribute will search for and use that attribute name from the sheet associated with the selected token. If I am understanding your macro correctly, the roll would be more like: {{result=[[d100<@{selected|SanityPoints}]]}} You may also need another set of brackets around the @{selected|SanityPoints} attribute if that attribute is ever a calculation instead of a specific number. If this is the only roll you are doing this way, you could make it part of your macros collection, and set it as a token action that is available to all players (be sure to scroll down to see that option).  If you have a bunch of rolls that will be set up this way, then you should check out the posts on chat menus and the macro characters in the tricks thread and post back if you have problems setting up your macro mule sheet and menus. 
1635529846
timmaugh
Roll20 Production Team
API Scripter
I can offer a third path. You could have a local version of the ability -- which you might normally (and normally rightly) suspect to be a nightmare to update. But with this suggestion, keeping the ability updated is fairly easy. I showed in this thread how to use InsertArg to copy abilities from one character to another. The setup would be setting up the ability on a source character (your macro hauler character), and installing InsertArg (and Plugger, if you want to do multiple ability moves in one go). As mentioned in the linked thread, InsertArg has a way to designate a source character to read an ability, and it would copy the ability to the character who was speaking the InsertArg command. If an ability of that name is detected on the destination character, the contents will be overwritten. If no ability of that name is detected, it will create one. So, imagine writing the ability on your macro hauler. Now write a macro that runs the InsertArg command to copy that ability to a local character, and share that macro with your players. Have your players run that macro one time to create the ability on their character. Later, if you ever tweak the language of the ability, have the players run the macro again and their local copy of the ability will be updated to the latest version. You could handle the messaging with DiscreteWhisper to give each player a chat button to quickly execute the update*. * - I just found an error in DiscreteWhisper I need to patch to make this work, but I have time to get that update in next week's merge.
Kraynic said: It sounds like you are wanting to use the macro character and chat menu tricks from the thread you mentioned.  I make extensive use of this for one game system I run, allowing me to have macro sheet for each of the various types of magics in that game system that every caster uses. The first thing that you need to be aware of is that you will have to do things a certain way for all this to work.  You will need sheets with tokens attached for every character (PC or NPC) that will be making use of these macros.  This is because you need to write all your macros using the "selected" syntax of attribute calls. Instead of @{character_name}, you would be using @{selected|character_name}.  A "selected" attribute will search for and use that attribute name from the sheet associated with the selected token. If I am understanding your macro correctly, the roll would be more like: {{result=[[d100<@{selected|SanityPoints}]]}} You may also need another set of brackets around the @{selected|SanityPoints} attribute if that attribute is ever a calculation instead of a specific number. If this is the only roll you are doing this way, you could make it part of your macros collection, and set it as a token action that is available to all players (be sure to scroll down to see that option).  If you have a bunch of rolls that will be set up this way, then you should check out the posts on chat menus and the macro characters in the tricks thread and post back if you have problems setting up your macro mule sheet and menus.  You understood it perfectly. I'm aware of the selected syntax since reading the community Wiki, but haven't used it until now. Sounds like a reasonable way of handling at least three of my five abilities, since they would be used when tokens are on the table anyway. Thanks mate! timmaugh said: I can offer a third path. You could have a local version of the ability -- which you might normally (and normally rightly) suspect to be a nightmare to update. But with this suggestion, keeping the ability updated is fairly easy. I showed in this thread how to use InsertArg to copy abilities from one character to another. The setup would be setting up the ability on a source character (your macro hauler character), and installing InsertArg (and Plugger, if you want to do multiple ability moves in one go). As mentioned in the linked thread, InsertArg has a way to designate a source character to read an ability, and it would copy the ability to the character who was speaking the InsertArg command. If an ability of that name is detected on the destination character, the contents will be overwritten. If no ability of that name is detected, it will create one. So, imagine writing the ability on your macro hauler. Now write a macro that runs the InsertArg command to copy that ability to a local character, and share that macro with your players. Have your players run that macro one time to create the ability on their character. Later, if you ever tweak the language of the ability, have the players run the macro again and their local copy of the ability will be updated to the latest version. You could handle the messaging with DiscreteWhisper to give each player a chat button to quickly execute the update*. * - I just found an error in DiscreteWhisper I need to patch to make this work, but I have time to get that update in next week's merge. I'm not sure, but it sounds like this way requires the use of API, so I'd like to clarify: Does this way require the usage of API (and thus Pro subscription, which I do not currently possess)? If it does, is it enough for GM to have it or do the players need it as well? Are there any other, third-party plugins involved (not talking about Roll20 API scripts, but rather browser plugins etc.)? Thanks in advance!
1635594063
timmaugh
Roll20 Production Team
API Scripter
Sorry... I try to be better about noticing if someone has a pro subscription or not before I recommend an API solution. Yes, my suggestion requires access to the API. Only the owner of the game needs a Pro sub, shen everyone can use scripts. And, no, there are no third-party components to what I was describing.