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

@  Will M.  Looking forward to your progress. Might you do one thing to help keep up with that progress? Perhaps at the top of the script you would put the date of the latest update. Paging through so many threads, I can't be sure if I'm looking at an update or simply a topic of discussion. Guys like you add so much good stuff to the community. 
@  Kurt J. April 21, you gave me the following advice: To include a library, you need to add a "+++libraryname+++" line in your card . In the case of 5E Tooks, it would be ###5E Tools### I'm still new to Roll20 nomenclature. What are you referencing with the word "card?" In fact, I'm not sure I understand what you  mean when you say to include a library . . . Where do I include a library? The only experience I have with this type of script/handout combination is with PowerCard Formats . I feel like a level two scriptor trying to communicate with level 10 scriptors.
1622642641
David M.
Pro
API Scripter
Rosco, the "card" shorthand is sometimes used to refer to your scriptcard macro. The wiki has info on how to use libraries - jump to  here . 
Your patience does not go unnoticed.
1622644348
David M.
Pro
API Scripter
Haha, no worries. Keep asking - that's what the forum is for! Kurt has built a monster script that is very powerful, but there's a ton of information to consume all at once. It's a lot easier for those that have had time to digest as new features rolled out over time. Even still, I frequently have to back over old forum posts and the wiki to remember/figure out how to do something, and there's still some stuff I haven't really touched yet.
Hey, New Guys, here’s a heads up: I document the heck out of my scripts, and it caught up with me thus: !scriptcard  {{     ! Note1 - Battleaxe 5/9/2021 This explanation mark works at the beginning of this script     --=WeaponAttacks|1     ! Note2 -  Make sure pb is included: This explanation mark works within this script      --=WeaponPB|@{selected|pb}     --+|Armor class = [$ArmorClass]     ! Note3 – Information about next macro BUT  This explanation mark sends an error to the API console and who knows where else     %{weapon|ComputeAC}     ! Note4 – More information AND This explanation mark may or may not interfere depending on how %{weapon|ComputeAC} concludes }}         I assume the reason explanation mark 3 and 4  errors is:  the --+|Display line will include everything that follows it (same line or next line) that doesn’t start with a new double-dash. I suppose the processor tries to do math with the minus sign following the word  Notes  and cannot. Other dedicated symbols may also interfere.          Jump labels are more secure, but run the risk of duplication if one is not methodically careful.   I’ve gone back to using jump labels like --:macro_Battleaxe| 5/9/2021 and --:macro_Battleaxe_Note1| double hit points here if . . .         For me, when writing code/scripts, the three most important things are 1: document, B: document, Lastly: document.
1622654327

