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

The new D&D 2024 sheet is now available!

Create a free account

smart macro

1724924235

Edited 1724924306
Greetings, gamers! I'm trying to get a macro from Character1 to "ask" Character2 which attributes to use for a roll and also add an attribute of Character2's, but I'm having trouble getting the system to pull the text from Character2's answering attribute as the answer to the fill-in-the-blank macro I've written. Example: Character1(selected) @{target|reveal}+@{target|@{target|call}}+@{target|@{target|call|max} Character2(target) reveal=1d8+1 call=dexterity/ranged Errors include: No character was found for 'target@{target' No attribute was found for @{TARGET:call|max} the roll that happens is just Character2' reveal attribute Any help is appreciated and if anymore details are needed, please just ask.
1724927497

Edited 1724927831
GiGs
Pro
Sheet Author
API Scripter
This syntax: @{target|@{target|call} needs to be changed. It probably should be @{target|call} The max one would be @{target|call|max} You will be [reompted to pick a target once, and all attributes thatstart @{target| will be drawn from that same character. If you want to grab attributes from two different characters, you can add a label to each character, like @{target|first| and @{target|second| . That would look like: @{target|first|call} and @{target|second|call} . Here call is the name of an attribute. So this @{target|reveal}+@{target|@{target|call}}+@{target|@{target|call|max} would be @{target|reveal}+@{target|call}}+@{target|call|max}
The target calls don't play nice with max attribute values - I would suggest splitting that into two separate attributes instead that you can call with simple attribute calls. But using target calls to fill in attribute calls gets you in trouble with the order of operations - you can get around this by inserting those values into a button in chat instead. Here's an example: [Press me](`[[@{@{target|character_name}|reveal}+@{@{target|character_name}|@{target|call1}}+@{@{target|character_name}|@{target|call2}}]]) Here, a link is produced into the chat with the correct values loaded and ready to roll - some html replacements were necessary to get the order of operations to play nice, and the character name is loaded to point the reference to the right character when the link is clicked.
1724963033
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi AceMouse131! Is this on a classic or jumpgate game? I identified an issue with naming multiple targets on Jumpgate this morning.
I hope this helps: This game's mechanics assign dice size to the player characters' ability scores and adds hard numbers for relative skills. The weapons and spells call for those from the character using them and adds 1-2 dice to the other(s). The macro in question is on an invisible-to-players character. The targeted token would be for a weapon or spell. The player character should have been in the macro as 'selected'. (sorry for the mistype in the original post) The intended effect was for the player character to "remotely" activate the macro and for the macro to not have any calls tied to any one player character. Example: Paladin's strength is a 1d8, her melee skill is +3, and a longsword would add another 1d8
keithcurtis said: Hi AceMouse131! Is this on a classic or jumpgate game? I identified an issue with naming multiple targets on Jumpgate this morning. this game is currently running no character sheet on a jumpgate platform
With some changes, this is my current macro: &{template:default} {{name=@{selected|name}}} {{@{target|name}=[[@{target|reveal}+@{selected|@{target|able}}+@{selected|@{target|skill}}]]}} {{Traits=@{target|traits}}} {{Extra Details=@{target|desc}}} This is what I want it to look like: But it isn't rolling the called selected attributes
1725025863

Edited 1725026125
Your issue comes down again to target calls not playing nice with order of operations - when you use a html replacement to try to delay the outer attribute call, it's not resolved unless you can force the  parser to go through it again. You can do this with a chat button, as I did before. Here, I converted that template to one that is brought up via a chat button with minor styling: [@{selected|character_name} uses @{target|character_name}!](`/ooc &{template:default} {{name=@{selected|character_name}}} {{@{target|character_name}=[[@{target|reveal}+@{selected|@{target|able}}+@{selected|@{target|skill}}]]}} {{Traits=@{target|traits}}} {{Extra Details=@{target|desc}}}"style=" display:block; background-color: purple; color: white; padding: 5px) EDIT: Oh, and @{character_name} is an universal attribute inherent to the roll20 character sheets, you can always use it to call for the name assigned to a sheet without having to set it up as an attribute yourself.
You may also want to look at the Prefix Trick to Variably Call Attributes . That should allow you to reference attributes named by other attributes which appears to be what you're attempting.
Your macro works beautifully, Tuo, thank you! I like the styling as well. My next concern is that some of the playable characters have abilities that could add more dice to the equation. For those, I'd like to use a prompt macro but I've noticed that if I put the prompt(s) afterward the selected token will become deselected which makes the macro give the 'no selected token' error.
Ah, that's easy enough to fix - just replace @{selected| with   @{@{selected|character_name} | That way, the reference is expanded into the button and doesn't require the token to be kept selected.
1725309829

Edited 1725342484
Is there any way to get the prompt's results to be added into the inline roll result of the main macro? 
Can you post the prompt? Is it a query, and what is that you want it to do, exactly? From what you're describing, it should be fairly simple addition, but I want to be sure.
Here's one that represents an ability that one player can give others: ?{Are you Blessed?|No, |Yes,[[1d6]]}
[@{selected|character_name} uses @{target|character_name}!](`/ooc &{template:default} {{name=@{selected|character_name}}} {{@{target|character_name}=[[@{target|reveal}+@{@{selected|character_name} | @{target|able}}+@{@{selected|character_name} | @{target|skill}}?{Are you Blessed?|No, |Yes,+1d6}]]}} {{Traits=@{target|traits}}} {{Extra Details=@{target|desc}}}"style=" display:block; background-color: purple; color: white; padding: 5px) Like this? When you use the initial macro, you're asked if you're blessed, and if yes, then a d6 is added to the roll.