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

1626197052

Edited 1626197375
@Walexsmith - I have not used the command that much (Kurt has a good example in his magic missile macro) but, to start with, I think that the command lines are case sensitive.&nbsp; You might try --i instead.&nbsp; Edit: you might get a better answer on Kurt's Discord at:&nbsp;<a href="https://discord.gg/gTzRkdvY" rel="nofollow">https://discord.gg/gTzRkdvY</a>
1626220942
Kurt J.
Pro
API Scripter
Walexmith said: There are a couple of work arounds using buttons or the --i command but no way to bypass that I know of. Thanks. I hadn't dug that far in the documentation. Ha! So I rewrote the --:Canoe part --:Canoe| --I is the party in a ;Canoë?|q;Transport;Canoe?|in a canoe|on foot Though now it seems I cannot reference this variable anymore after the --i command. For example, I'd like to be abble to tell my script that if the party is in a canoe, they can have a normal movement speed of 2, a slow speed of 1-(0 or 1), and a haste speed of 2+(0 or 1), both being defined at random (50% chance). This last line doesn't seem to be working --:Canoe| --I is the party in a ;Canoë?|q;Transport;Canoe?|in a canoe|on foot --?[&amp;Transport] -inc "canoe"|=Avancement;2 --&lt;| I did try this, as well. Doesn't seem to work either. --I The party is in a ;Canoë?|q;Avancement;Canoe?|in a canoe,2|on foot,1 Any idea? Because [&amp;Transport] can contain a space, you need to surround it with quotes: --?"[&amp;Transport]" -inc "canoe"|=Avancement;2 There should be an error in the console log about an invalid conditional joiner.
1626322243

Edited 1626323046
Ivo
Pro
The --#whisper|gm command doesnt appear to be working? Using 1.3.8 !scriptcard {{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#​​​​​whisper|gm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#title|Whisper &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --+|Hello }} EDIT: Ok that's weird, tried using GM rather than gm, and it worked. Now however if I switch back to gm, it still works, go figure
1626355549