Edited 1622654990
David M.
Pro
API Scripter
I think exclamation mark is asking for trouble since if it gets passed to chat, the chat parser might think it is a new script command. For comments in your macro, the delimiter  --/|  has been reserved. If you start a line with that, the line will be ignored.  EDIT - This is technically in the wiki, but very easy to miss. If you jump to the Example Libraries  section, scroll up and it's in the last sentence of the preceding paragraph. Kurt, it might be good to put a header above that sentence and include it in the index.
The reason for the heads up was it seems to be okay in Powercards. 
I use the --/| syntax as well and usually document my script out in pseudo-code before writing much actual syntax.  I use Sublime as my editor and have begun loading all the ScriptCard syntax in as Scriplets, which has made script writing faster, with many less errors.  For example, I can type scloop[tab] and all the code for a basic loop is automatically inserted, very handy.
1622673517
Kurt J.
Pro
API Scripter
I updated the wiki to add --/ as a statement type and gave it its own section right at the top :)
@  Don R.  I don't like asking help and have someone give me a different way to do it. It's like saying "Why would you do it that way, dummy?"  So I apologize up front if that's how this sounds. Having said that, and since I'm not sure if you are having a macro code problem or a calling the macro code from a character sheet problem, allow me to simiply show you how I have quit the collection macros all together (all most) in favor of the character sheet macros that's become way more versatile for me. Example-Sheet1 = player's sheet called Onad the Terrible     Within character sheet's abilities section, I create the macro Battleaxe thus (which fits nicely in all the player's sheets.)     script {{   %{Weapon|Battleaxe} }}     When the player clicks on that ability, it will call on Sheet2's Battleaxe ability. Example-Sheet2 = called Weapon is an unfinshed character sheet neither pc nor npc; just access to the abilities. On the  Weapon  sheet, I add an ability called Battleaxe that looks like this: (trimmed down for show) Battleaxe script{{     --:macro_Ability_Battleaxe| 6/2/2021     --&WeaponName|Battleaxe     --&AbilityCategory|Str     --&WeaponDmgType|Slash     --&WeaponHanded|1     --&WeaponDmgLabel|1d10     --=WeaponDmg|1d10     --=WeaponDmgCrit|1d10+1d10     --&WeaponType|Melee     %{Weapon|Attack} }} Attack     --:macro_Ability_Attack| 6/2/2021     %{Weapon|Scan_Target}     %{Weapon|San_Attacker}     %{Weapon|Roll_To_Hit}     %{Weapon|Compute_Damage}     %{Weapon|Display_Results} --:End_Of_Attack| This example is chuck full of unfinished business and meant only to demonstrate an idea. There may be other, better ways, but this concept works well for me. And it's so much easier to keep track of the macros, not to mention adding unique weapons per player. I have a sheet for Weapons, one for Spells, another one because two's not enough.
Will M. said: I use the --/| syntax as well and usually document my script out in pseudo-code before writing much actual syntax.  I use Sublime as my editor and have begun loading all the ScriptCard syntax in as Scriplets, which has made script writing faster, with many less errors.  For example, I can type scloop[tab] and all the code for a basic loop is automatically inserted, very handy. So is --/| just a comment line ?
1622730129
David M.
Pro
API Scripter
Craven said: So is --/| just a comment line ? Right.
1622804993

Edited 1622832664
Kurt J.
Pro
API Scripter
ScriptCards v 1.3.1 - Some Rewrites and Tweaks Version 1.3.1 of ScriptCards is now available on the Development GIST . If all goes well with this version, I'm going to take a pause in making new changes and move this version forward to OneClick. Theoretically the changes in this version should go unnoticed unless you were trying to nest references - which should work as logically expected now. I've tested 1.3.1 with my most complicated cards and they seem to function normally, but please let me know if you run into issues. Here are the updates: Behavior Change:  Rewrote all content substitution code as a single function that works from the innermost set of references outward, so something like  &wow[$count[&suffix]]] will process [&suffix] first, then [$countX] where X is the result of [&suffix] and finally [&wow1] where 1 is the result of [$countX]. This makes the language more logical and variable resolution more deterministic. It is also a huge performance improvement, since the way variables were replaced previously was highly non-optimal. NOTE : as a side effect of this change, some of the uncommonly used settings ( disablerollvariableexpansion and similar) will not function at this time. They were primarily for debugging purposes and will return in a future update, but won't have an effect at this time. Array Referencing : It is now possible to reference array items directly with the [@arrayName(index)] syntax. The first element of the array is index 0, etc. Additional Roll Variable Suffix : You can now use ".Raw" suffix when referencing a roll variable to skip formatting the result as a roll. This shouldn't normally be necessary, as roll formatting is only done on --+ and --* lines, but it is available, especially given the special note in the previous item. Behavior Change: When generating tooltips (and only  when generating tooltips) for roll variable display, the "~" character will be removed. This makes it easier to hide what look like rolls from the chat server when referencing nested values (ie, [~[&shortSaveNameUpper]~]) when you just want the value of the variable in square brackets as an explanation, since using [[&shortSaveNameUpper]] would look like an inline roll to the chat server. Feature Update:  Added support for new token properties added to Roll20 on 2021-06-03 ( bar_location , compact_bar , light_sensitivity_multiplier , and night_vision_effect ). As with all token references, these are made with the "t-" prefix.
1622807745
David M.
Pro
API Scripter
Cool, thanks Kurt! Re-writes are always "fun". It is appreciated!
Cool beans!
I have tried several different methods to try to access the maximum value of a repeating resource in script cards but clearly can't get the syntax right.  My most recent iteration: [*[&tokenid]:repeating_resource_$[$Resource]_resource_left|max]   also  [*[&tokenid]:repeating_resource_$[$Resource]_resource_left_max] What is the correct syntax?
1622826022

