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

[Script] ScriptCards - My "Spiritual Successor" to PowerCards

1618275446
Kurt J.
Pro
API Scripter
Erik M. said: Kurt,  A quick question: Is there a reason when there is a repeating row loaded that some of the attributes of the row don't get accessed or loaded? Specifically, the Pathfinder 2 character sheet has the damage for weapons split into 2 attributes (for some reason) called damage_dice and damage_dice_size.  When I run this card for a rapier (weapon damage 1d6): !scriptcard {{    --#sourceToken|@{selected|token_id}   --#whisper|GM   --Rfirst|[*S:character_id];repeating_melee-strikes   --+Damage|Number of dice: [*R:damage_dice] and Dice Size [*R:damage_dice_size] for [*R:weapon] }} This is output that I get: I made sure the names were correct by running:  @{selected|repeating_melee-strikes_$0_damage_dice} @{selected|repeating_melee-strikes_$0_damage_dice_size} And that gave me the correct 1D6. I've also tried running the Rdump command and the damage_dice attribute isn't even listed. Could this be a problem with the sheet as it interacts with the API? I fired up a PF2 game to look, and the way the repeating attributes are handled on the sheet are a bit different than what I'm used to. There is a "damage_dice_query" attribute that is just a reference to "@{damage_dice}", but I can't find that listed anywhere. I'll keep digging, but it may just be the way the sheet in structured. There is an attribute called damage_display that you can use to get the number of dice like this: !scriptcard {{    --#sourceToken|@{selected|token_id}   --#whisper|GM   --Rfirst|[*S:character_id];repeating_melee-strikes   --&numdice|[*R:damage_display]   --~numdice|string;before;D;[&numdice]   --+Damage|Number of dice: [&numdice] and Dice Size [*R:damage_dice_size] for [*R:weapon] }} It is kind of a workaround, but it brings back the right value.
Kurt - While testing out the new version, appears that #whisper|self no longer works, and no output is returned to the chat window.  Getting the following error in the console: {"who":"error","type":"error","content":"Unable to find a player or character with name: MadCar / Will (GM)"} #whisper|GM still appears to work.  
Hi guys! Found an issue I think! I created 3 rolltable to store my d10 images (SPIRIT, SOUL & BODY - respectively Yellow, Blue and red) But it seems that 0 in a rolltable is treated as susch and not as 10 ! the capture below shos the red dice having rolled 10 - it should not be displayed if it was considered as a 10 but as it is considered as a "0" it is shown! Am I doing something wrong in referencing the values like below !?  --=DéAme|[T#Ame]   --=DéCorps|[T#Corps]   --=DéEsprit|[T#Esprit]   --=DéNecrose|[T#Necrose]      --&Jaune|FEF68E   --&Bleu|1C6EA4   --&Rouge|990000   --&Vert|007700   --&Noir|000000   --+|[img][$DéEsprit.tableEntryImgURL][/img] - [img width=40 height=40][$DéAme.tableEntryImgURL][/img]- [img width=40 height=40][$DéCorps.tableEntryImgURL][/img]      --#emoteText|[*S:character_name] utilise Engrenages   --*|E:[$DéEsprit.tableEntryValue] - A:[$DéAme.tableEntryValue] - C:[$DéCorps.tableEntryValue]   -->CompareJE|[ $DéEsprit.tableEntryValue ];[ $DéAme.tableEntryValue ];[ $DéCorps.tableEntryValue ];[$Technique]
Forget about my previous post!......The value in my tables was 0 instead of 10...... I need some sleep ^^
1618311906

Edited 1618311970
Kurt J.
Pro
API Scripter
Will M. said: Kurt - While testing out the new version, appears that #whisper|self no longer works, and no output is returned to the chat window.  Getting the following error in the console: {"who":"error","type":"error","content":"Unable to find a player or character with name: MadCar / Will (GM)"} #whisper|GM still appears to work.   ScriptCards Version 1.1.18a now on the GIST Looks like I broke it when adding the --* stuff. I uploaded a new version (v1.1.18a) that fixes self whispers. (GIST)
Kurt J. said: I fired up a PF2 game to look, and the way the repeating attributes are handled on the sheet are a bit different than what I'm used to. There is a "damage_dice_query" attribute that is just a reference to "@{damage_dice}", but I can't find that listed anywhere. I'll keep digging, but it may just be the way the sheet in structured. There is an attribute called damage_display that you can use to get the number of dice like this: !scriptcard {{    --#sourceToken|@{selected|token_id}   --#whisper|GM   --Rfirst|[*S:character_id];repeating_melee-strikes   --&numdice|[*R:damage_display]   --~numdice|string;before;D;[&numdice]   --+Damage|Number of dice: [&numdice] and Dice Size [*R:damage_dice_size] for [*R:weapon] }} It is kind of a workaround, but it brings back the right value. I thought it was probably a sheet issue. Thanks for the workaround!
@Kurt J. - Is it possible to update rolls to allow for the  XdYkhZr<#  convention?  Or have you already done this?  Thanks!
Is it possible to change the size of buttons in Scriptcards?
1618340283
David M.
Pro
API Scripter
DM Goss, it looks like the button height is tied to the --#lineheight , and the button width is auto scaled to the display text of the button. If you increase lineheight, you may also want to adjust  --#bodyfontsize to look more proportional. Not sure if there is another way that doesn't also affect the line text.
1618343253

Edited 1618345487
Kurt J.
Pro
API Scripter
@Michael C and @DM Goss- Guess there will be a version 1.1.19 on the way :) I have new settings for buttonfontsize and buttonfontface in, and most of the XdYkhZr<# roll fomula done, so I should have it up on the GIST tonight.
You can also go into line 99 in the code and change the font-size of the button manually if you want all of your buttons a certain size.  var buttonStyle = 'background-color:!{buttonbackground}; color: #!{buttontextcolor}; text-align: center; vertical-align:middle; border-radius: 5px; border-color:!{buttonbordercolor}; font-size:x-small ;';
1618346920
Kurt J.
Pro
API Scripter
ScriptCards 1.1.19 is now Available On the Development GIST with the following changes: New Dice Roll Formula : XdYkhZr<Q, or roll XdY, rerolling dice of Q or less and keep the to Z dice, so 4d6kh3r<1 would roll 4d6, rerolling ones, and keeping the highest 3 rolls. New Button Formatting Options : New settings buttonfontsize and buttonfontface  can now be used to alter the appearance of buttons without the need to change the text on the rest of the card. buttonfontsize  can be any representation that is valid for CSS, while buttonfontface can technically be any font your players are likely to have on their PCs, but the roll20 included fonts that everyone will have are "Patrick Hand", "Contrail One", Shadows Into Light", and "Candal" Behavior Change : Previously, the entire card would be generated and then inline formatting would be applied to each line at the end. I have modified this behavior so that inline formatting is applied as each line is generated. This won't impact existing cards, but it will allow you to set things like fonts and button backgrounds on a per-line basis. Essentially when you set a setting that has a formatting impact it will be active from that line onward.
Kurt J: Wow, that was quick. It works like a charm, too. Thanks.
Most glorious!
1618433140
Senjak
Pro
Sheet Author
David M. said: DM Goss, it looks like the button height is tied to the --#lineheight , and the button width is auto scaled to the display text of the button. If you increase lineheight, you may also want to adjust  --#bodyfontsize to look more proportional. Not sure if there is another way that doesn't also affect the line text. Is there a way to adjust the font size on buttons?  I haven't had any luck with that. Senjak
1618433184
Senjak
Pro
Sheet Author
Kurt J. said: @Michael C and @DM Goss- Guess there will be a version 1.1.19 on the way :) I have new settings for buttonfontsize and buttonfontface in, and most of the XdYkhZr<# roll fomula done, so I should have it up on the GIST tonight. Yeah! Senjak
I've been trying to figure something out but I'm basically banging my head against a wall.  I run a Starfinder game and I mainly use Powercards for attacks but it's limited.  I've always wrestled with the repeating action stuff. My question is whether it's possible to have a roll query that automatically populates with attacks on from that repeating section.  Then, using that selection, populate the different sections of a generic attack code.
1618438542
Kurt J.
Pro
API Scripter
Brien V. said: I've been trying to figure something out but I'm basically banging my head against a wall.  I run a Starfinder game and I mainly use Powercards for attacks but it's limited.  I've always wrestled with the repeating action stuff. My question is whether it's possible to have a roll query that automatically populates with attacks on from that repeating section.  Then, using that selection, populate the different sections of a generic attack code. You could pass an action name as a roll query and use --Rfind to get the attributes of the repeating action and then use them in the script. I don't know much about the StarFinder character sheet, but this should be possible with ScriptCards.
1618439574
Kurt J.
Pro
API Scripter
ScriptCards version 1.1.19a now available I had a couple of ideas I wanted to get into the script before it hits OneClick in the next push, so: New formatting option : [sm]markername[/sm] allows you to display a status marker image in an output line. You can specity height/width in the opening tag (ie, [sm width=20]stopwatch[/sm] New Array Command  : --~|array;fromstring;arrayname;delimiter;string - splits "string" at "delimiter" and creates myarray based on the result. New Array Command : --~array;statusmarkers;arrayname;token-id - creates an array with the names of the status markers on the supplied token
Kurt J. said: Brien V. said: I've been trying to figure something out but I'm basically banging my head against a wall.  I run a Starfinder game and I mainly use Powercards for attacks but it's limited.  I've always wrestled with the repeating action stuff. My question is whether it's possible to have a roll query that automatically populates with attacks on from that repeating section.  Then, using that selection, populate the different sections of a generic attack code. You could pass an action name as a roll query and use --Rfind to get the attributes of the repeating action and then use them in the script. I don't know much about the StarFinder character sheet, but this should be possible with ScriptCards. I kinda understand.  I can get them to list (using the example in the wiki) but how would I get those results into a roll query? Sorry, I know very little about code.  It took me forever to be able to cobble together power cards.
So, it would depend on which extra step you want. You could use ChatSetAttr to create an attribute which lists all the different attacks or whatever. <code> --Rfirst|<character id>;repeating section prefix --:StringBuild| --&List|+[*R:atkname (or whatever)]| --Rnext| --?"[*R:atkname] -ne NoRepeatingAttributeLoaded|StringBuild --@setattr|_ids <character id> _silent _ListName|[&List] <more code> That will create an attribute for the character that is populated with all the items in the repeating section. You can then reference that list as ?{What attack?|@{<character id>|ListName}} This method requires updating the list whenever the list changes. The other option is to use an --i Line to use a query that is generated during the running of the ScriptCard. This will throw a button into chat that the player can press to be presented with a Roll Query after the ScriptCard starts. You can create the query using the same method, basically, as above. This method means there's a second step in the attack process but makes sure the list is always up-to-date. Brien V. said: You could pass an action name as a roll query and use --Rfind to get the attributes of the repeating action and then use them in the script. I don't know much about the StarFinder character sheet, but this should be possible with ScriptCards. I kinda understand.  I can get them to list (using the example in the wiki) but how would I get those results into a roll query? Sorry, I know very little about code.  It took me forever to be able to cobble together power cards.
1618486566
Kurt J.
Pro
API Scripter
ScriptCards version 1.1.19c is now Available I've updated the GIST with another revision to ScriptCards 1.1.19 (I'm keeping that version number because I've already submitted the code for OneClick). This version brings a new feature to Reentrant scripts: A single parameter can now be included with a reentrant button by adding it after the reentry label preceded by a semicolon. For example: [rbutton]Roll Damage::RollDamage;NonCrit[/rbutton] The parameter ("NonCrit" in this case) will be assigned to the string variable "reentryval" upon resumption of script execution. This means you have create multiple buttons that refer to the same label for reentry and modify the scripts behavior based on the parameter value.
This may or may not apply but I seem to have to select the token a second time (after selecting the token for the script) prior to operating a button within a script.  Am I doing something wrong, not doing something I should be or is it a quirk?
Michael C. said: This may or may not apply but I seem to have to select the token a second time (after selecting the token for the script) prior to operating a button within a script.  Am I doing something wrong, not doing something I should be or is it a quirk? I get the same behaviour : I have no Target token to be selected and though it asks me to select once more the already selected token.... It seems tied to the reentrant feature as it is yhe only thing that has changed on my side!
Thanks to Kurt & David M assistance,I finaly figured to get my scriptcard simulating the game mecanics for a skill roll. In my RPG (Shaan renaissance), there are 10 domains with 11 skills each (actually 10 regular ones + 1 other). For instance, for the Combat domain, you have: Bows Meles Thrown Armimales (combat pets) War Machines Dodge Force / Feats of strengh (bend bars,....) Intimidate Brawl Strategy Other Combat Some skills (not the ones above) can be used to render two types of results: let's take the Knowledge domain & its Psychology skill.  You can use Psychology to figure out the spiritual/emotional state of someone (classic use). But you can also use Psychology to somoothen/heal spiritual/emotionnal aches of someone (healing use). I figured out a script card menu that would generate a card listing each of the 11 skills of a domain with 1 or 2 buttons ahead to trigger the proper usage of a skill according to the need of the player. My skill menu would be reentrant. if I click on a button it triggers my skill card which is also reentrant (to simulate the intricacies of dice manipulation) To avoid writing 110 scriptcards (1 for each skill of the game) I created 3 generic procedures that I addes in a library: Compare_JE (procedure where Yellow dice is the main one - Blue & Red being off dices) Compare_JA (procedure where Blue dice is the main one - Yellow & Red being off dices) Compare_JC (procedure where Red dice is the main one - Blue & Yellow being off dices) That's where it become tricky...... Somehow I seem to loose my context when I get to click on the button.... It calls & executes the relevant procedure in the library, but it behaves like if it had lost the context (the character_Id) - the various [*S:attribute] involved in my calculation of the final result of the roll end-up undefined ! If you wanna see it by yourself, just tell me and I'll setup a discord meeting to show you! regards,
And One thing I would like to be able to do is to be able to have drop-down menu with the 11 skills rather than menu in the chat that spamm the chat box each time a player uses one.....
I was working on a shatter spell and saw Kurt J.'s fireball script as a most excellent template for the spell but noticed that the script never actually called the ApplyDamageTokenmod subroutine and when I added the call the subroutine changed the target HP to the damage taken rather than subtract it from total HP.  Adjusting this I also added Kurt's check and/or deduct the spell slot subroutines from his other scripts as well.  Shatter script (with changes to Fireball script in bold italics and modifications to Kurt's annotations): !scriptcard  {{   --#title|Shatter   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}    --#leftsub|2nd Level : Evocation : Action   --#rightsub|V S M : Range 60'   --#titleFontColor|#BDC3C7   --#titleCardBackground|#34495E   --#evenRowBackground|#1A5276   --#evenRowFontColor|#BDC3C7   --#oddRowBackground|#784212   --#oddRowFontColor|#BDC3C7     --/|Get a spell slot level from the caster.   --=SpellLevel|?{Spell Slot Level?|2|3|4|5|6|7|8|9}   --+|[c][b]Save DC @{selected|spell_save_dc} * Slot Level: [/b][$SpellLevel][/c]     -->GetAndCheckSlotInformation|     --/|Calculate damage based on spell slot. Shatter is 3d8 for 2nd level, so 1+SpellLevel d8 to total.   --=DamageDice|[$SpellLevel.Total] + 1   --=Damage|[$DamageDice.Total]d8   --=HalfDamage|[$Damage.Total] \ 2     --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the   --/|top of the card. If all critters make their save, the half damage roll won't contain the details.   --+|[c][b]Damage Roll: [/b][$Damage][/c]   --+|      --/|Get all tokens on the page into the "alltokens" array   --~|array;pagetokens;alltokens;@{target|token_id}     --/|Create the "inRange" array. It will have a blank item in it to begin with, which we will remove later.   --~|array;define;inRange;     --/|Loop through all of the tokens in "alltokens" to check their distance   --~tokenid|array;getfirst;alltokens   --?[&tokenid] -eq ArrayError|endOutput   --:loopCheck|     --/|Skip targets that are not on the token layer or that don't represent creatures   --?[*[&tokenid]:t-layer] -ne objects|continue   --?"[*[&tokenid]:t-represents]" -ninc "-"|continue     --/|Check the distance between the target token and the current array token. 10 feet is 2 units   --~dist|distance;@{target|token_id};[&tokenid]   --?[$dist] -gt 2|continue     --/|If we didn't skip over this part, the token is within 10 feet, so add it to the inRange array   --~|array;add;inRange;[&tokenid]   --:continue|   --~tokenid|array;getnext;alltokens   --?[&tokenid] -ne ArrayError|loopCheck     --/|Remove the dummy first item in the inRange array   --~|array;removeat;inRange;0     --/|Loop through the inRange tokens and roll saves for each one and apply damage   --~tokenid|array;getfirst;inRange   --?[&tokenid] -eq ArrayError|endOutput   --:loopDisplay|   -->MakeSavingThrow|[&tokenid];constitution;@{selected|spell_save_dc};[$Damage.Total];thunder;thisTokenDamage;saveResult;con   --+[*[&tokenid]:character_name]:|Save [$savingThrow] [r][$thisTokenDamage] thunder dam.[/r]   -->ApplyDamageTokenmod|[&tokenid];1;[$thisTokenDamage]     --/|Put a burst-magic visual effect on impacted tokens   --vtoken|[&tokenid] burst-magic     --/|Get the next token and continue the loop until we run out.   --~tokenid|array;getnext;inRange   --?[&tokenid] -ne ArrayError|loopDisplay     --:endOutput|   -->DeductSpellSlot|     --X|     --/|Subroutine to make saving throws and calculate damage amounts   --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname   --?"X[*[%1%]:npc_[%8%]_save_base]" -eq "X"|>set_string;baseSaveBonus;|>set_string;baseSaveBonus; + + [*[%1%]:npc_[%8%]_save_base]   --=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&baseSaveBonus]   --&dmgmult|   --?[$savingThrow] -ge [%3%]|>set_string;dmgmult; \ 2   --?[$savingThrow] -lt [%3%]|>set_string;[%7%];fail   --?[$savingThrow] -ge [%3%]|>set_string;[%7%];success   --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; \ 2   --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; * 0   --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult;   --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; * 2   --?"[*[%1%]:npc_immunities]" -inc "[%5%]"|>set_string;dmgmult; * 0     --=[%6%]|[%4%] [&dmgmult]   --<|   --:set_string|mod_variable;value   --&[%1%]|[%2%]   --<|     --/|Subroutine to apply damage with TokenMod. Could be replaced with alterbars or chatsetattr   --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount   --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|-[%3%]   --<|     --:GetAndCheckSlotInformation|   --=SlotLevel|[$SpellLevel]   --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total]   --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended]   --?[$SlotsExpended.Total] -ge [$SlotsTotal.Total]|NoSlotsLeft   --<|     --:DeductSpellSlot|   --=SlotsExpended|[$SlotsExpended] + 1   --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent   --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended]   --+|Level [$SlotLevel] Slots Left: [$SlotsRemaining]   --X|     --:NoSlotsLeft|   --+|[b][*S:character_name] has no level [$SlotLevel.Total] spell slots available.[/b]   --X|NoSlotsLeftStop   }} I think I almost understand the script now, though it makes my head hurt.  :-)  Salud to Kurt!
I'm running into an interesting issue with -inc and npc_type, but maybe it's that I'm missing something. I'm checking the target character for 'Vehicle' in the string, and if it does it'll check for a DamageThreshold and also deal damage to bar2 instead of bar1. However, I have to make the target character's npc_type to be equivalent for it to work. For example, I have my ship listed as a 'Gargantuan Vehicle', but using -inc for 'Vehicle' fails. I'll post the whole macro just in case it's not what I think it is. (And yes I did post this earlier in a different thread, but this is a different issue entirely and I felt it improper to post without full context) !scriptcard {{ --#title|Vehicle Weapon Attack --#sourceToken|@{selected|token_id} --&DTType|Vehicle --? @{selected|WeaponState} -ne @{selected|WeaponStateMax}|Load --? @{selected|WeaponState} -eq @{selected|WeaponStateMax}|Fire --X| --:Load| --@modattr| _charid [*S:character_id] _WeaponState|1 _silent --+Action|@{selected|character_name} is loading... --X| --:Fire| --@setattr| _charid [*S:character_id] _WeaponState|0 _silent --ISelect A Target;Click Here|t;WeaponTarget;Weapon Target --#targetToken|[&WeaponTarget] --=TargetAC|@{target|ac} --#emoteText| @{selected|character_name} attacks @{target|character_name}! --=ToHit|1d20 + @{selected|WeaponToHit} --+To Hit|[$ToHit] --? [$ToHit.Base] -eq 20|Crit --? [$ToHit.Total] -ge [$TargetAC]|Hit --? [$ToHit.Base] -eq 1|Fumble --+Miss| The Attack Missed! --^SubtractAmmo| --:Crit| --=Damage|@{selected|WeaponCritDamage} --+Critical Damage|[$Damage] --^SubtractDamage| --:Hit| --=Damage|@{selected|WeaponDamage} --+Damage|[$Damage] --^SubtractDamage| --:Fumble| --+Fumble| The Attack Horribly Missed! --^SubtractAmmo --:SubtractDamage| --? @{target|npc_resistances} -inc @{selected|WeaponDamageType}|>Resist --? @{target|npc_vulnerabilities} -inc @{selected|WeaponDamageType}|>Vuln --? @{target|npc_immunities} -inc @{selected|WeaponDamageType}|>Immune --+Type|[&DTType] --+Type|@{target|npc_type} --? @{target|npc_type} -inc [&DTType]|SubtractVehicleDamage --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --^SubtractAmmo| --:SubtractVehicleDamage| --+Damage Threshold|Applying Threshold... --? [$Damage] -ge @{target|DamageThreshold}|SkipDT --=Damage|0 --+Resisted|@{target|character_name} Resisted the Attack! --:SkipDT| --@alter|_target|@{target|token_id} _bar|2 _amount|-[$Damage] --^SubtractAmmo| --:SubtractAmmo| --ISelect Source Vehicle;Click Here|t;SourceTarget;Source Target --#targetToken|[&SourceTarget] -->Lib5E_FindResource|@{target|character_id};@{selected|WeaponAmmoType};AmmoAttr;AmmoValue --=NewAmmoCount|[$AmmoValue] - @{selected|WeaponAmmoCost} --+Remaining Ammo|[$NewAmmoCount] --@setattr| _charid [*T:character_id] _[&AmmoAttr]|[$NewAmmoCount] _silent --X| --:Resist| --Damage|[$Damage] \ 2 --<| --:Vuln| --Damage|[$Damage] * 2 --<| --:Immune| --Damage|0 --<| }} Here's the current output:
Again, I'm dense.  Is it possible to put the Rfirst code inside a roll query so it populates the query with a list of items in the repeating attack section.  Once you select the proper item, the code populates it into the rest of the macro.  
Any time you have a space (or the possibility of one) in either of your comparison parameters, you need to surround the parameter in "s This line: --? @{target|npc_type} -inc [&DTType]|SubtractVehicleDamage Should read: --? "@{target|npc_type}" -inc [&DTType]|SubtractVehicleDamage non said: I'm running into an interesting issue with -inc and npc_type, but maybe it's that I'm missing something. I'm checking the target character for 'Vehicle' in the string, and if it does it'll check for a DamageThreshold and also deal damage to bar2 instead of bar1. However, I have to make the target character's npc_type to be equivalent for it to work. For example, I have my ship listed as a 'Gargantuan Vehicle', but using -inc for 'Vehicle' fails. I'll post the whole macro just in case it's not what I think it is. (And yes I did post this earlier in a different thread, but this is a different issue entirely and I felt it improper to post without full context)
The problem is that roll queries are handled by the chat server before any of the ScriptCard is ever processed. That means there will not be a list populated at the time the roll query prompts the user for input. Brien V. said: Again, I'm dense.  Is it possible to put the Rfirst code inside a roll query so it populates the query with a list of items in the repeating attack section.  Once you select the proper item, the code populates it into the rest of the macro.  
1618519858
Kurt J.
Pro
API Scripter
Brien V. said: Again, I'm dense.  Is it possible to put the Rfirst code inside a roll query so it populates the query with a list of items in the repeating attack section.  Once you select the proper item, the code populates it into the rest of the macro.   You could create a macro that reads through the repeating attributes you want to handle and builds a list that you then use a call tp chatsetattr to store on the character as a new attribute. You could then use that attribute as part of a roll query to get the repeating attribute name for use in Rfind, giving you the attributes for that element. If you wanted to get fancy, you could make the macro that uses the list call the macro that updates the list as the last thing it does, so any changes would go into effect the next time you run it. This is essentially what PCMHelper does. In fact, you could use PCMHelper and just never run !pcmsetup and it will keep the attributes up to date for you automatically.
1618519955

Edited 1618520006
Kurt J.
Pro
API Scripter
Michael C. said: This may or may not apply but I seem to have to select the token a second time (after selecting the token for the script) prior to operating a button within a script.  Am I doing something wrong, not doing something I should be or is it a quirk? It seems to be an oddity of the Roll20 interface. It happens to me fairly often, and doesn't seem to be consistent. Sometimes a script that I think is going to end up clearing my selected target doesn't, and sometimes something I think is completely innocuous does. It is behavior that has been around as long as I can recall (pre-dating ScriptCards and my involvement in PowerCards). And since the API is limited incapable of doing anything with the UI, there isn't much that can be done about it unless that changes.
Colin C. said: Any time you have a space (or the possibility of one) in either of your comparison parameters, you need to surround the parameter in "s This line: --? @{target|npc_type} -inc [&DTType]|SubtractVehicleDamage Should read: --? "@{target|npc_type}" -inc [&DTType]|SubtractVehicleDamage non said: I'm running into an interesting issue with -inc and npc_type, but maybe it's that I'm missing something. I'm checking the target character for 'Vehicle' in the string, and if it does it'll check for a DamageThreshold and also deal damage to bar2 instead of bar1. However, I have to make the target character's npc_type to be equivalent for it to work. For example, I have my ship listed as a 'Gargantuan Vehicle', but using -inc for 'Vehicle' fails. I'll post the whole macro just in case it's not what I think it is. (And yes I did post this earlier in a different thread, but this is a different issue entirely and I felt it improper to post without full context) That did it, thank you! I'll try to keep that in mind for the future. I'm glad it wasn't actually an issue with ScriptCards parsing!
Thanks, Kurt.  I wondered because I had not had the problem with your powercards scripts as much and wondered if there was a reason.  Sounds to me like I've just been lucky so far.  It's not a big issue and I can think of several work arounds.  :-)
I keep throwing bottles at the sea..... Time management : Time is sequenced in Days/Situation/Turns/Actions and/or gestures 1 Day main contain many situations (a scene/combat/investigation....) A situation may last a few turns up to a few hours 1 turn is made of 3 gestures OR 1 action & 1 gesture 1 action takes 2 gestures All the powers in the game system have a duration (like D&D spells) that I would like to track. Each of my players have powers/capacities that they can only activate once a day, once per situation..... How would you simulate this ? I would mainly need to track days & situations as Turns are already handled by turn tracker ! (even if I would still need to track the fact that a power has already been used in the previous turn)..... Wot about handling a dynamic array per player where I would store powers id (even if they are in repeating sections) to simulate the fact that they've been already used. I would also need to temporarily disable those powers in their respective repeating sections in order for them not to appear until the next time period where they will become available again.... Any advice will be greatly appreciated !
Hello, Any idea why this script stops working (it was ok 3 weeks ago) : !scriptcard {{ --#title|Healing Potion --#leftsub|@{selected|token_name} -->FindPotionType|?{What type of potion?|Healing Potion|Greater Healing Potion|Superior Healing Potion|Supreme Healing Potion} --?[$PotionCount] -le 0|NoPotion --=PotionsLeft|[$PotionCount] - 1 --=HealingAmount|[&DieRoll] --+|You gulp a [&PotionType] and are healed for [$HealingAmount] HP! --@setattr|_charid @{selected|character_id} _[&AttributeRef]|[$PotionsLeft] _silent --X| --:NoPotion| --+|You don't have any [&PotionType]s left. --X| --:FindPotionType| --Rfirst|@{selected|character_id};repeating_resource --:ResourceLoop| --?"[*R:resource_left_name]" -eq "?{What type of potion?}"|>SetPotionInfo;?{What type of potion?};[*R>resource_left];[*R:resource_left] --?"[*R:resource_right_name]" -eq "?{What type of potion?}"|>SetPotionInfo;?{What type of potion?};[*R>resource_right];[*R:resource_right] --Rnext| --?"[*R:resource_left_name]" -ne "NoRepeatingAttributeLoaded"|ResourceLoop --<| --:SetPotionInfo|Params are Text Name;Attribute Reference;Attribute value --&PotionType|[%1%] --PotionType|[&PotionType] --&AttributeRef|[%2%] --=PotionCount|[%3%] --?"[&PotionType]" -eq "Healing Potion"|>SetDiceRoll;2d4 + 2 --?"[&PotionType]" -eq "Greater Healing Potion"|>SetDiceRoll;4d4 + 4 --?"[&PotionType]" -eq "Superior Healing Potion"|>SetDiceRoll;8d4 + 8 --?"[&PotionType]" -eq "Supreme Healing Potion"|>SetDiceRoll;10d4 + 20 --<| --:SetDiceRoll|Param is die roll type --&DieRoll|[%1%] --<| }} It doesn't seem to roll anything :
1618588357

Edited 1618588713
I'm no expert but I don't think:  --PotionType|[&PotionType] works. I am not sure what you were trying to do with that line but I assume you want a numerical answer and that would be:    -- = PotionType|[&PotionType]   or perhaps you are assigning the wrong variable and wanted a string assignment --&NameofVariable?
3 questions  1) can i change the defaults like text color and background so I don't have to add them to ever card. 2) How can I get the title to be just white text with no outline? 3) Try to create a check for the health of the target an if 0 the print on the card The target is dead and add the red X to the token.  I was trying to add it to the Longsword macro  !scriptcard {{ --#title|Longsword --#leftsub|Melee Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --#titleFontColor|#FFFFFF --#titleCardBackground|#932729 --#evenRowBackground|#B6AB91 --#evenRowFontColor|#000000 --#oddRowBackground|#CEC7B6 --#oddRowFontColor|#000000 --#emoteBackground|#FFFFFF --#tableBorderRadius|8px --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --=Damage|1d8 + @{selected|strength_mod} [STR] --+Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] -->Health| --^Final| --:Crit| --=Damage|1d8 + @{selected|strength_mod} [STR] + 1d8 [CRIT] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] -->Health| --^Final| --:Health| --+Test| --=targethp|@{target|hp} --?|[$targethp] -gt 1|Final --+test2| --+Status|@{target|token_name} is dead! --+Targets HP|[$targethp] --<| --:Final| }}
1. Not sure - Kurt or David will have to answer that. 2.  I believe   --#emoteState|hidden will work. 3. I would us -ge rather than -gt in your test or it will call the gosub if  [$targethp]  is greater than 1.  I believe Roll20 will automatically impose the red "X" anytime a token is less than 0 on HP so long as the token has a bar set to hp. 
Michael C. said: 1. Not sure - Kurt or David will have to answer that. 2.  I believe   --#emoteState|hidden will work. 3. I would us -ge rather than -gt in your test or it will call the gosub if  [$targethp]  is greater than 1.  I believe Roll20 will automatically impose the red "X" anytime a token is less than 0 on HP so long as the token has a bar set to hp.  --#emoteState|hidden is for emote I am looking for the title of the card. roll20 doesn't add the x if the hp are zero at least mine doesn't. -ge didn't help something wrong in my logic. 
Kurt - Could you add or modify your TurnOrder functionality to include logic similar to !act&nbsp; ( <a href="https://app.roll20.net/forum/post/6371080/turntracker1-spell-durations-and-effects/?pageforid=6371080#post-6371080" rel="nofollow">https://app.roll20.net/forum/post/6371080/turntracker1-spell-durations-and-effects/?pageforid=6371080#post-6371080</a> ) which adds a custom countdown/up counter to the turnorder and establishes a starting value?&nbsp; It would be based on your turnorder;addcustom command.&nbsp;&nbsp; Maybe something like: --~|turnorder;addcounter;textlabel;trackervaluel;direction&nbsp;&nbsp; Example Uses: --~|turnorder;addcounter;Round;1;+1&nbsp; &nbsp;(To track rounds) --~|turnorder;addcounter;Bless;10;-1 (To track spell durations like bless)
1618606762
Kurt J.
Pro
API Scripter
Craven said: 3 questions&nbsp; 1) can i change the defaults like text color and background so I don't have to add them to ever card. 2) How can I get the title to be just white text with no outline? 3) Try to create a check for the health of the target an if 0 the print on the card The target is dead and add the red X to the token.&nbsp; I was trying to add it to the Longsword macro&nbsp; #1 - There is currently not a way to change the default settings, but part of my plan is to add OneClick configuration options that would allow you to do so. Otherwise, the only way to change them would be to modify the settings in the code (easy to do, but you would need to do it for each update). #2 - The text-shadow CSS code is not exposed as a setting because it is lengthy, but again, you could modify the code and change it in the definition of htmlTemplate. #3 - Is bar1 linked to the HP attribute of the character? It is not uncommon for this to NOT be the case for&nbsp; NPCs, because if it is, and you have 6 orcs on the VTT they will all take damage when any of them is hit. If bar1 is not linked, then you want to check the HP in bar1's value and not in the HP field, which will always be the full hitpoints for the NPC.
1618607071
Kurt J.
Pro
API Scripter
Brien V. said: Again, I'm dense.&nbsp; Is it possible to put the Rfirst code inside a roll query so it populates the query with a list of items in the repeating attack section.&nbsp; Once you select the proper item, the code populates it into the rest of the macro.&nbsp;&nbsp; No. The repeating section commands are their own statement type, so they can't be included in other statements. Once you do find a repeating section, though, you don't need to retrieve all of the values, as [*R:attributename] and [*R&gt;attributename] will retrieve the value of the attribute and the full object name of the attribute for you.
Michael C. said: I'm no expert but I don't think:&nbsp; --PotionType|[&amp;PotionType] works. I am not sure what you were trying to do with that line but I assume you want a numerical answer and that would be:&nbsp; &nbsp; -- = PotionType|[&amp;PotionType]&nbsp; &nbsp;or perhaps you are assigning the wrong variable and wanted a string assignment --&amp;NameofVariable? I shamelessly copied the script from Kurt 's Post on page 3 of this thread, everything was working fine until last week. Now I will have to understand this script to correct it :-)
Sebastian,&nbsp; --&amp;DieRoll|[%1%] that needs to be —= and when you reference it in healing assignment it should be [$DieRoll]
1618618074
Kurt J.
Pro
API Scripter
sebastien g. said: Michael C. said: I'm no expert but I don't think:&nbsp; --PotionType|[&amp;PotionType] works. I am not sure what you were trying to do with that line but I assume you want a numerical answer and that would be:&nbsp; &nbsp; -- = PotionType|[&amp;PotionType]&nbsp; &nbsp;or perhaps you are assigning the wrong variable and wanted a string assignment --&amp;NameofVariable? I shamelessly copied the script from Kurt 's Post on page 3 of this thread, everything was working fine until last week. Now I will have to understand this script to correct it :-) I copied what you posted into my game, and it worked fine. I know that isn't terribly helpful, but...
Kurt J. said: Craven said: 3 questions&nbsp; 1) can i change the defaults like text color and background so I don't have to add them to ever card. 2) How can I get the title to be just white text with no outline? 3) Try to create a check for the health of the target an if 0 the print on the card The target is dead and add the red X to the token.&nbsp; I was trying to add it to the Longsword macro&nbsp; #1 - There is currently not a way to change the default settings, but part of my plan is to add OneClick configuration options that would allow you to do so. Otherwise, the only way to change them would be to modify the settings in the code (easy to do, but you would need to do it for each update). #2 - The text-shadow CSS code is not exposed as a setting because it is lengthy, but again, you could modify the code and change it in the definition of htmlTemplate. #3 - Is bar1 linked to the HP attribute of the character? It is not uncommon for this to NOT be the case for&nbsp; NPCs, because if it is, and you have 6 orcs on the VTT they will all take damage when any of them is hit. If bar1 is not linked, then you want to check the HP in bar1's value and not in the HP field, which will always be the full hitpoints for the NPC. Ty for the reply yes I have link bar 1 to the HP. I even have a macro to set npcd_hp to hp on the character sheet. I keep it as hp because I want it to work for PC as well and if I write it for npcd_hp it doesn't work for PC as the attrib doesn't work.&nbsp; Seems like the&nbsp; --?|[$targethp] -gt 1|Final&nbsp; is not doing anything.
1618625792

Edited 1618626134
Kurt J. said: sebastien g. said: Michael C. said: I'm no expert but I don't think:&nbsp; --PotionType|[&amp;PotionType] works. I am not sure what you were trying to do with that line but I assume you want a numerical answer and that would be:&nbsp; &nbsp; -- = PotionType|[&amp;PotionType]&nbsp; &nbsp;or perhaps you are assigning the wrong variable and wanted a string assignment --&amp;NameofVariable? I shamelessly copied the script from Kurt 's Post on page 3 of this thread, everything was working fine until last week. Now I will have to understand this script to correct it :-) I copied what you posted into my game, and it worked fine. I know that isn't terribly helpful, but... I copy the script into my new game and I get zero as well. (edit) Didn't have the resources setup and it cause it to roll 0. Working now.&nbsp;
anyone know why this wouldn't work? !token-mod --set statusmarkers|dead this work outside of scriptcard but&nbsp;--@token-mod| _set statusmarkers|dead doesn't work inside my card.I have tried --@token-mod| _set|statusmarkers|dead Did I translate it wrong?&nbsp;