Edited 1626388770
Ivo
Pro
!scriptcard {{ +++dnd5elib+++ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#whisper|GM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#emoteState|0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#sourceToken|-MeYmhLQP0yvAdJWSBZq &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#titlecardbackground|#990000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#evenrowbackground|#B6AB91 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#oddrowbackground|#CEC7B6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#buttonFontSize|x-medium &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#buttonBackground|#666666 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#targetToken|[*S:t-bar3_value] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --#title|[*T:t-name] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt;Lib5E_NPC_Target_Summary|[*T:id] &nbsp; --X| }} Just to clarify, the --#sourceToken is a GM token that is on all maps, I use it to store the token-id of the current token in bar3value when the turn order is advanced. I grab the bar3vale and use it as the targetToken, which means I don't have to manually select the token after my script pings to that token at start of turn. This throws the following error into the log "Error: No attribute or sheet field found for character_id -MCi6OaJsLNnJQrzhB5f named id" This comes from the use of&nbsp; [*T:id] It works as intended, but the error still appears in the log. If I use&nbsp; --#targetToken|@{target|token_id} etc it again works fine, but doesnt throw the error Thoughts?
Hi Kurt, Still some issues with latest versions that was fine in 1.2.8.... For some reason the&nbsp;BuildAndAskTargets sub doesn't seem to operate anymore and thus the loop is only processed once ! the sub : --:BuildAndAskTargets|parameter is NumCibles &nbsp; --&amp;TargetString| &nbsp; --=targetCount|1 &nbsp; --:TargetLoop| &nbsp; --&amp;TargetString|+t;target[$targetCount.Total];Cible [$targetCount.Total] du pouvoir &nbsp; --=targetCount|[$targetCount.Total] + 1 &nbsp; --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator &nbsp; --?[$targetCount.Total] -le [%1%]|TargetLoop &nbsp; --IVeuillez clicker sur le bouton ci-dessous pour sélectionner vos cibles. Une même cible peut être sélectionnée plusieurs fois;Select [%1%] Targets|[&amp;TargetString] &nbsp;--&lt;| &nbsp; --:AddSeparator| &nbsp; --&amp;TargetString|+|| &nbsp; --&lt;| and where it's called : --:Onde trihnique_DISPLAY| --#sourceToken|@{selected|token_id} --#whisper|0 --#emoteText|[*S:character_name] lance une onde trihnique --&amp;Rouge|990000 --&amp;Vert|007700 --=HitScore|[%1%]+[&amp;NivTrihn] --=calcul1|[$HitScore]/3 --~FinalHS1|math;ceil;[$calcul1] --=NbCibles|[*S:magie] --&gt;BuildAndAskTargets|[$NbCibles.Total] --=DisplayCount|1 --&amp;Desc1a|[b][*S:character_name][/b] libère une Onde trihnique qui attaque [*S:magie] cibles en interaction.&nbsp; --&amp;Desc1b|Le type de Trihn consumé pour lancer l'attaque ([b][&amp;Trihn][/b]) détermine le Trihn ciblé et la Défense à dépasser avec un Test de [b]MAGIE[/b]. --+|[&amp;Desc1a] --+|[&amp;Desc1b] --:OndeTrihniqueLoop| --&gt;OTrihnique|[$DisplayCount.Total];[$HitScore] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$NbCibles]|OndeTrihniqueLoop --X| While debugging, NbCibles was set to 11, but somehow it looks like DisplayCount is not incremented or perhaps it's due to your new conditionnal ? Any idea ?
Anyone else experiencing a sudden change to the button in --i commands?&nbsp; All of a sudden none of my magic missile and similar macros that use --i target selects are working.&nbsp; They don't act like buttons - just text?
Hi Michael, That was one potential assumption that I had in my previous post..... Looks like the first --I is working but the second one that is ran through my sub BuildAndAskTargets is showing only text !....So it seems to be stopping my loop !
1626481169

Edited 1626481894
currently on 1.3.7 just noticed something not quite working right This should take the lowest of the targets Dexterity or Wits and use that as their Defence --?@{target|Dex} &gt;= @{target|Wit}|&gt;Twit|&gt;Tdex --=HitsD|?{Hits from Explode|4} --=NumDice|[$HitsD] - [$Defence] --snip-- --:Twit| --=Defence|@{target|Wit}+ @{target|Def_BONUS} --&lt;| --:Tdex| --=Defence|@{target|Dex}+ @{target|Def_BONUS} --&lt;| But script is defaulting to Dex for some reason even if it is the higher number Oddly another script is behaving differently and not minus the defence from the dice pool --?@{target|Dex} &gt;= @{target|Wit}|&gt;Twit|&gt;Tdex --=NumDice|@{selected|Str} + @{selected|Brawl} - [$Defence] ---snip--- --:Twit| --=Defence|@{target|Wit} + @{target|Def_BONUS} --&lt;| --:Tdex| --=Defence|@{target|Dex} + @{target|Def_BONUS} --&lt;| This was all working, so not sure what are where this has now changed Edit also in 1.3.8
try -ge for greater than or equals.&nbsp;&nbsp; Mark C. said: currently on 1.3.7 just noticed something not quite working right This should take the lowest of the targets Dexterity or Wits and use that as their Defence --?@{target|Dex} &gt;= @{target|Wit}|&gt;Twit|&gt;Tdex --=HitsD|?{Hits from Explode|4} --=NumDice|[$HitsD] - [$Defence] --snip-- --:Twit| --=Defence|@{target|Wit}+ @{target|Def_BONUS} --&lt;| --:Tdex| --=Defence|@{target|Dex}+ @{target|Def_BONUS} --&lt;| But script is defaulting to Dex for some reason even if it is the higher number Oddly another script is behaving differently and not minus the defence from the dice pool --?@{target|Dex} &gt;= @{target|Wit}|&gt;Twit|&gt;Tdex --=NumDice|@{selected|Str} + @{selected|Brawl} - [$Defence] ---snip--- --:Twit| --=Defence|@{target|Wit} + @{target|Def_BONUS} --&lt;| --:Tdex| --=Defence|@{target|Dex} + @{target|Def_BONUS} --&lt;| This was all working, so not sure what are where this has now changed Edit also in 1.3.8
Will M. said: try -ge for greater than or equals.&nbsp; Cheers that worked
Woombak said: Hi Michael, That was one potential assumption that I had in my previous post..... Looks like the first --I is working but the second one that is ran through my sub BuildAndAskTargets is showing only text !....So it seems to be stopping my loop ! I saw that - you posted it on the Discord channel too but I never saw any responses.&nbsp; In my case it is the same --i command subroutine in the macro as the others are redo's of the MM script for other similar spells.&nbsp; (Eldritch Blast, Mass Healing Word, etc.)&nbsp; I have not added nor modified the original macro which has worked up until recently.&nbsp; &nbsp; --:BuildAndAskTargets| &nbsp; &nbsp; &nbsp;--&amp;TargetString| &nbsp; &nbsp; &nbsp;--=targetCount|1 &nbsp; --:TargetLoop| &nbsp; &nbsp; &nbsp;--&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target &nbsp; &nbsp; &nbsp;--=targetCount|[$targetCount.Total] + 1 &nbsp; &nbsp; &nbsp;--?[$targetCount.Total] -le [%1%]|&gt;AddSeparator &nbsp; &nbsp; &nbsp;--?[$targetCount.Total] -le [%1%]|TargetLoop &nbsp; &nbsp; &nbsp;--iPlease click the button below to select magic missile targets. The same target can be selected multiple times;Select [%1%] Targets|[&amp;TargetString] &nbsp; --&lt;| In looking at the subroutine structure I can't see that it is hung up on any of the commands and can only assume it is an API issue.&nbsp; However, as clueless as I am with scriptcards macros, I am even more clueless about API scripts.&nbsp; Is anyone working on this?
1626572029

Edited 1626572137
I'm on day 2 of using Scriptcards and converting all of my other macros. I'm loving it!&nbsp; Really improves the look and feel of the chat and interface.&nbsp; Is there a way to trigger an action with a Button within Scriptcards without have to use another macro? I was working on a Pearl of Power scriptcard that checks for expended spell slots by level, then presents a button for any spell level with expended slots for the player to click and automatically restore one spell slot.&nbsp; Besides my coding being extremely inefficient (I'm sure someone smarter could put a loop in), but really I'm wondering about the [button]Regain Slot::! #Add-Slot1[/button] &nbsp;and whether I could either build the Action within the Scriptcard or if it has to be a separate macro call. &nbsp;!scriptcard {{ --#title|Pearl of Power --#titlecardbackground|#7851a9 --#leftsub|Spell Slots Expended --#rightsub|1 use/day --#sourceToken|@{selected|token_id} --#emoteText|*@{selected|token_name} holds the Pearl and speaks the Command!* --#emoteBackground|#c9daf8 --:VARIABLE DEFINITIONS| --=Used|1 --=Available|@{selected|repeating_resource_$0_resource_left} --=Max|@{selected|repeating_resource_$0_resource_left|max} --=Remaining|[$Available] - [$Used] --=Level1|@{selected|lvl1_slots_total} - @{selected|lvl1_slots_expended} --=Level2|@{selected|lvl2_slots_total} - @{selected|lvl2_slots_expended} --=Level3|@{selected|lvl3_slots_total} - @{selected|lvl3_slots_expended} --=Level4|@{selected|lvl4_slots_total} - @{selected|lvl4_slots_expended} --=Level5|@{selected|lvl5_slots_total} - @{selected|lvl5_slots_expended} --:CheckRemainingUses| --?[$Available.Total] -le 0|&gt;NoMoreUses --:CheckSlots| --?[$Level1] -gt 0|&gt;HasLvl1|&gt;NoLvl1 --?[$Level2] -gt 0|&gt;HasLvl2|&gt;NoLvl2 --?[$Level3] -gt 0|&gt;HasLvl3|&gt;NoLvl3 --?[$Level4] -gt 0|&gt;HasLvl4|&gt;NoLvl4 --?[$Level5] -gt 0|&gt;HasLvl5|&gt;NoLvl5 --X|End Macro --:FUNCTIONS| --:HasLvl1| --+Level 1|[$Level1] [r] [button]Regain Slot::!&amp;#13;#Add-Slot1[/button] [/r] --&lt;| --:NoLvl1| --+Level 1|[$Level1] [r][#990000]Not Available[/#][/r] --&lt;| --:HasLvl2| --+Level 2|[$Level2] [r][button]Regain Slot::!&amp;#13;#Add-Slot2[/button][/r] --&lt;| --:NoLvl2| --+Level 2|[$Level2] [r][#990000]Not Available[/#][/r] --&lt;| --:HasLvl3| --+Level 3|[$Level3] [r][button]Regain Slot::!&amp;#13;#Add-Slot3[/button][/r] --&lt;| --:NoLvl3| --+Level 3|[$Level3] [r][#990000]Not Available[/#][/r] --&lt;| --:HasLvl4| --+Level 4|[$Level4] [r][button]Regain Slot::!&amp;#13;#Add-Slot3[/button][/r] --&lt;| --:NoLvl4| --+Level 4|[$Level4] [r][#990000]Not Available[/#][/r] --&lt;| --:HasLvl5| --+Level 5|[$Level5] [r][button]Regain Slot::!&amp;#13;#Add-Slot3[/button][/r] --&lt;| --:NoLvl5| --+Level 5|[$Level5] [r][#990000]Not Available[/#][/r] --&lt;| --:NoMoreUses| --+[c][#990000]Ability Not Available[/#][/c]| --X|End Macro --&lt;| }} The Add-SlotX macros are pretty simple, but just wondering if they could be someone included as part of the scriptcards macro.&nbsp;&nbsp; #Add-Slot1 !modattr --silent --name @{selected|token_name} --lvl1_slots_expended|+1 !modattr --silent --name @{selected|token_name} --repeating_resource_$0_resource_left|-1 !scriptcard {{ --#hideTitleCard|yes --+|[c]Regained one Level 1 Spell Slot[/c] }}
@Matt M.&nbsp; - I'm a little confused as you are talking spell slots yet using repeating resources which are not the same.&nbsp; Just an FYI, if you are trying to manipulate repeating resources you will need to look back in the forum for Kurt's explanation of the problems manipulating them and the possible library solution. To return all expended spell slots I use: &nbsp; --:Spells| &nbsp; &nbsp; --?[*S:lvl1_slots_total] -eq 0|EndMacro &nbsp; &nbsp; --%LoopCounter|1;9;1 &nbsp; &nbsp; &nbsp; --@setattr| _silent _charid @{selected|character_id} _lvl[&amp;LoopCounter]_slots_expended|0 &nbsp; &nbsp; &nbsp; --?[*S:lvl[&amp;LoopCounter]_slots_total] -eq 0|%! &nbsp; &nbsp; --%| &nbsp; --:EndMacro| &nbsp; --X| You can use a similar macro to output the information: &nbsp; --:Spells| &nbsp; &nbsp; --?[*S:lvl1_slots_total] -eq 0|EndMacro &nbsp; &nbsp; --%LoopCounter|1;9;1 &nbsp; &nbsp; &nbsp; --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] &nbsp; &nbsp; &nbsp; --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] &nbsp; &nbsp; &nbsp; --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] &nbsp; &nbsp; &nbsp; --+|Max Slots Allowed: [$SlotsTotal], Expended: [$SlotsExpended]&nbsp; Remaining:&nbsp; [$SlotsRemaining] &nbsp; &nbsp; &nbsp; --?[*S:lvl[&amp;LoopCounter]_slots_total] -eq 0|%! &nbsp; &nbsp; --%| &nbsp; --:EndMacro| &nbsp; --X| One problem will be that any attempt to illicit an answer to a question from the player about what slot to use through a --? command will be processed first by the program before the information can be printed out. No problem if the player already knows what slot to recover but not if they want to see the status of all of their slots first.&nbsp; Thus, absent a button or use of the --i command there is little one can do. For the button macro - I would just use --+|[button]Slot Recovery::~Macros|SlotRecovery[/button] &nbsp;then a macro that includes: --=SlotToRecover|?{What Level Slot do you wish to recover?|0} --@modbattr| _silent _charid @{selected|:character_id} _lvl[$SlotToRecover] _slots_expended|+1&nbsp; (or -1 depending upon what recordkeeping you are using.) At any rate, those are a few thoughts.&nbsp; Hope it's helpful.
Michael C. said: @Matt M.&nbsp; - I'm a little confused as you are talking spell slots yet using repeating resources which are not the same.&nbsp; Just an FYI, if you are trying to manipulate repeating resources you will need to look back in the forum for Kurt's explanation of the problems manipulating them and the possible library solution.&nbsp; The Repeating Resource is the actual Pearl of Power which has 1 use/day.&nbsp; It gets reset on a Long Rest.&nbsp; I manipulate class, other and repeating resources in other scriptcards with no issue.&nbsp; But in this case, I need to wait until they actually take the action to select and regain a spell slot to decrement the Pearl's use counter.&nbsp; Anyway, I think you answered my question that the button action has to call a separate macro and not a function or procedure within the same Scriptcards macro.&nbsp; I am considering using your loop to grab the Spell Slots Expended and Total by Level though.&nbsp; That is a much more efficient way to grab them.&nbsp; Thanks.
@Matt - Look at the rbutton functionality.&nbsp; It lets you call a routine defined within your macro.&nbsp; It doesn't preserve roll or string variable memory, but does accept one parameter ([&amp;reentryvalue]).&nbsp; I often load up multiple values in this parameter, delimited with backslashes "\", that I later split out.&nbsp;&nbsp;
@Will M.&nbsp; - I am somewhat clueless as to rbutton functionality.&nbsp; (And other things....)&nbsp; &nbsp;Not sure from your description ("call a routine defined within your macro") how rbutton differs from&nbsp; a&nbsp; --&gt;subroutine|parameter command?&nbsp; A form of call to an array? Sorry if this is a stupid question.
1626642450