Edited 1622826257
Kurt J.
Pro
API Scripter
Michael C. said: I have tried several different methods to try to access the maximum value of a repeating resource in script cards but clearly can't get the syntax right.  My most recent iteration: [*[&tokenid]:repeating_resource_$[$Resource]_resource_left|max]   also  [*[&tokenid]:repeating_resource_$[$Resource]_resource_left_max] What is the correct syntax? So this is going to be a bit more complicated than perhaps anticipated :) Repeating attributes (of any kind) are one of the weirdest setups in Roll20. While the chat server can refer to an attribute with the "_$0_" sequence, that isn't what they are actually called internally, and if you add and remove repeating rows the numbers can actually change or be skipped. This is where the --R command comes in. Here is a simple example of getting the max value of a repeating resource: !script {{   --rfirst|@{selected|character_id};repeating_resource   --+Current|[*R:resource_left]   --+Max|[*R:resource_left^] }} However, there are some issues with this because, again, you don't know if the order has been changed. The repeating resources are even worse, because the first row (the class resources) aren't repeating at all. To get around this, I have a subroutine in the dnd5elib library that I've pulled out and modified here (I'll need to update the function in the library because this one is much better): !script {{ -->Lib5E_FindResource|@{selected|character_id};Arrows;resName;resValue;resMax;resSide --~resID|string;after;repeating_resource_;[&resName] --~resID|string;before;_resource;[&resID] --+Repeating ID|[&resID] --+Current|[&resValue] --+Max|[&resMax] --+Current via Reference|[*@{selected|character_id}:repeating_resource_[&resID]_resource_[&resSide]] --+Max via Reference|[*@{selected|character_id}:repeating_resource_[&resID]_resource_[&resSide]^] --X| --:Lib5E_FindResource|character_id;resourceName;resourceReturnNameStringVariable;ResourceReturnValueStringVariable;ResourceMaxValueStringVariable;SideStrinVar --C[%2%]|[*[%1%]:class_resource_name]:_Lib5E_IsResourceClass|[*[%1%]:other_resource_name]:_Lib5E_IsResourceOther --?"[%2%]" -eq "[*[%1%]:class_resource_name]"|_Lib5E_IsResourceClass --?"[%2%]" -eq "[*[%1%]:other_resource_name]"|_Lib5E_IsResourceOther --Rfirst|[%1%];repeating_resource --:_Lib5E_ResourceLoop| --?"[*R:resource_left_name]" -eq "[%2%]"|_Lib5E_IsResourceLeft --?"[*R:resource_right_name]" -eq "[%2%]"|_Lib5E_IsResourceRight --Rnext| --?"[*R:resource_left_name]" -ne "NoRepeatingAttributeLoaded"|_Lib5E_ResourceLoop --&[%3%]|NotFound --&[%4%]|NotFound --&[%4%]|0 --&[%5%]|0 --&[%6%]|NotFound --<| --:_Lib5E_IsResourceClass| --&[%3%]|class_resource_name --&[%4%]|[*[%1%]:class_resource] --&[%5%]|[*[%1%]:class_resource^] --&[%6%]|class --<| --:_Lib5E_IsResourceOther| --&[%3%]|other_resource_name --&[%4%]|[*[%1%]:other_resource] --&[%5%]|[*[%1%]:other_resource^] --&[%6%]|other --<| --:_Lib5E_IsResourceLeft| --&[%3%]|[*R>resource_left_name] --&[%4%]|[*R:resource_left] --&[%5%]|[*R:resource_left^] --&[%6%]|left --<| --:_Lib5E_IsResourceRight| --&[%3%]|[*R>resource_right_name] --&[%4%]|[*R:resource_right] --&[%5%]|[*R:resource_right^] --&[%6%]|right --<| --<| }} The first line calls the library, giving it the resource name "Arrows" to look for. The subroutine will look at the two fixed resource boxes and see if they match, and then will start going through repeating resources checking the left and right names looking for the intended resource. Once it finds one, it sets the passed variable names to the corresponding values. In this case, resName is set to the attribute name value of the corresponding attribute name, resValue is set to the current resource value, and resMax is set to the max value. resSide is set to "class", "other", "left", or "right". In the sample above, we use two string replacements on resName to pull out just the "id" part of the name so we can use it later. The rest of the top part of the script is just displaying the values that were set by the procedure. The last two (current via reference and max via reference) show how to use the [*:] notation to reference the two values - the "^" on the end indicates the max value for the last one.
1622826164

