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

Accounting for no NPC character sheet

1588429392

Edited 1588431621
Working on a macro for my attacks and I want my attack to automatically pull the "Reflex Defense" Scores for my target. That's easy: [[@{Target|Reflex}]] flatfooted ([[@Target|ReflexFlatFooted}]]} No problem, there, been doing that for years.  However, I'm not the GM in this game, (for like the first time, ever) and I want to be able to account for my GM maybe not having enough time to fully set up a character sheet for each NPC and just throw some tokens down with some HP in them. Can I modify it to account for there being no character sheet on a selected token and just show 0 or something, instead? Instead of the ENTIRE attack not working? Update What I'm doing in the meantime is simply targeting my own token if the target doesn't actually have anything. Then ignoring the display that shows my own stats. 
1588430754
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can use queries, if the numbers are commonly known: [[?{Reflex|0}]] flatfooted ([[?{ReflexFlatFooted|0}]]} Without seeing the larger macro, that's a "best guess" and will default to zero, or allow the user to input a number if it is known.
Well, my goal is to not query with every roll, but rather target a selected token that most of the time will have a character sheet but may not. 
1588535028

Edited 1588536720
GiGs
Pro
Sheet Author
API Scripter
If you're using @{target|something}, and the token isnt connected to a character sheet, you'll get an error.  If you want to do conditional checks whether the token is connected to a character or not, you have to use a custom API script. That requires the GM be Pro, and someone write the script...
1588535846
Kraynic
Pro
Sheet Author
I have no idea how/if it would work, but could you use the keep highest one structure to resolve to 0 if the attribute is blank? [[{@{Target|Reflex}, 0}kh1]] flatfooted ([[{@{Target|ReflexFlatFooted}, 0}kh1]]}
1588536790
GiGs
Pro
Sheet Author
API Scripter
No, it'll report an error in chat and the macro will be unable to complete. You'll have the Target dialog floating at the top of your screen until you manually click the x to close and cancel it.
The way I do it, I just use my own token as a target if there's no sheet attached to the target token and ask the GM to ignore the result. It's not the most sophisticated, but it works for me.
Yeah, I figured I'd have to API it. I'm okay at JS.