Edited 1626642566
The button action has to call a separate macro, but the rbutton function can call a subroutine defined within itself.&nbsp; It effectively calls itself and jumps to the routine specified in the action paramater. It allows you to pause execution, and prompt the user (via rbuttons).&nbsp; I use it extensively to build a menu of choices that I can then select from, or I step through logic like a dialog wizard.&nbsp;&nbsp; --#reentrant|RechargePearl --+|[rbutton]Recharge Pearl::RECHARGE;[&amp;Charid][/rbutton] ... ... --x| --:RECHARGE| --&amp;Charid|[&amp;reentryvalue] --/| Do stuff here to recharge your pearl --x| Here's the forum entry that describes the functionality.&nbsp;&nbsp;
Oh, wow.&nbsp; This is great.&nbsp; I will be able to use this extensively and cut down on the number of individual macros I have been creating and instead just jump to a subroutine.&nbsp; Thanks. Will M. said: The button action has to call a separate macro, but the rbutton function can call a subroutine defined within itself.&nbsp; It effectively calls itself and jumps to the routine specified in the action paramater. It allows you to pause execution, and prompt the user (via rbuttons).&nbsp; I use it extensively to build a menu of choices that I can then select from, or I step through logic like a dialog wizard.&nbsp;&nbsp; --#reentrant|RechargePearl --+|[rbutton]Recharge Pearl::RECHARGE;[&amp;Charid][/rbutton] ... ... --x| --:RECHARGE| --&amp;Charid|[&amp;reentryvalue] --/| Do stuff here to recharge your pearl --x| Here's the forum entry that describes the functionality.&nbsp;&nbsp;
Here's code snippets showing how I implement this: Main Code: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--#reentrant|SpawnAberrantSpirit &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... --+|[c]&nbsp; [rbutton]Beholderkin(Genny)::CONFIGURE_SPIRIT;BEHOLDERKIN\[&amp;Spell_Level][/rbutton][/c] --+|[c]&nbsp; [rbutton]Slaad(Sammy)::CONFIGURE_SPIRIT;SLAAD\[&amp;Spell_Level][/rbutton][/c] --+|[c]&nbsp; [rbutton]Star Spawn(Twinkles)::CONFIGURE_SPIRIT;STARSPAWN\[&amp;Spell_Level][/rbutton][/c] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; --x| Subroutine/Procedure: --:CONFIGURE_SPIRIT| --#Title|Setting Up Aberrant Spirit --~Arg|string;split;\;[&amp;reentryval] --&amp;Type|[&amp;Arg1] --=Spell_Level|[&amp;Arg2] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... All your code is now self-contained within one Scriptcard macro.&nbsp; Just realize that any String or Roll variables you previously set are wiped when you Re-Enter your macro with this button.&nbsp; I've toyed with the idea of using state variables or storing data in a character sheet, but loading up the [&amp;reentryval] with a delimited list has worked for me quite well so far.&nbsp;&nbsp;
@Kurt - FYI, the REENTRY functionality isn't defined in the WIKI.&nbsp; &nbsp;This is so handy, it might be worth it's own section.&nbsp;&nbsp;
1626719061