Edited 1622831138
I've run through all my macros against 1.3.1 and it appears stable, and a little faster.  
1622826322
Kurt J.
Pro
API Scripter
Will M. said: I've run through all my macros with against 1.3.1 and it appears stable, and a little faster.   Great to hear Will. Thank you for the testing and feedback :) The previous replacement code was really inefficient, so I'm happy to hear you could notice a speed improvement.
1622831817

Edited 1622831927
Picking up on something interesting from a previous post.  I didn't realize that you could dynamically use a variable to define a variable name.  So it appears this might work:      For Loop on x to 10 step 1 //pseudo code         For Loop on y to 5 step 1                 --&myAry[&x]_[&y]|A test record for [&x] and [&y]         Next     Next and would establish a series of variables:     myAry1_1 = A test record for 1 and 1     myAry2_1 = A test record for 2 and 1     myAry3_1 = A test record for 3 and 1     myAry4_1 = A test record for 4 and 1     ...     ...     myAry10_4 = A test record for 10 and 4     myAry10_5 = A test record for 10 and 5 If this works, it would basically simulate a very basic multi-dimensional array.  Is this correct?
1622832584
Kurt J.
Pro
API Scripter
Will M. said: Picking up on something interesting from a previous post.  I didn't realize that you could dynamically use a variable to define a variable name.  So it appears this might work:      For Loop on x to 10 step 1 //pseudo code         For Loop on y to 5 step 1                 --&myAry[&x]_[&y]|A test record for [&x] and [&y]         Next     Next and would establish a series of variables:     myAry1_1 = A test record for 1 and 1     myAry2_1 = A test record for 2 and 1     myAry3_1 = A test record for 3 and 1     myAry4_1 = A test record for 4 and 1     ...     ...     myAry10_4 = A test record for 10 and 4     myAry10_5 = A test record for 10 and 5 If this works, it would basically simulate a very basic multi-dimensional array.  Is this correct? Yes, that should work. In fact, that is how my fireball/burning hands sample macro works. It dynamically creates variables for each x/y location and appends token ids to them using the same concept.
1622832705
Kurt J.
Pro
API Scripter
I edited the 1.3.1 release notes above, as I forgot to include the new array item referencing syntax in the notes :)
I'm working on a character sheet who's attacks are not a repeating section but instead named atk1-name through atk8-name.  I would like to do something like Rfind to create buttons for the attacks the player has and ignore the blank attacks.  Is this even possible?  Do I need to change the section to a repeating section?
@Kurt J.  Well.  I guess that explains why I couldn't get it to work.  :-)  The original idea came from having to modify my Long Rest script to include a multitude of repeating Rune resources for a Rune Knight.  The character had used up $0 to $5 of them, left and right.  As to class resource and other resource, the following seems to have worked for me:   --/|Subroutine to check class/other resource   --:CheckClass|pass [&tokenid]       --?[*[&tokenid]:class_resource] -eq 0|CheckOther;[&tokenid]       --@setattr| _silent _charid [*[&tokenid]:character_id] _class_resource|%class_resource_max%      --:CheckOther|pass [&tokenid]       --?[*[&tokenid]:class_resource] -eq 0|CheckResources;[&tokenid]       --@setattr| _silent _charid [*[&tokenid]:character_id] _other_resource|%other_resource_max%    --<|   --:CheckResources| It was at this point I was trying to test each repeating resource for a non-zero entry and reset the resource to maximum if it found a resource present.  I am going to have to work through your example to see how that might be done.  (Disregard the flop sweat on my forehead.)  :-)
Brien V. said: I'm working on a character sheet who's attacks are not a repeating section but instead named atk1-name through atk8-name.  I would like to do something like Rfind to create buttons for the attacks the player has and ignore the blank attacks.  Is this even possible?  Do I need to change the section to a repeating section? Let's see if i got you well : atk1-name: Axe atk2-name: Bow atk3-name: Brawl atk4-name: BLANK  and so are atk5 up to atk8 ! Well if it's the case you do not need to set up a repeating section! All you need to do is setup a loop that checks wether atkx-name is BLANk or not and if it's not the case then show the damn button.... But again I might not have understood quite exactly wot you wanna do !
1622844127
Kurt J.
Pro
API Scripter
Brien V. said: I'm working on a character sheet who's attacks are not a repeating section but instead named atk1-name through atk8-name.  I would like to do something like Rfind to create buttons for the attacks the player has and ignore the blank attacks.  Is this even possible?  Do I need to change the section to a repeating section? There isn't a one-command equivalent, but it would be easy enough to use a for loop and dynamically look for a match. I haven't tested the code below, but something along these lines: !script {{ --#sourcetoken|@{selected|token_id} --%atkNum|1;9;1 --?"[*S:atk[&atkNum]-name]" -eq "Greatsword"|%! --%| --?[&atkNum] -eq 9|attackNotFound --/|At this point, you know the attack number is in [&atkNum] and you can retrieve --/|the information about it with [*S:atk[&atkNum]-ATTRIBUTE] --:attackNotFound| --+|No matching attack found --X| }}
@Kurt J.  In your example above, would I add  +++dnd5elib+++  to the beginning of the scriptcard?
1622850314
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt J.  In your example above, would I add  +++dnd5elib+++  to the beginning of the scriptcard? The function I included above is a much revised version of the library function, so it is probably better right now to just add it to the end of the script. I haven't updated the library yet.
Kurt J. said: There isn't a one-command equivalent, but it would be easy enough to use a for loop and dynamically look for a match. I haven't tested the code below, but something along these lines: !script {{ --#sourcetoken|@{selected|token_id} --%atkNum|1;9;1 --?"[*S:atk[&atkNum]-name]" -eq "Greatsword"|%! --%| --?[&atkNum] -eq 9|attackNotFound --/|At this point, you know the attack number is in [&atkNum] and you can retrieve --/|the information about it with [*S:atk[&atkNum]-ATTRIBUTE] --:attackNotFound| --+|No matching attack found --X| }} That put me on the right track and this is what I came up with.   !script {{ --#sourcetoken|@{selected|token_id} --%atkNum|1;8;1 --+[c][button][*S:atk[&atkNum]-name]::!
!setattr --sel --weaponname|[*S:atk[&atkNum]-name][/button][/c]| --?"X[*S:atk[&atkNum]-name]X" -eq "XX"|%! --%| }} The only thing I can't figure out is I still get one button that is blank, I assume from it seeing the last attack name blank and ending the loop.  Is there a way to get rid of the blank input?
1622902336
Kurt J.
Pro
API Scripter
Brien V. said: Kurt J. said: There isn't a one-command equivalent, but it would be easy enough to use a for loop and dynamically look for a match. I haven't tested the code below, but something along these lines: !script {{ --#sourcetoken|@{selected|token_id} --%atkNum|1;9;1 --?"[*S:atk[&atkNum]-name]" -eq "Greatsword"|%! --%| --?[&atkNum] -eq 9|attackNotFound --/|At this point, you know the attack number is in [&atkNum] and you can retrieve --/|the information about it with [*S:atk[&atkNum]-ATTRIBUTE] --:attackNotFound| --+|No matching attack found --X| }} That put me on the right track and this is what I came up with.   !script {{ --#sourcetoken|@{selected|token_id} --%atkNum|1;8;1 --+[c][button][*S:atk[&atkNum]-name]::!
!setattr --sel --weaponname|[*S:atk[&atkNum]-name][/button][/c]| --?"X[*S:atk[&atkNum]-name]X" -eq "XX"|%! --%| }} The only thing I can't figure out is I still get one button that is blank, I assume from it seeing the last attack name blank and ending the loop.  Is there a way to get rid of the blank input? Swap the button line and the end-the-loop on blank line.
Kurt J. said: Swap the button line and the end-the-loop on blank line. My savior once again. Thank you.
Hi Masters of the Script, Still a newbie here and I have created this (more like stolen and tried to get it working for what my gm wants) Im using pathfinder so when you roll a 20 to Crit you need to reroll the dice to confirm beating the enemy AC. Our gm doesnt want us to have access to the AC so i just used a placeholder to say there AC but whenver I roll a crit it rerolls the dice but always gets another CRIT. Can someeone help me, my script is below: !scriptcard  {{   --#title|Claws   --#titlecardbackground|#993333   --#leftsub|Melee Attack   --#rightsub|5’ Reach   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|@{selected|token_name} attacks @{target|token_name}   --=AttackRoll|1d20 + @{selected|strength_mod} [STR] + @{selected|bab} [BAB]   --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC   --?[$AttackRoll.Base] -eq 20|Crit   --?[$AttackRoll.Base] -eq 1|Critical Miss   --:If Hit|   --=Damage|1d8 + @{selected|strength_mod} [STR]   --+If Hit|The attack deals [$Damage] slashing damage  to @{target|token_name}   --^Final|     --:Critical Miss|   --+Critical Miss!|That was embarrassing…   --^Final|     --:Crit|   --=ConfirmCrit|1d20 + @{selected|strength_mod} [STR] + @{selected|bab} [BAB]   --+ConfirmCrit|@{selected|token_name} rolls [$AttackRoll] vs AC   --=Crit|1d8 + @{selected|strength_mod} [STR] + 1d8 + @{selected|strength_mod} [CRIT]   --=Damage|1d8 + @{selected|strength_mod} [STR]   --+Crit|The attack deals [$Crit] slashing damage to @{target|token_name}   --+NotCrit|The attack deals [$Damage] slashing damage to @{target|token_name}     --:Final| }}
Wow, I actually figured it out, had the second roll set to AttackRoll Instead of ConfirmCrit.... my apolgies... sorry about that
1623002660

Edited 1623002686
David M.
Pro
API Scripter
EDIT - cross-posted! @Tyler, I think your problem is in this line:  --+ConfirmCrit|@{selected|token_name} rolls [$AttackRoll] vs AC You are referencing the original attack roll, rather than the confirmation roll. I think it should read:   --+ConfirmCrit|@{selected|token_name} rolls [$ ConfirmCrit ] vs AC
1623004513

Edited 1623005813
Okay my turn to wish upon a star. When I write a line like:   --IPick a target for [&Ray1];[&Ray1]|t;Target1;Target for [&Ray1]   -->[&Ray1]|[*[&Target1]:character_name] Obviously I can pull down the character name from the selected token, but is there any way to directly or indirectly get the token image so that it can be displayed in the car output, maybe by fetching the url?  I've made a multi attack for my beholder where he selects several targets and I thought it would be nice to show their token images  alongside the attacks.
1623007322

Edited 1623008962
Kurt J.
Pro
API Scripter
CURTIS C. said: Okay my turn to wish upon a star. When I write a line like:   --IPick a target for [&Ray1];[&Ray1]|t;Target1;Target for [&Ray1]   -->[&Ray1]|[*[&Target1]:character_name] Obviously I can pull down the character name from the selected token, but is there any way to directly or indirectly get the token image so that it can be displayed in the car output, maybe by fetching the url?  I've made a multi attack for my beholder where he selects several targets and I thought it would be nice to show their token images  alongside the attacks. Here is a simple example... in this script I got ahead and pick targets, but using your --l command you would just substitute the @{target...} entries below with the token ids returned by your selection: !script {{ --#targettoken|@{target|target1|token_id} --+|[t][tr][td][img width=50][*T:avatar][/img][/td][td][*T:character_name] gets roasted by a fire beam[/td][/tr][/t] --#targettoken|@{target|target2|token_id} --+|[t][tr][td][img width=50][*T:avatar][/img][/td][td][*T:character_name] gets zapped by a lightning beam[/td][/tr][/t] --#targettoken| }} The "avatar" property of a token contains the URL of the token's image, and the [img]...[/img] tags can be used to insert it in to the output. I put table tags around it because the word wrapping looks weird otherwise :) The last thing I do above is set targettoken to nothing so it doesn't put the last target as an image on the right side of the emote.
Thank you. I did not know about the "Avatar" Property.  Kurt J. said: CURTIS C. said: Okay my turn to wish upon a star. When I write a line like:   --IPick a target for [&Ray1];[&Ray1]|t;Target1;Target for [&Ray1]   -->[&Ray1]|[*[&Target1]:character_name] Obviously I can pull down the character name from the selected token, but is there any way to directly or indirectly get the token image so that it can be displayed in the car output, maybe by fetching the url?  I've made a multi attack for my beholder where he selects several targets and I thought it would be nice to show their token images  alongside the attacks. Here is a simple example... in this script I got ahead and pick targets, but using your --l command you would just substitute the @{target...} entries below with the token ids returned by your selection: !script {{ --#targettoken|@{target|target1|token_id} --+|[t][tr][td][img width=50][*T:avatar][/img][/td][td][*T:character_name] gets roasted by a fire beam[/td][/tr][/t] --#targettoken|@{target|target2|token_id} --+|[t][tr][td][img width=50][*T:avatar][/img][/td][td][*T:character_name] gets zapped by a lightning beam[/td][/tr][/t] --#targettoken| }} The "avatar" property of a token contains the URL of the token's image, and the [img]...[/img] tags can be used to insert it in to the output. I put table tags around it because the word wrapping looks weird otherwise :) The last thing I do above is set targettoken to nothing so it doesn't put the last target as an image on the right side of the emote.
  --?[$AttackRoll.Base] -eq 20|Crit How would I properly change this to allow for a 19-20 crit instead of just a 20?
Tyler said:   --?[$AttackRoll.Base] -eq 20|Crit How would I properly change this to allow for a 19-20 crit instead of just a 20? I'm sure there's a more elegant way but I would just do --?[$AttackRoll.Base] -eq 20 OR [$AttackRoll.Base] -eq 19|Crit
1623024385
David M.
Pro
API Scripter
Can also just make it into a single >= comparison with --?[$AttackRoll.Base] -ge 19|Crit
Just a mild issue - after the last update the grouphealth scriptcard I borrowed from another player had a glitch it hadn't before.  I don't know if they are connected: !scriptcard  {{   --#title|Group Health   --#titleCardBackground|#006400   --#oddrowbackground|#bfee90   --#evenrowbackground|#90eebf   -->HealthCheck|@{Bowie|character_id}   -->HealthCheck|@{Neeka|character_id}   -->HealthCheck|@{Throk|character_id}   -->HealthCheck|@{Peim|character_id}   -->HealthCheck|@{Physic|character_id}   --X|End of card Execution   --:HealthCheck|     --=HealthPerc|[*[%1%]:hp] / [*[%1%]:hp^] * 100 \ 1     --=HealthColor|000000     --?[$HealthPerc.Total] -gt 50|HealthSkip     --=HealthColor|FF0000     --:HealthSkip|     --+[*[%1%]:character_name]|has [#[$HealthColor.RollText]][*[%1%]:hp] of [*[%1%]:hp^][/#] HP [R]([$HealthPerc.Total]%)[/R]   --<|End of HealthCheck }}   The part that was odd was the:  [#[$HealthColor.RollText]] section which ceased changing the color of the text. 
1623101273
Kurt J.
Pro
API Scripter
Michael C. said: Just a mild issue - after the last update the grouphealth scriptcard I borrowed from another player had a glitch it hadn't before.  I don't know if they are connected: !scriptcard  {{   --#title|Group Health   --#titleCardBackground|#006400   --#oddrowbackground|#bfee90   --#evenrowbackground|#90eebf   -->HealthCheck|@{Bowie|character_id}   -->HealthCheck|@{Neeka|character_id}   -->HealthCheck|@{Throk|character_id}   -->HealthCheck|@{Peim|character_id}   -->HealthCheck|@{Physic|character_id}   --X|End of card Execution   --:HealthCheck|     --=HealthPerc|[*[%1%]:hp] / [*[%1%]:hp^] * 100 \ 1     --=HealthColor|000000     --?[$HealthPerc.Total] -gt 50|HealthSkip     --=HealthColor|FF0000     --:HealthSkip|     --+[*[%1%]:character_name]|has [#[$HealthColor.RollText]][*[%1%]:hp] of [*[%1%]:hp^][/#] HP [R]([$HealthPerc.Total]%)[/R]   --<|End of HealthCheck }}   The part that was odd was the:  [#[$HealthColor.RollText]] section which ceased changing the color of the text.  Good catch :) That's actually one of my early test script before string variables existed, or the health colors would be strings. The complete fix for this is twofold. First, I updated the 1.3.1 code on the GIST (and what is headed for OneClick) to only perform roll formatting when the ".Total" (or nothing) value is being used for roll variables. The last change would be to the [$HealthPerc.Total] line, which should be change to [$HealthPerc.Raw] to prevent the roll formatting around the percentages.
@Kurt - Thanks!
I have a drop down menu on my character sheet that allows the player to set a weapon to either melee, ranged, or area.  The drop down actually connects to a formula but I would like the scriptcard to just reference the text in the dropdown.  Is there a way I could reference this in the card?
1623173758
David M.
Pro
API Scripter
If the contents of the drop down are within the character sheet itself (which likely populates attributes etc. with a sheetworker), I don't believe the api can access those contents directly.  Are to trying to extract whether a certain weapon is melee, ranged, or area? You can use Rfind ad *R to filter and reference some properties of existing weapon entries, might be some mileage there. The trick would be to figure out the field names. You may need to try right clicking the repeating row and selecting "inspect" to find the field names (e.g. atkname, atkrange, etc. for 5e sheet). --Rfind|characterid;EntryName;SectionPrefix;SearchField [*R:attributename]
David M. said: If the contents of the drop down are within the character sheet itself (which likely populates attributes etc. with a sheetworker), I don't believe the api can access those contents directly.  Are to trying to extract whether a certain weapon is melee, ranged, or area? You can use Rfind ad *R to filter and reference some properties of existing weapon entries, might be some mileage there. The trick would be to figure out the field names. You may need to try right clicking the repeating row and selecting "inspect" to find the field names (e.g. atkname, atkrange, etc. for 5e sheet). --Rfind|characterid;EntryName;SectionPrefix;SearchField [*R:attributename] What if it's not a repeating sections?  Yeah, the drop down just shows the attack type but the actual output is a formula.
1623184093
Kurt J.
Pro
API Scripter
Version 1.3.1 is now live on OneClick For the first time in ages, the dev and OneClick versions are synced up :) I'll make updates to the Wiki to remove the "Requires x.x.x" over the next few days.