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

Question about interaction between power cards api and conditions

Is there a way for power cards API to detect a condition being on a token from Combat Master API? for example, I want to create a power card macro which outputs the additional damage of rage on a seporate column if the character using the macro has the “rage” condition is this possible and if so what would the best way of doing it be?
1725018377
timmaugh
Pro
API Scripter
Obligatory note: PowerCards is not being actively developed and has been replaced (by most people) with ScriptCards. ScriptCards, I beleive, *would* have the ability to test for a given status marker on a token and apply different operations based on the result. However, as far as PowerCards... I'm not sure if PowerCards has this ability natively, but you can add it with the Metascript Toolbox. Fetch can test the presence (or value) of a status marker, and APILogic can provide conditional structure. Both are included in the Toolbox. Here is an example testing for the presence of the "Raging" marker: {&if @(selected.is.Raging) = yes}True case operations{&else}Optional ELSE case and ELSE case operations{&end}
How would you do it with script cards, I just looked into the wiki and I’m going to use it instead as it is much more advanced than power cards.
So this is a really stripped down example of a ScriptCard that checks for a token's status marker. !script {{ --&RageMarker|strong --&RageDamage|2 --#sourceToken|@{selected|token_id} --?"[*S:t-statusmarkers]" -inc "[&RageMarker]"|[ --?[*S:level] -ge 9|&RageDamage;3 --?[*S:level] -ge 16|&RageDamage;4 --+Rage Damage|+ [&RageDamage] --]| }} So the --&RageMarker is a string variable  to store whatever the name of the Rage marker you are looking for. Just change strong in that line to the name of your marker. This uses the --#sourceToken| parameter  to the Roll20 attribute lookup of @{selected|token_id}. Setting the token will allow the shortcut of [*S: for attribute and token property lookup . Then it uses a conditional --?  to check if the current Token's statusmarkers property  includes the value you set for RageMarker string variable, in this example, the strong marker in the default marker set. If the condition evaluates to true, the code block |[ --]|  is entered where 2 additional conditionals are used to compare the level attribute and set the string variable &RageDamage and then print the value of RageDamage. If the condition evaluates to false, the code block is skipped and the ScriptCard ends. Obviously in a real ScriptCard more would be added for attack rolls and damage rolls and things but since this question is specifically about checking for markers, I didn't want to overcomplicate things with extraneous stuff. Let me know if you have any questions. If you are looking for other examples beyond the wiki and the ScriptCards threads, there are a few tutorials here on Github you can follow .
That’s super cool, thank you. I just started with script cards a few days ago. I’ve just been making things by looking through the documentation on the massive wiki and messing around with some existing scripts. This is a huge help!
Follow up question, is there a way to get the amount of "Stacks" a condition is on a target?
Or More Specifically, the numerical value which is stored in the API tokenMarker Attribute Strong@1?
1725416192
timmaugh
Pro
API Scripter
I'm sure ScriptCards has a way to do that, which I'll have to leave to Joshua to provide as I'm not that well versed in ScriptCards syntax. However, you can always get the value from a status marker on a token using Fetch. There are a few options... also, everywhere you see "selected" below, you can use another way to identify the token (name, id, etc.). Everywhere you see "blue" you could use the name of a different marker: @(selected.status.blue) => returns the value of first blue marker on token @(selected.status.blue?all) => returns the values of the bluem arkers on token, in order, as a single number @(selected.status.blue?all+) => returns the total of the values on all blue markers on token @(selected.status.blue.count) => returns the number of blue markers on token As an example, given this image: The formations would return: @(selected.status.blue) => 2 @(selected.status.blue?all) => 27 @(selected.status.blue?all+) => 9 @(selected.status.blue.count) => 2 I'm not sure if ScriptCards lets you apply the same status marker multiple times, but TokenMod does. That's how I was able to produce a token with the status as depicted in that image. It's a good way to extend the status count beyond 9 (effectively giving it a tens digit).
You can find information about statusmarkers with ScriptCards. If you are wanting the easiest solution, I'd recommend using a ScriptCard library that Kurt J has put together, the system neutral library . Nick Olivo has a video about how to install and use ScriptCard libraries. Essentially you make a handout named ScriptCards Library snlib and then copy the raw contents of the library here  into that handout. Then in your ScriptCards you would use +++snlib+++ to import the library. The snlib has functions to manipulate the status markers or get values like LibSN_CHECK_STATUS_MARKER. !script {{ +++snlib+++ --#sourceToken|@{selected|token_id} -->LibSN_CHECK_STATUS_MARKER|[*S:t-id];strong;Exists;Stacks --+Strong Stacks|[&Stacks] }} There are other ways to get information. [*@{selected|token_id}:t-statusmarkers] would get the comma separated list. There is a built-in function array;statusmarkers that would return an array with a token's markers. !script {{ --#sourceToken|@{selected|token_id} --~|array;statusmarkers;MarkArr;[*S:t-id] --%m|foreach;MarkArr --+Marker|[&m] --%| }}   So depending on your needs there are multiple ways to get information about the statusmarkers.