Edited 1626719220
Scriptcards gurus, can someone please help fix the syntax of this.&nbsp; I am trying to compare two variables and take the lower.&nbsp; In the case that the current HP + Healed amount &gt; Max HP, show Max HP. !scriptcard {{ &nbsp; --#hideTitleCard|1 --:VARIABLE DEFINITIONS| &nbsp; --=HitPoints|@{selected|hp} &nbsp; --=HitPointsMax|@{selected|hp|max} &nbsp; --=Healed|[[1d@{selected|hitdieroll}+@{selected|constitution_mod}]] &nbsp; --=HitPointsHealed|[$HitPoints] + [$Healed] &nbsp; --=NewHitPoints|{[$HitPointsHealed],[$HitPointsMax]}kl1 &nbsp; --=Available|@{selected|hit_dice} &nbsp; --=HDMAX|@{selected|hit_dice|max} &nbsp; --=Remaining|[$Available]-1 &nbsp; &nbsp; &nbsp; --+Hit Points:|[$NewHitPoints] }}
1626720881
David M.
Pro
API Scripter
Matt, I'd use a conditional with a direct roll variable assignment, something like this: &nbsp; --?[$HitPointsHealed] -gt [$HitPointsMax]|=NewHitPoints;[$HitPointsMax]|=NewHitPoints;[$HitPointsHealed] To explain the code: If&nbsp;HitPointsHealed is greater than&nbsp;HitPointsMax, then set NewHitPoints to&nbsp;HitPointsMax. Else, set NewHitPoints to HitPointsHealed.&nbsp; Also, you should remove the double brackets when assigning your "Healed" variable, so it would become this: &nbsp; --=Healed|1d@{selected|hitdieroll}+@{selected|constitution_mod}
1626723942

Edited 1626724037
Yes!&nbsp; Thanks David.&nbsp; I had it working with a conditional and sending to one of two different functions where I set the value, but this way is much cleaner and simpler.&nbsp; Thanks! I added the [[ ]] to Healed in my feeble attempts to get the kl1 working.&nbsp; But it didn't help and I decided to seek out the script gurus such as yourself :-) David M. said: Matt, I'd use a conditional with a direct roll variable assignment, something like this: &nbsp; --?[$HitPointsHealed] -gt [$HitPointsMax]|=NewHitPoints;[$HitPointsMax]|=NewHitPoints;[$HitPointsHealed] To explain the code: If&nbsp;HitPointsHealed is greater than&nbsp;HitPointsMax, then set NewHitPoints to&nbsp;HitPointsMax. Else, set NewHitPoints to HitPointsHealed.&nbsp; Also, you should remove the double brackets when assigning your "Healed" variable, so it would become this: &nbsp; --=Healed|1d@{selected|hitdieroll}+@{selected|constitution_mod}
1626746451

Edited 1626746653
I'm having trouble using a Conditional to call a subroutine if the condition is true.&nbsp; It's calling the subroutine, but not returning and just either executing all the other subroutines or just exiting the macro.&nbsp; I am using --&gt;| for the returns on the subroutine, so there must be some issue with the way I am only calling the True state of the conditional.&nbsp;&nbsp; For example, I am building lines of responses based on various conditionals.&nbsp; If true, it should call the subroutine to add the line, then return and go to the next conditional.&nbsp; But it is not working that way. --:REST| &nbsp; --+Hit Points:|@{selected|hp} / @{selected|hp|max} &nbsp; --?@{selected|hp} -eq @{selected|hp|max}|AlreadyMax &nbsp; --?@{selected|hp} -lt @{selected|hp|max} -and @{selected|hit_dice} -ge 1|AddHitDice &nbsp; --?"@{selected|other_resource_name}" -inc "Recovery" -and @{selected|other_resource} -ge 1|AddNaturalRecovery &nbsp; --?"@{selected|class_resource_name}" -inc "Recovery" -and @{selected|class_resource} -ge 1|AddArcaneRecovery --X|End Macro And I have all my Subroutines listed like this: --:AddHitDice|Add line if HP &lt; Max AND have &gt;= 1 Hit Die left --+Hit Dice Remaining|@{selected|hit_dice}[r][button]USE HIT DICE::!&amp;#13;#Use-Hit-Dice[/button][/r] --&lt;| --:AddNaturalRecovery|If Natural Recovery present and available, list it --+Natural Recovery Available|[r][button]USE ABILITY::!&amp;#13;#Natural-Recovery[/button][/r] --&lt;| --:AddArcaneRecovery|If Arcane Recovery present and available, list it --+Arcane Recovery Available|[r][button]USE ABILITY::!&amp;#13;#Arcane-Recovery[/button][/r] --&lt;| --:AlreadyMax|If HP = Max, display message --+[#990000]At maximum hit points[/#]| --&lt;| }} So, how should I correctly call each of the four routines (AlreadyMax, AddHitDice, AddNaturalRecovery and AddArcaneRecovery) and return to move to the next conditional?
1626747044
David M.
Pro
API Scripter
Prefix all the calls to the subprocedures with a "&gt;", for example: &nbsp; --?@{selected|hp} -eq @{selected|hp|max}|&gt;AlreadyMax
David M. said: Prefix all the calls to the subprocedures with a "&gt;", for example: &nbsp; --?@{selected|hp} -eq @{selected|hp|max}|&gt;AlreadyMax Awesome!&nbsp; I actually, just tried that and was coming here to delete my question.&nbsp; I feel a little stupid, but thanks for answering my stupid question :-)
Is there a way to fire the Concentration Script?&nbsp; I tried: --@concentration| [$Spellname] --@concentration --forselected|concentration and I tried just putting !concentration before or after the scriptcards macro None of these worked.&nbsp; I think it has to do with the selected target, but can't tell.&nbsp; Has anyone gotten Concentration API working with scriptcards?
1626780257
David M.
Pro
API Scripter
Matt, I've never used !concentration, but if it requires a selected token then you're on the right track using forselected. Looks like you are just missing the "@" to let scriptcards know you want to call the SelectManager script. Also, just verifying you have SelectManager installed? If so, try this: --@forselected|concentration
@Matt - David's suggestion is quite useful.&nbsp; I have found it to be the only way to call such API's as SpawnDefaultToken in similar applications: &nbsp; --@forselected|Spawn _name|GenericSpellAoE _qty|1 _placement|stack _size|13,13 _side|1 _tokenName|Sick Radiance
@ Kurt/Woombak (et. al.) - Just an FYI on the --i command issue.&nbsp; I am currently running v1.3.8 and David M. suggested I swap out with v1.3.1 to see if the button issue resolved.&nbsp; I did so and discovered that, in fact, v1.3.8 is the likely cause of the problem as v1.3.1 worked correctly.
1626830213
David M.
Pro
API Scripter
Obviously not a long term solution, but if you're not currently using 1.3.8 functionality it could be a band aid until the root cause is identified in the latest version.&nbsp;
1626838138
timmaugh
Pro
API Scripter
I put this info on Matt's thread specifically asking the question about Concentration, but in case someone finds this discussion and needs the same fix... from my read of Concentration, it requires not only the selected tokens but the playerid, too. You can configure SelectManager to give that back (along with the selected tokens) by using the command line: !smconfig +playerid You can confirm that SelectManager is set to give back both the playerid and selected tokens by running the command line: !smconfig You should see both properties listed. I'm not sure this will be the entire fix, but maybe Matt can report back. The one caveat to this is if you have certain scripts that manage things at the campaign level, listening to events and firing messages accordingly (automating TokenMod, or a calendar change, etc.). Sometimes those scripts that are being automated differentiate how they answer the call based on whether the message was sent from a player or the API (figuring that those that come from an API are coming from these campaign event listeners). Such scripts are rare, but they do exist.
1626874007
Kurt J.
Pro
API Scripter
Michael C. said: @ Kurt/Woombak (et. al.) - Just an FYI on the --i command issue.&nbsp; I am currently running v1.3.8 and David M. suggested I swap out with v1.3.1 to see if the button issue resolved.&nbsp; I did so and discovered that, in fact, v1.3.8 is the likely cause of the problem as v1.3.1 worked correctly. I'm looking into this problem.
1626877912
Kurt J.
Pro
API Scripter
Kurt J. said: Michael C. said: @ Kurt/Woombak (et. al.) - Just an FYI on the --i command issue.&nbsp; I am currently running v1.3.8 and David M. suggested I swap out with v1.3.1 to see if the button issue resolved.&nbsp; I did so and discovered that, in fact, v1.3.8 is the likely cause of the problem as v1.3.1 worked correctly. I'm looking into this problem. So far I haven't been able to duplicate this issue. Can someone post a full script that demonstrates it with a description of what should be happening vs what is actually taking place?
1626907122

Edited 1626907343
Kurt J.
Pro
API Scripter
Will M. said: @Matt - Look at the rbutton functionality.&nbsp; It lets you call a routine defined within your macro.&nbsp; It doesn't preserve roll or string variable memory, but does accept one parameter ([&amp;reentryvalue]).&nbsp; I often load up multiple values in this parameter, delimited with backslashes "\", that I later split out.&nbsp;&nbsp; Will - Reentrant buttons should preserve roll, string, and array values from the original macro as long as you set the --#reentrant setting to a non-zero value. This works for me: !script {{ --#reentrant|testing --=Roll|1d20 --+Roll|[$Roll] --&amp;String|That was a [$Roll.Raw]! --~x|array;define;MyArray;Apple;Banana;Orange --+Try it|[rbutton]Hello!::EXEC_PC_SPELL;9[/rbutton] --X| --:EXEC_PC_SPELL| --+ReentryVal|[&amp;reentryval] --+The value of Roll is|[$Roll] --+Value of String|[&amp;String] --+Array|[@MyArray(0)] --X| }}
Wow - I swear I had tested that when you first released reentrant logic and have since incorporated the concept that memory gets wiped on reentry into all my scripts.&nbsp; On the plus side, it probably developed good coding practice for me to assume everything isn't global, and to think more procedural. If the same script is being run simultaneously by two or more users in the same campaign, is it possible the two are cross-sharing memory via the use of a shared State memory?&nbsp; I've seen some random weird stuff happen in the past that led me to believe that might be happening, but so hard to reproduce, I really didn't worry about it.&nbsp;&nbsp;
1626909870
Kurt J.
Pro
API Scripter
Will M. said: Wow - I swear I had tested that when you first released reentrant logic and have since incorporated the concept that memory gets wiped on reentry into all my scripts.&nbsp; On the plus side, it probably developed good coding practice for me to assume everything isn't global, and to think more procedural. If the same script is being run simultaneously by two or more users in the same campaign, is it possible the two are cross-sharing memory via the use of a shared State memory?&nbsp; I've seen some random weird stuff happen in the past that led me to believe that might be happening, but so hard to reproduce, I really didn't worry about it.&nbsp;&nbsp; If they share the same "reentrant" value, then yes they will collide. I'm getting around this in my new Action Menu script with: --#reentrant|CharacterAction @{selected|character_id} And what do you know... I was able to duplicate the "buttons not creating real buttons" issue by trying to include a ":" in the reentrant name as I was posting this... very interesting. Now I just have to figure out how those would be related.
@ Kurt - !scriptcards {{&nbsp; &nbsp; --#title|Magic Missile &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#titleFontColor|#ffffff &nbsp; --#titleCardBackground|#000000 &nbsp; --#evenRowBackground|#ff0000 &nbsp; --#evenRowFontColor|#ffffff &nbsp; --#oddRowBackground|#F1C40F &nbsp; --#oddRowFontColor|#000000 &nbsp; --#debug|1 &nbsp; --~|array;define;targetarray; &nbsp; --=uniquetargetcount|0 &nbsp; --&gt;GetAndCheckSlotInformation| &nbsp; --=MissileCount|[$SlotLevel] + 2 &nbsp; --&gt;BuildAndAskTargets|[$MissileCount.Total] &nbsp; --=DisplayCount|1 &nbsp; --=MissileDamage|0 &nbsp; --#leftsub|Slot level [$SlotLevel] &nbsp; --#rightsub|Ranged Attack &nbsp; --#emoteText|@{selected|character_name} uses a level [$SlotLevel.Total] spell slot to fire [$MissileCount.Total] missiles of magical force! &nbsp; --:MissileLoop| &nbsp; --&gt;FireMissile|[$DisplayCount.Total] &nbsp; --=DisplayCount|[$DisplayCount] + 1 &nbsp; --?[$DisplayCount] -le [$MissileCount]|MissileLoop &nbsp; --+Total|Total damage is [$MissileDamage] &nbsp; --&gt;DeductSpellSlot| &nbsp; --#rightsub|Level [$SlotLevel] Left: [$SlotsRemaining]&nbsp; &nbsp; --&gt;ApplyCumulativeDamage|3 &nbsp; --X| &nbsp; --:FireMissile| &nbsp; --&amp;ThisTarget|[&amp;target[%1%]] &nbsp; --=ThisMissile|1d4 + 1 &nbsp; --=MissileDamage|[$MissileDamage] + [$ThisMissile] &nbsp; --+Missile|[$DisplayCount.Raw] Hits [*[&amp;ThisTarget]:character_name] for [$ThisMissile] [b]force[/b] damage &nbsp; --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic;spell_01 &nbsp; --&gt;AccumulateDamage|[&amp;ThisTarget];[$ThisMissile] &nbsp; --&lt;| &nbsp; --:GetAndCheckSlotInformation| &nbsp; --=SlotLevel|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} &nbsp; --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] &nbsp; --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] &nbsp; --?[$SlotsExpended.Total] -ge [$SlotsTotal.Total]|NoSlotsLeft &nbsp; --&lt;| &nbsp; --:NoSlotsLeft| &nbsp; --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. &nbsp; --X| &nbsp; --:DeductSpellSlot| &nbsp; --=SlotsExpended|[$SlotsExpended] + 1 &nbsp; --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent &nbsp; --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] &nbsp; --&lt;| &nbsp; --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect &nbsp; --vtoken|[%1%] [%3%] &nbsp; --vtoken|[%2%] [%4%] &nbsp; --vbetweentokens|[%1%] [%2%] [%5%] &nbsp; --@roll20AM|_audio,play,nomenu|[%6%] &nbsp; --&lt;| &nbsp; --:AccumulateDamage|tokenid;amount &nbsp; --=damage[%1%]|[$damage[%1%]] + [%2%] &nbsp; --~index|array;indexof;targetarray;[%1%] &nbsp; --?[&amp;index] -eq "ArrayError"|[ &nbsp; &nbsp; --~|array;add;targetarray;[%1%] --=uniquetargetcount|[$uniquetargetcount] + 1 &nbsp; --]| &nbsp; --&lt;| &nbsp; --:ApplyCumulativeDamage|bar &nbsp; --%loop|1;[$uniquetargetcount] &nbsp; &nbsp; --&amp;thisTarget|[@targetarray([&amp;loop])] &nbsp; &nbsp; --=thisDamage|[$damage[&amp;thisTarget]] &nbsp; &nbsp; --&gt;ApplyDamageAlterbars|[&amp;thisTarget];1;-[$thisDamage] &nbsp; --%| &nbsp; --&lt;| &nbsp;&nbsp; &nbsp; --/ApplyDamageTokenmod|Parameters are tokenid;bar#;amount &nbsp; --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] &nbsp; --&lt;| &nbsp; --:ApplyDamageAlterbars| &nbsp; --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%] &nbsp; --&lt;| &nbsp; --:BuildAndAskTargets| &nbsp; --&amp;TargetString| &nbsp; --=targetCount|1 &nbsp; --:TargetLoop| &nbsp; --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target &nbsp; --=targetCount|[$targetCount.Total] + 1 &nbsp; --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator &nbsp; --?[$targetCount.Total] -le [%1%]|TargetLoop &nbsp; --iPlease click the button below to select magic missile targets. The same target can be selected multiple times;Select [%1%] Targets|[&amp;TargetString] &nbsp; --&lt;| &nbsp; --:AddSeparator| &nbsp; --&amp;TargetString|+|| &nbsp; --&lt;| }} The error is in the --i button used to select the targets.&nbsp; Rather than be a button it acts as text. (From Entity Formerly Known as &amp;%#* (GM)): &nbsp;Formerly Known as &amp;%#* (GM) Please click the button below to select magic missile targets. The same target can be selected multiple times Select 3 Targets
1626911249
Kurt J.
Pro
API Scripter
Ok. I know what the issue is, but it is going to be a problem to fix it in a way that will make everyone happy :) One of the "bug fixes" in 1.3.8 was to allow formatting to be included in string variable setting lines. This means that this line: &nbsp; --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target Is introducing HTML formatting into the string to allow multiple rolls to be displayed in a string. Changing this to: &nbsp; --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target will fix the script. I could also change it in the API code, but doing so will undo the fix that the change was intended to address.
1626914541

Edited 1626914692
Ivo
Pro
!scriptcard {{ &nbsp; --#title|has Advantage! &nbsp; --#titleCardBackground|#6aa84f &nbsp; --#titleFontColor|#FFFFFF &nbsp; --#emoteBackground|#FFFFFF &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --@setattr|_sel _silent _replace _advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}' _rtype|'\at{advantagetoggle}' }} Truncates after {{advantage=1, none of the rest of the command is processed Using 1.3.8 and the 5E OGL sheet
1626974870

Edited 1626975053
@Ivo:&nbsp; I wrote a function library for setting global NPC parameters in my campaigns a while back.&nbsp; Here is the code I developed to make this work.&nbsp; Warning, they all have the _allgm option which means that this will rip through and adjust these settings globally across all your NPCs in a campaign.&nbsp;&nbsp; As this uses the reentrant buttons to provide a list of options to in a card that you can select from, you'll also want to set a #reentrant parameter for your scriptcard if you use this code as is.&nbsp; Also, these work on the Roll20 D&amp;D 5e OGL sheets.&nbsp; I don't know if they'll work for any of the other sheets out there.&nbsp;&nbsp; You can see I got around the }} issue (Scriptcards sees this and interprets this as the end of the script), through string concatenation. --&amp;P1|{{normal=1} --&amp;P1|+} {{r2=[[0d20 --/|================== Global NPC Settings ======================= --:GLOBAL_NPC_SETTINGS| --#hidecard|0 --&gt;SECTION_HEADER|Whisper Rolls --+|[c][rbutton]Never::APPLY_NPC_GLOBAL_SETTING;WR_Never[/rbutton] [rbutton]Toggle::APPLY_NPC_GLOBAL_SETTING;WR_Toggle[/rbutton] [rbutton]Query::APPLY_NPC_GLOBAL_SETTING;WR_Query[/rbutton] [rbutton]Always::APPLY_NPC_GLOBAL_SETTING;WR_Always[/rbutton] [/c] --&gt;SECTION_HEADER|Roll Queries (Advantage) --+|[c][rbutton]Never::APPLY_NPC_GLOBAL_SETTING;RA_Never[/rbutton] [rbutton]Toggle::APPLY_NPC_GLOBAL_SETTING;RA_Toggle[/rbutton] [rbutton]Query::APPLY_NPC_GLOBAL_SETTING;RA_Query[/rbutton] [rbutton]Always::APPLY_NPC_GLOBAL_SETTING;RA_Always[/rbutton] [/c] --&gt;SECTION_HEADER|Automatic Damage Rolls --+|[c][rbutton]On::APPLY_NPC_GLOBAL_SETTING;DT_On[/rbutton] [rbutton]Off::APPLY_NPC_GLOBAL_SETTING;DT_Off[/rbutton] [/c] --&gt;SECTION_HEADER|NPC Name in Rolls --+|[c][rbutton]Show::APPLY_NPC_GLOBAL_SETTING;NPCName_Show[/rbutton] [rbutton]Hide::APPLY_NPC_GLOBAL_SETTING;NPCName_Hide[/rbutton] [/c] --&gt;SECTION_HEADER|Dex Tiebreaker --+|[c][rbutton]On::APPLY_NPC_GLOBAL_SETTING;DTB_On[/rbutton] [rbutton]Off::APPLY_NPC_GLOBAL_SETTING;DTB_Off[/rbutton] [/c] --/&gt;SECTION_HEADER|Configure ChatSetAttr API Script --/+|[c][rbutton]On::APPLY_NPC_GLOBAL_SETTING;Config[/rbutton] --X| --&lt;| --:APPLY_NPC_GLOBAL_SETTING|MODE --&amp;Mode|[&amp;reentryval] --#Title|Apply Global Setting --+|[c][b]Hang on, this may take a minute...[/b][/c] --C[&amp;Mode]|WR_Never:WR_NEVER|WR_Always:WR_ALWAYS|WR_Toggle:WR_TOGGLE|WR_Query:WR_QUERY|RA_Never:RA_NEVER|RA_Toggle:RA_TOGGLE|RA_Query:RA_QUERY|RA_Always:RA_ALWAYS|NPCName_Show:NPCNAME_SHOW|NPCName_Hide:NPCNAME_HIDE|DTB_On:DTB_ON|DTB_Off:DTB_OFF|DT_On:DT_ON|DT_Off:DT_OFF|Config:SETATTR_CONFIG --/| *|Invalid Option ([&amp;Mode]) in APPLY_NPC_GLOBAL_SETTING --X| --:WR_NEVER| --#leftsub|Never Whisper Rolls --@setattr|_allgm _replace _wtype| --X| --:WR_ALWAYS| --#leftsub|Always Whisper Rolls --@setattr|_allgm _replace _wtype|'/w gm ' --X| --:WR_TOGGLE| --#leftsub|Toggle Whisper Rolls --@setattr|_allgm _replace _wtype|\at{whispertoggle} --X| --:WR_QUERY| --#leftsub|Query Whisper Rolls --@setattr|_allgm _replace _wtype|\ques{Whisper\ques\|Public Roll,\|Whisper Roll,/w gm } --X| --:RA_NEVER| --#leftsub|Never Roll Advantage --&amp;P1|{{normal=1} --&amp;P1|+} {{r2=[[0d20 --@setattr|_allgm _replace _rtype|[&amp;P1] --X| --:RA_TOGGLE| --#leftsub|Toggle Roll Advantage --@setattr|_allgm _replace _rtype|\at{advantagetoggle} --X| --:RA_QUERY| --#leftsub|Query Roll Advantage --@setattr|_allgm _replace _rtype|\at{queryadvantage} --X| --:RA_ALWAYS| --#leftsub|Always Roll Advantage --&amp;P1|{{always=1} --&amp;P1|+} {{r2=[[\at{d20} --@setattr|_allgm _replace _rtype|[&amp;P1] --X| --:NPCNAME_SHOW| --#leftsub|Show NPC Name on Roll --&amp;P1|{{charname=\at{npc_name} --&amp;P1|+} --&amp;P1|+} --&amp;P2|{{name=\at{npc_name} --&amp;P2|+} --&amp;P2|+} --@setattr|_allgm _replace _charname_output|[&amp;P1] _npc_name_flag|[&amp;P2] --X| --:NPCNAME_HIDE| --#leftsub|Hide NPC Name on Roll --@setattr|_allgm _replace _npc_name_flag|0 _charname_output|0 --X| --:DTB_ON| --#leftsub|Dex Tiebreaker On --@setattr|_allgm _replace _init_tiebreaker|\at{dexterity}/100 --X| --:DTB_OFF| --#leftsub|Dex Tiebreaker Off --@setattr|_allgm _replace _init_tiebreaker|0 --X| --:DT_ON| --#leftsub|Roll Damage Automaticaly --@setattr|_allgm _replace _dtype|full --X| --:DT_OFF| --#leftsub|Do Not Roll Damage Automaticaly --@setattr|_allgm _replace _dtype|pick --X| --:SETATTR_CONFIG| --#leftsub|Configure ChatSetAttr --@setattr-config| --X| --&lt;| --:SECTION_HEADER|Title --&amp;hdrstyle_T|style="width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px [&amp;FColor2];border:1px solid [&amp;FColor2];" --&amp;hdrstyle_TR|style="border:0px solid [&amp;FColor2];" --&amp;hdrstyle_TD|style="width:100%;background-color:[&amp;BColor2];font-size:110%;font-weight:bold;text-align:center;color: [&amp;FColor1];text-shadow: 0 0 2px #80ffc0, 0 0 4px #00ff66, 0 0 8px #00ff66, 0 0 14px #00ff66;" --+|[t [&amp;hdrstyle_T]][tr [&amp;hdrstyle_TR]][td [&amp;hdrstyle_TD]][c][%1%][/c][/td][/tr][/t] --&lt;| Ivo said: !scriptcard {{ &nbsp; --#title|has Advantage! &nbsp; --#titleCardBackground|#6aa84f &nbsp; --#titleFontColor|#FFFFFF &nbsp; --#emoteBackground|#FFFFFF &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --@setattr|_sel _silent _replace _advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}' _rtype|'\at{advantagetoggle}' }} Truncates after {{advantage=1, none of the rest of the command is processed Using 1.3.8 and the 5E OGL sheet
@Kurt - replacing with .Raw works fine.
I've used scriptcards to create a book card in my CoC roll20, as a substitute for creating a handout for every tome they find. CoC games in roll20 aren't likely to use tokens so my takeaways from the available scripts are a bit different. This idea is to have a macro available (one for keepers with all books, and one for players with the books they know about). It uses multiple arrays that are managed in a spreadsheet to make maintenance easy when a new book needs to be added, and the data is copied into a library handout. The user selects the book they want from a prompted drop down and the card displays in chat It's not all that clever, but with my very limited skills in this area, kinda pleased with it.&nbsp;
1627146897
Kurt J.
Pro
API Scripter
ScriptCards version 1.3.9 now available The latest version is now up on the Development GIST , and has the following changes: Added "setatindex" array sub function (--~|array;setatindex;arrayname;index;newvalue) Cleaned up with [hr] replacement code. you can how specify a color ([hr #123456]) for the horizontal rule. The spacing is fixed (it was taking up 2+ card lines) Added "findability" system function (--~returnString|system;findability;charactername;abilityname). The return value is the object ID of the ability if found or "AbilityNotFound" otherwise. Added the "titlefontshadow" setting with the old default value (5px 3px 3px 0px #aaa;) so you can change it if you wish.&nbsp; Some of these are in support of a new ScriptCards script I'll be linking here and on the sharing post. I have to do a demo GIF first though :)
Quick question: I'm trying to call the token picture into an emote, is there any way to use a different token_name other than @{selected|token_name} or @{target|token_name}? Basically I'm creating a full action menu for my players, one of them commands a summon so I was trying to place the summons token instead of his characters token in the emote. His summon has it's own character sheet as well.
1627148526

Edited 1627166205
Kurt J.
Pro
API Scripter
5E Action Menu Script This ScriptCards script will display (to the person executing the script) a menu containing buttons for actions (NPCs), attacks (PCs) and spells (Both). These buttons can be clicked to execute the action, which will be displayed as an output card to everyone. While not technically required, there are some features that won't work on ScriptCards below 1.3.9. With any character token selected, executing the macro will present the caller with a list of actions and spells available to that character as a set of buttons. Items in the Character's "Attacks &amp; Spellcasting" section will only be displayed as actions if the AREN'T a spell (they will be displayed under the appropriate spell level instead). The reentrant functions attempt to analyze the attack or spell and construct an appropriate output card. This should work for most 5e spells and attacks. You can define a "spell mule" (see the beginning of the script). If you do, the script will check for Ability names on the spell mule character that match the names of the spells it is creating buttons for. If it finds on (CASE SENSITIVE) it will create a sheet button to that ability instead of a reentrant button. This allows odd-ball spells to fire their own custom scripts from the same card interface (I've got a character named "Spell_Mule" in my game, with an ability "Fireball" that contains the fireball macro. When the card is displayed and fireball is clicked it will run the full fireball script instead of trying to come up with something on its own). If you wish to suppress the output of ACs from public view, change the "showGmInfo" value near the top of the script from 0 to 1. If you don't upgrade to 1.3.9, the formatting will look a little weird and the spell mule stuff won't work, but otherwise the script should function. The script is hosted on a GIST, and is available here . It is likely to be updated and revised as bugs are discovered, etc. I do intend to add support for global modifiers, but I haven't gotten there yet. Here is a sample video using the script for a couple of PCs and NPCs, as well as how to use the "Spell_Mule" to substitute custom scripts for spells. In this case, I fire the Lightning Bolt spell without the Spell_Mule setup and then set up the mule and fire it again to see the custom script.
Hellfire M. said: Quick question: I'm trying to call the token picture into an emote, is there any way to use a different token_name other than @{selected|token_name} or @{target|token_name}? Basically I'm creating a full action menu for my players, one of them commands a summon so I was trying to place the summons token instead of his characters token in the emote. His summon has it's own character sheet as well. A quick way to maybe do this is to add an attribute to the character called Summons_Name.&nbsp; Then, when it makes sense in your script, reference it.&nbsp;&nbsp;
@Kurt - Your 5e Action Menu script looks awesome but - and please excuse my ignorance - I had troubles understanding how to access and load it.&nbsp; The link in the post just linked back to the Gisthub entry for 1.3.9.&nbsp; What am I doing wrong? Is the script accessed inside scriptcards API script somehow?
1627166245
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt - Your 5e Action Menu script looks awesome but - and please excuse my ignorance - I had troubles understanding how to access and load it.&nbsp; The link in the post just linked back to the Gisthub entry for 1.3.9.&nbsp; What am I doing wrong? Is the script accessed inside scriptcards API script somehow? My mistake ;) I put the wrong GIST link in the post above. I've fixed it, and here is the right one: 5E_Character_Action_Menu ScriptCard (github.com)