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

1618943400

Edited 1618943474
I’m thinking about developing a set of Spellbook Scripts that will allow a user or GM to review a selected tokens book of spells, view its status, prepared/not, view details of the spell, send description to GM or all players, cast the spell and have it auto-deduct from spell count, spawn AoE or Spell graphics automatically all from the chat window.  I’m thinking that this will require 3 or 4 different ScriptCard macros and I will need to facilitate passing parameters between macros.   I was thinking I might use the State object string variable as the mechanism to pass variables between scripts, but wasn’t sure if there was a better way or if I would fall victim to asynchronous operations when storing and reading from the State object.   Any thoughts? I’m actually considering developing this in ScriptCards to prototype it, then convert it to a JavaScript API if it works well and proves to be handy.    
1618944511
David M.
Pro
API Scripter
Gabryel, does the message persist if you enclose [*R:name] in quotes (see below)? From your message, I saw the name "Lisa Dunham" was being compared. The space in the name might cause issues? --?"[*R:name]" -eq NoRepeatingAttributeLoaded|FIN_Recherche_contacts
You got it right! There are no more messages in the API console. Thanks :)
1618958835

Edited 1618959154
Am I able to do a API from a button derived from a Rfind?  I want to pull a list of repeating attacks, make them into buttons with the button resetting an attribute to the repeating attack name so I can call that from a follow on card. This is what I have, I know the setattr isn't correct but it's there for a place holder. !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+|[button][*R:name]::--@setattr|_charid [*S:character_id] _weapon|[&WeaponSelect][/button] --Rnext| --? "[*R:atkname]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }} I'm also curious a way to repeat an entire card if a character chooses to do a full attack.
I'm not sure I understand what it is you're trying to do. Do you mean to have the button run an API command when you click it? For example, when you press the button it runs this command: !setattr --charid <character id> --weapon|<weapon name> If that's what you're trying to do, the button syntax is a bit more complicated because of HTML syntax: [button][*R:name]:: !
 !setattr -- charid [*S:character_id] -- weapon|[&WeaponSelect][/button] What *should* happen is that when the ScriptCard generates the button, the HTML escaped characters will get converted to, respectively, a carriage return and the "-" character, so that what gets sent when you press the button is the first line of code, above. ScriptCards should replace out the [*R, [*S, and [& notation, too. One of the ways you can troubleshoot your button syntax is to try making a plain API command button . [Button Text](Command to Run) In your case, you're basically looking for: [ [*R:name] ](!
!setattr --charid [*S:character_id] --weapon| [&WeaponSelect] ) If you do a manual substitution for [*R, etc., and use that command line, the button generate should work the same as what you need it to do in ScriptCards. If that works, you can just change some of the syntax and throw the same line into ScriptCards. Brien V. said: Am I able to do a API from a button derived from a Rfind?  I want to pull a list of repeating attacks, make them into buttons with the button resetting an attribute to the repeating attack name so I can call that from a follow on card. This is what I have, I know the setattr isn't correct but it's there for a place holder. !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+|[button][*R:name]::--@setattr|_charid [*S:character_id] _weapon|[&WeaponSelect][/button] --Rnext| --? "[*R:atkname]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }} I'm also curious a way to repeat an entire card if a character chooses to do a full attack.
1619002821

Edited 1619003827
Colin C. said: I'm not sure I understand what it is you're trying to do. Do you mean to have the button run an API command when you click it? For example, when you press the button it runs this command: !setattr --charid <character id> --weapon|<weapon name> If that's what you're trying to do, the button syntax is a bit more complicated because of HTML syntax: [button][*R:name]:: !
 !setattr -- charid [*S:character_id] -- weapon|[&WeaponSelect][/button] What *should* happen is that when the ScriptCard generates the button, the HTML escaped characters will get converted to, respectively, a carriage return and the "-" character, so that what gets sent when you press the button is the first line of code, above. ScriptCards should replace out the [*R, [*S, and [& notation, too. One of the ways you can troubleshoot your button syntax is to try making a plain API command button . [Button Text](Command to Run) In your case, you're basically looking for: [ [*R:name] ](!
!setattr --charid [*S:character_id] --weapon| [&WeaponSelect] ) If you do a manual substitution for [*R, etc., and use that command line, the button generate should work the same as what you need it to do in ScriptCards. If that works, you can just change some of the syntax and throw the same line into ScriptCards. I've gotten it working (mostly).  I can get it to put in the entire repeating section code (ie  repeating_attack_-MYWHJNd4E6HsgjzZ1hk_name) but I was hoping I could get just the base portion ( repeating_attack_-MYWHJNd4E6HsgjzZ1hk).  This doesn't seem possible so I guess my next question is can I get setattr to make more than one change?  My attack powercard looks at 3-4 portions of the weapons stats (Starfinder has two AC type) and I could just use the button to make attributes for all of them.  
1619004264
Kurt J.
Pro
API Scripter
Brien V. said: Colin C. said: I'm not sure I understand what it is you're trying to do. Do you mean to have the button run an API command when you click it? For example, when you press the button it runs this command: !setattr --charid <character id> --weapon|<weapon name> If that's what you're trying to do, the button syntax is a bit more complicated because of HTML syntax: [button][*R:name]:: !
 !setattr -- charid [*S:character_id] -- weapon|[&WeaponSelect][/button] What *should* happen is that when the ScriptCard generates the button, the HTML escaped characters will get converted to, respectively, a carriage return and the "-" character, so that what gets sent when you press the button is the first line of code, above. ScriptCards should replace out the [*R, [*S, and [& notation, too. One of the ways you can troubleshoot your button syntax is to try making a plain API command button . [Button Text](Command to Run) In your case, you're basically looking for: [ [*R:name] ](!
!setattr --charid [*S:character_id] --weapon| [&WeaponSelect] ) If you do a manual substitution for [*R, etc., and use that command line, the button generate should work the same as what you need it to do in ScriptCards. If that works, you can just change some of the syntax and throw the same line into ScriptCards. I've gotten it working (mostly).  I can get it to put in the entire repeating section code (ie  repeating_attack_-MYWHJNd4E6HsgjzZ1hk_name) but I was hoping I could get just the base portion ( repeating_attack_-MYWHJNd4E6HsgjzZ1hk).  This doesn't seem possible so I guess my next question is can I get setattr to make more than one change?  My attack powercard looks at 3-4 portions of the weapons stats (Starfinder has two AC type) and I could just use the button to make attributes for all of them.   You could use the string functions to get rid of _name. Either with replace or before. That would leave you with just the prefix portion.
Last question and I should be good to go.  Can I get the same button to execute two functions.  In the code, the button currently resets 3 attributes to the weapon the player wants to attack with.  I would like it also to execute a macro to pull up the attack scriptcard.  Is this possible? !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!
!setattr --sel --weaponname|[*R>name] --weapontype|[*R>type] --weapondamage|[*R>damage_total][/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }}
I believe something like this should work: [button]buttonname::<first command/function> 
 <second command/function>[/button] Brien V. said: Last question and I should be good to go.  Can I get the same button to execute two functions.  In the code, the button currently resets 3 attributes to the weapon the player wants to attack with.  I would like it also to execute a macro to pull up the attack scriptcard.  Is this possible? !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!
!setattr --sel --weaponname|[*R>name] --weapontype|[*R>type] --weapondamage|[*R>damage_total][/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }}
I am sorry to pester again but I can't figure this out.  I'm sure it's some stupid syntax issue. Working on a Long Rest script with a counter.  My  title section does contain    --#sourceToken|@{selected|token_id}  The problem entry is:   --:Counter|     --=SlotLevel|1   --:NextLevel|     --?[*S:lvl[$SlotLevel]_slots_total] -eq 0|AdjustSlots;[$Level]     --=SlotLevel|[$SlotLevel] + 1     --?[$SlotLevel] -gt 9|EndMacro   --^NextLevel| The problem is that the macro keeps telling me that     [*S:lvl[$SlotLevel]_slots_total]   is undefined.  Any help would be appreciated...
1619039816

Edited 1619039839
Michael C. said: I am sorry to pester again but I can't figure this out.  I'm sure it's some stupid syntax issue. Working on a Long Rest script with a counter.  My  title section does contain    --#sourceToken|@{selected|token_id}  The problem entry is:   --:Counter|     --=SlotLevel|1   --:NextLevel|     --?[*S:lvl[$SlotLevel]_slots_total] -eq 0|AdjustSlots;[$Level]     --=SlotLevel|[$SlotLevel] + 1     --?[$SlotLevel] -gt 9|EndMacro   --^NextLevel| The problem is that the macro keeps telling me that     [*S:lvl[$SlotLevel]_slots_total]   is undefined.  Any help would be appreciated... Not sure but perhaps :  --?[*S:lvl"[$SlotLevel]"_slots_total] -eq 0|AdjustSlots;[$Level]
1619040731

Edited 1619040806
David M.
Pro
API Scripter
How about using [$rollVar. Total ]? When I use --#debug|1 it appears to grab the correct value in a conditional. --?[*S:lvl[$SlotLevel .Total ]_slots_total] -eq 0|AdjustSlots;[$Level] Interestingly, when I try to print it as shown below, it returns the value properly, --+[*S:lvl[$SlotLevel . Total]]| ...but when I try to put it on the right side of the pipe, I get undefined: --+slots|[*S:lvl[$SlotLevel . Total]] Weird. Maybe some parsing order of operations?
1619041681
Kurt J.
Pro
API Scripter
Rosco James said: When I run the following macro, cut and pasted from the website, the results are displayed in the chat box just fine, but I get "ScriptCards Error: Label Lib5E_CheckDamageModifiers is not defined on line 4" "ScriptCards Error: Label Lib5E_CheckDamageModifiers is not defined on line 7" "ScriptCards Error: Label Lib5E_CheckDamageModifiers is not defined on line 10" "ScriptCards Error: Label Lib5E_CheckDamageModifiers is not defined on line 13" in the API Output Console. Results are the same in versions 1.1.19c & e. I'm using D&D 5E by Rol20      I have a handout named "ScriptCards Library 5E Tools" that has "--:Lib5E_CheckDamageModifiers|damageVariableName;damageType" When I cut  and pasted both code and handout, I went through notepad first, as you suggested.       The output, as far as I can tell, seems ok, but, as I said the API Output Console disagrees. Should I care?  !script {{ --whisper|gm     --#title|@{target|token_name}     --#leftsub|Dmg Mods vs Fire, Cold, Poison, Acid     -->Lib5E_CheckDamageModifiers|ResistType;fire     --=DamageRoll|2d10 [&ResistType]     --+Test:|[$DamageRoll] fire damage     -->Lib5E_CheckDamageModifiers|ResistType;cold     --=DamageRoll|2d10 [&ResistType]     --+Test:|[$DamageRoll] cold damage     -->Lib5E_CheckDamageModifiers|ResistType;poison     --=DamageRoll|2d10 [&ResistType]     --+Test:|[$DamageRoll] poison damage     -->Lib5E_CheckDamageModifiers|ResistType;acid     --=DamageRoll|2d10 [&ResistType]     --+Test:|[$DamageRoll] acid damage     --X| }} 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###
1619041933
Kurt J.
Pro
API Scripter
Michael C. said: I am sorry to pester again but I can't figure this out.  I'm sure it's some stupid syntax issue. Working on a Long Rest script with a counter.  My  title section does contain    --#sourceToken|@{selected|token_id}  The problem entry is:   --:Counter|     --=SlotLevel|1   --:NextLevel|     --?[*S:lvl[$SlotLevel]_slots_total] -eq 0|AdjustSlots;[$Level]     --=SlotLevel|[$SlotLevel] + 1     --?[$SlotLevel] -gt 9|EndMacro   --^NextLevel| The problem is that the macro keeps telling me that     [*S:lvl[$SlotLevel]_slots_total]   is undefined.  Any help would be appreciated... I can look at the code to be certain, but I think roll variables are processed at different times when building a line than strings. Strings always go first, so if you replace SlotLevel with a string variable (--&SlotLevel|1 and [&SlotLevel]) it will likely parse out correctly. I believe RollVars get processed after [*:] references.
1619042631
David M.
Pro
API Scripter
Kurt, does what I was seeing above make any sense regarding the parsing? Maybe I goofed on syntax...?
1619044288
Kurt J.
Pro
API Scripter
David M. said: Kurt, does what I was seeing above make any sense regarding the parsing? Maybe I goofed on syntax...? Yes, there is also a different parsing order for tags vs content portions of a line, since a tag needs to be fully resolved so we can get a variable name (or whatever else) as a result before assigning a value. Content portion parsing gets deferred. I'll see if I can come up with a better (or at least consistently documented) standard.
I thought I had it, I definitely did not.  This is the code I am using to select a weapon and make a attribute with the repeating_attack name.   !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!
!setattr --sel --weaponname|[*R>name] --weapontype|[*R>type] --weapondamage|[*R>damage_total] --weaponbonus|[*R>total] --weaponcrit|[*R>crit]
#AttackSC[/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }} For example, the weaponcrit creates repeating_attack_-MYWHJNd4E6HsgjzZ1hk_crit but when I pull it into the follow up script card, I'm unable to put this into @{selected|repeating_attack_-MYWHJNd4E6HsgjzZ1hk_crit} to get the right info.   Kurt mentioned using a string function but I honestly don't know how to do that.  I just need a way of pulling the attribute into the @{ }. Sorry for the continued bother.
I am using TokenMod to change the attributes of the tokens bars see below.   !token-mod {{   --set     bar1_link|     bar2_link|     bar3_link|     bar1_link|hp     bar2_link|ac     bar3_link|speed     }} I would like to create a scriptcard to run after to pull the info from the tokens attributes from the bars to make sure they have changed. Anyone know if there is a command or syntax for this? 
1619056161
David M.
Pro
API Scripter
Craven, if you just want to return the values of the bars, this should work: !script {{ --+Current bar1 value:|@{selected|bar1} --+Current bar2 value:|@{selected|bar2} --+Current bar3 value:|@{selected|bar3} }}
1619056302

Edited 1619056392
David M.
Pro
API Scripter
Kurt J. said: Yes, there is also a different parsing order for tags vs content portions of a line, since a tag needs to be fully resolved so we can get a variable name (or whatever else) as a result before assigning a value. Content portion parsing gets deferred. I'll see if I can come up with a better (or at least consistently documented) standard. Thanks for the confirmation, Kurt! Knowing this will help avoid potentially misleading caveman debugging results :)
David M. said: Craven, if you just want to return the values of the bars, this should work: !script {{ --+Current bar1 value:|@{selected|bar1} --+Current bar2 value:|@{selected|bar2} --+Current bar3 value:|@{selected|bar3} }} I was looking for a attribute of the bar not the value. Any ideas? Example is the bar set to HP?   
1619086625
Kurt J.
Pro
API Scripter
Craven said: David M. said: Craven, if you just want to return the values of the bars, this should work: !script {{ --+Current bar1 value:|@{selected|bar1} --+Current bar2 value:|@{selected|bar2} --+Current bar3 value:|@{selected|bar3} }} I was looking for a attribute of the bar not the value. Any ideas? Example is the bar set to HP?    You would need to use [*:] notation: [*@{selected|token_id}:t-bar1_link] [*@{selected|token_id}:t-bar2_link] [*@{selected|token_id}:t-bar3_link] or, if you set a source token: [*S:t-bar1_link] etc.
Thanks to all that responded. Gabryel: Thnks but&nbsp; --?[*S:lvl"[$SlotLevel]"_slots_total] -eq 0|AdjustSlots;[$Level]&nbsp; didn't work but was a nice try. David M.: I saw the same issues...that is weird.&nbsp; --?[*S:lvl[$SlotLevel.total]_slots_total] -eq 0|AdjustSlots;[$Level] somehow changed the variable so that it wasn't recognized and didn't eliminate the undefined character. Was worth a shot though. &nbsp;Kurt J. - I don't think I followed your suggestion correctly.&nbsp; I changed it to:&nbsp; &nbsp; --:Counter|Check Spell Slots 1 - 9 &nbsp; &nbsp; &nbsp;--&amp;SlotLevel|1 &nbsp; --:NextLevel| &nbsp; &nbsp; &nbsp;--?[*S:lvl[&amp;SlotLevel]_slots_total] -eq 0|AdjustSlots;[&amp;SlotLevel] &nbsp; &nbsp; &nbsp;--&amp;SlotLevel|[&amp;SlotLevel] + 1 &nbsp; &nbsp; &nbsp;--?[&amp;SlotLevel] -gt 9|EndMacro &nbsp; --^NextLevel| which just gave me an infinite loop error.&nbsp; (I did notice the debug said: "Error: No attribute or sheet field found for character_id -MY0p6DTMDBxfwItiYEq named lvl_slots_total"&nbsp; if that helps any.)&nbsp; I tried different variations of &amp;SlotLevel and $SlotLevel with the same results.&nbsp; I also&nbsp; tried passing a variable through [%1%] in place of &amp;SlotLevel and $SlotLevel with the same results. On the off chance that I screwed up the macro somewhere else in it, here is the entire macro: !scriptcards {{&nbsp; &nbsp; --#title|Long Rest &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#emoteText|[*S:character_name] Takes a Long Rest &nbsp; --#titleCardBackground|#542200 &nbsp; --#evenRowBackground|#006400 &nbsp; --#evenRowFontColor|#FFFF00 &nbsp; --#oddRowBackground|#DC7633 &nbsp; --#oddRowFontColor|#000000 &nbsp; --+|[img]<a href="https://media.giphy.com/media/4WSkQQjJPQoRq/giphy.gif[/img]" rel="nofollow">https://media.giphy.com/media/4WSkQQjJPQoRq/giphy.gif[/img]</a> &nbsp; --:Setup|Reset Class and Other Resource to max &nbsp; &nbsp; &nbsp; --@setattr|_silent _charid [*S:character_id] _class_resource|%class_resource_max% _other_resource|%other_resource_max%&nbsp;&nbsp; &nbsp; --^Counter| &nbsp; --:EndMacro| &nbsp; --X| &nbsp; --:|PROCEDURES &nbsp; --:Counter|Check Spell Slots Total 1 - 9 to see which character has. &nbsp; &nbsp; --&amp;SlotLevel|1 &nbsp; --:NextLevel| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--+| SlotLevel [&amp;SlotLevel] Total [*S:lvl[&amp;SlotLevel]_slots_total] &nbsp; &nbsp; --?[*S:lvl[&amp;SlotLevel.total]_slots_total] -eq 0|AdjustSlots;[&amp;SlotLevel] &nbsp; &nbsp; --&amp;SlotLevel|[&amp;SlotLevel] + 1 &nbsp; &nbsp; --?[&amp;SlotLevel] -gt 9|EndMacro &nbsp; --^NextLevel| &nbsp; --:AdjustSlots|Change Slots Expended to 0 for each slot level of character &nbsp; &nbsp; &nbsp;--=NumberSlots|[%1%] - 1 &nbsp; --:NextSlot| &nbsp; &nbsp; &nbsp;--@setattr|_silent _charid @{selected|character_id} _lvl[$NumberSlots]_slots_expended|0 &nbsp; &nbsp; &nbsp;--+|Num [$NumberSlots] [*S:lvl[$NumberSlots]_slots_expended] &nbsp; &nbsp; &nbsp;--?[$NumberSlots] -le 0|EndMacro &nbsp; &nbsp; &nbsp;--=NumberSlots|[$NumberSlots]- 1 &nbsp; &nbsp; &nbsp;--^NextSlot| &nbsp; --X| }} TIA
Small thing but I don't seem to be able to find a&nbsp; --# instruction that will change the font (size, color, etc.) for --#leftsub| and --#rightsub| in the wiki.&nbsp; &nbsp; --#titleCardFont|#&nbsp; does not.&nbsp; Did I miss something?
1619097050

Edited 1619097431
David M.
Pro
API Scripter
Try this format: &nbsp; --#subtitlefontsize|36px EDIT - For your other problem, I think your line below should have ".Total" with a capital T? If you add a --debug|1 to your card, you should see in the api console log if it is being evaluated properly. Due to the parsing order of operations Kurt mentioned, printing it out to debug in chat will only work for&nbsp;[*S:lvl[$SlotLevel.total]_slots_total] if it is on the left side of the pipe (the tag portion). --?[*S:lvl[$SlotLevel .total ]_slots_total] -eq 0|AdjustSlots;[$Level]
1619108040

Edited 1619108523
@David M.&nbsp; It's close.&nbsp; With the changes it is now erroring when&nbsp; --?[*S:lvl[$SlotLevel .total ]_slots_total] -eq 0|AdjustSlots;[$Level]&nbsp; calls a zero edit: the last line , which doesn't make sense to me.&nbsp; Edit:&nbsp; Ran it again and the error line is:&nbsp; "ScriptCards Error: Label AdjustSlots;9 is not defined on line 19" not below. "ScriptCards Error: Label AdjustSlots;5 is not defined on line 20" "ScriptCards Error: Label AdjustSlots;6 is not defined on line 20" "ScriptCards Error: Label AdjustSlots;7 is not defined on line 20" "ScriptCards Error: Label AdjustSlots;8 is not defined on line 20" "ScriptCards Error: Label AdjustSlots;9 is not defined on line 20" The macro now reads:&nbsp; &nbsp; --:Counter|Check Spell Slots Total 1 - 9 to see which character has. &nbsp; &nbsp; --=SlotLevel|1 &nbsp; --:NextLevel| &nbsp; &nbsp; --?[*S:lvl[$SlotLevel.Total]_slots_total] -eq 0|AdjustSlots;[$SlotLevel] &nbsp; &nbsp; --=SlotLevel|[$SlotLevel] + 1 &nbsp; &nbsp; --?[$SlotLevel] -gt 9|EndMacro &nbsp; --^NextLevel| &nbsp; --:AdjustSlots|Change Slots Expended to 0 for each slot level of character &nbsp; &nbsp; --=NumberSlots|[%1%] - 1 &nbsp; --:NextSlot| &nbsp; &nbsp; --@setattr|_silent _charid @{selected|character_id} _lvl[$NumberSlots]_slots_expended|0 &nbsp; &nbsp; --+|Num [$NumberSlots] [*S:lvl[$NumberSlots]_slots_expended] &nbsp; &nbsp; --?[$NumberSlots] -le 0|EndMacro &nbsp; &nbsp; --=NumberSlots|[$NumberSlots]- 1 &nbsp; &nbsp; --^NextSlot|
1619109535

Edited 1619109598
David M.
Pro
API Scripter
Looks like you are wanting to call AdjustSlots as if it were a procedure (accepting SlotLevel as a parameter), so a couple of problems with what you have: 1) You will need to prefix the call to AdjustSlots with a "&gt;", like this: &nbsp;--?[*S:lvl[$SlotLevel.Total]_slots_total] -eq 0| &gt;AdjustSlots ;[$SlotLevel] 2) AdjustSlots will need to be converted from a branch label to a procedure. Branch labels can't accept parameters. At the end of your macro, add a --X| and after that line you will put all of your procedures. AdjustSlots would be changed to something like this: --:AdjustSlots|Change Slots Expended to 0 for each slot level of character, accepts SlotLevel as param &nbsp; &nbsp; --=NumberSlots|[%1%] - 1 --&lt;|
I'm pulling my hair out.&nbsp; I'm to the point where I have one script card that creates an attribute with the id of a repeating attack. This- !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45;[*R&gt;name]&amp;#124;[/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }} Produces an attribute with the direct link to the weapon on the sheet, such as&nbsp; repeating_attack_-MYWHHTI59o0l4tkMNhZ_name. My issue is how do I get that repeating attack name into a usable form to call it into a follow on script card? This is what I am currently working from: !scriptcard {{ --#title|Attack --=WeaponName|@{selected|weaponname} --#sourceToken|@{selected|token_id} --#leftsub|[*S:weaponname] --#rightsub|[*S:name] --#titlecardbackground|#993333 --+Weapon:|@{selected|weaponname} }} This only pulls the&nbsp;&nbsp; repeating_attack_-MYWHHTI59o0l4tkMNhZ_name portion, so instead of the actual weapon name I get something like this: How can I get the attribute information to be read as @{selected| repeating_attack_-MYWHHTI59o0l4tkMNhZ_name} ?
1619121248

Edited 1619121503
timmaugh
Pro
API Scripter
So you have an attribute that contains the name of a repeating attribute? The Roll20 parser won't let you recursively embed attribute requests, AFAIK. But you can use the Fetch script to sit in the middle. Let Roll20 parse the first, then Fetch will parse the next, before it finally reaches your scriptcard. (I am assuming that your attribute "weaponname" contains the name of your repeating attribute.) In that case you'd use: @(selected.@{selected|weaponname}) If you're curious, the order would go... @(selected.@{selected|weaponname}) &lt;== you submit (part of your command line) @(selected.repeating_attack_-MYWHHTI59o0l4tkMNhZ_name) &lt;== &nbsp; Roll20 parses the @{selected} call, returns contents Mighty Sword of Doomsmacking&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;== Fetch outputs contents of repeating field You can do this with just Fetch, with or without ZeroFrame.
This kinda depends on what you're trying to do. If all you need is the name of the weapon (which is what it looks like you're using), then a super minor change in your first card will fix it. --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45; [*R:name] &amp;#124;[/button]| The *R&gt; notation puts in the name of the attribute, whereas the *R: notation puts in the value &nbsp;of that attribute. If you need other values associated with that weapon (like damage, attack bonus, whatever), you can still use the above change, and then do an Rfind in the second card to bring up the other values. Additional note: I think your setattr call is missing a parameter. That line tells setattr to set the [*R&gt;name] attribute to blank, which I don't think you are trying to do. If I understand correctly what you're doing, you need to use --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45; weaponname&amp;#124;[*R:name] [/button]| Brien V. said: I'm pulling my hair out.&nbsp; I'm to the point where I have one script card that creates an attribute with the id of a repeating attack. This- !scriptcard {{ --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45;[*R&gt;name]&amp;#124;[/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop }} Produces an attribute with the direct link to the weapon on the sheet, such as&nbsp; repeating_attack_-MYWHHTI59o0l4tkMNhZ_name. My issue is how do I get that repeating attack name into a usable form to call it into a follow on script card? This is what I am currently working from: !scriptcard {{ --#title|Attack --=WeaponName|@{selected|weaponname} --#sourceToken|@{selected|token_id} --#leftsub|[*S:weaponname] --#rightsub|[*S:name] --#titlecardbackground|#993333 --+Weapon:|@{selected|weaponname} }} This only pulls the&nbsp;&nbsp; repeating_attack_-MYWHHTI59o0l4tkMNhZ_name portion, so instead of the actual weapon name I get something like this: How can I get the attribute information to be read as @{selected| repeating_attack_-MYWHHTI59o0l4tkMNhZ_name} ?
Colin C. said: This kinda depends on what you're trying to do. If all you need is the name of the weapon (which is what it looks like you're using), then a super minor change in your first card will fix it. --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45; [*R:name] &amp;#124;[/button]| The *R&gt; notation puts in the name of the attribute, whereas the *R: notation puts in the value &nbsp;of that attribute. If you need other values associated with that weapon (like damage, attack bonus, whatever), you can still use the above change, and then do an Rfind in the second card to bring up the other values. Additional note: I think your setattr call is missing a parameter. That line tells setattr to set the [*R&gt;name] attribute to blank, which I don't think you are trying to do. If I understand correctly what you're doing, you need to use --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45; weaponname&amp;#124;[*R:name] [/button]| That put me on the right path.&nbsp; Here's what I came up with.&nbsp; It's super basic just to make sure it pulls the right information. !scriptcard {{ --#title|Attack --#sourceToken|@{selected|token_id} --#leftsub|[*S:weaponname] --#rightsub|[*S:name] --#titlecardbackground|#993333 --Rfind|@{selected|character_id};@{selected|weaponname};repeating_attack;name --+Attack Name|[*R:name] --+Attack Bonus|[*R:total] }} To make sure I understand.&nbsp; Once I do the Rfind, any R: will reference that specific weapon, correct?&nbsp; If so, this is what I needed.&nbsp;&nbsp; Thanks to everyone who helped this code dumb old man out.
Hello, We were chatting with a friend about repeating section and he told me a really cool trick to be able to identify each line correctly. Using a sheetbutton to click in the character sheet is cool. But being able to click it in a repeating section is even cooler :) If you look in detail at the rdump in the console you can see this: A kind of constant variable used to get the ID of each line of a repeating section. So the lines are identifiable: --Rfind|@{selected|character_id};Blaster;repeating_weapons;weapontype --+|[*R:xxxActionIDxxxx] [*R:xxxActionIDxxxx] = -M6-UHPrnT9NSfUp5vqq in a sheetbutton : --+|[c][sheetbutton]Blaster::[&amp;NameUserMap]::repeatingweapons_[R:xxxActionIDxxxx]_weapon[/sheetbutton][/c] Enjoy :)
Craven said: I create a post called "Scritpcard API Working and Sharing" If anyone has working cards an would like to share. Thanks in advance to all whom share there hard work.&nbsp; Just posted a beta version of my SpellBook script on&nbsp; y our Working and Sharing thread.&nbsp; I'll update it there as it matures.
1619129512

Edited 1619129925
Will M. said: Craven said: I create a post called "Scritpcard API Working and Sharing" If anyone has working cards an would like to share. Thanks in advance to all whom share there hard work.&nbsp; Just posted a beta version of my SpellBook script on&nbsp; y our Working and Sharing thread.&nbsp; I'll update it there as it matures. Cool thanks for sharing. anyone know how a call a macro from a button off a character sheet? I tried --+|[c][button]Longsword::!&amp;#13; ~WeaponWill|Longsword[/button]&nbsp; Also anyone have a sub routine for sneak attacks. or is there a way to pull in from global attack which would be better?
1619130353

Edited 1619145176
Gabryel said: Hello, We were chatting with a friend about repeating section and he told me a really cool trick to be able to identify each line correctly. Using a sheetbutton to click in the character sheet is cool. But being able to click it in a repeating section is even cooler :) If you look in detail at the rdump in the console you can see this: A kind of constant variable used to get the ID of each line of a repeating section. So the lines are identifiable: --Rfind|@{selected|character_id};Blaster;repeating_weapons;weapontype --+|[*R:xxxActionIDxxxx] [*R:xxxActionIDxxxx] = -M6-UHPrnT9NSfUp5vqq in a sheetbutton : --+|[c][sheetbutton]Blaster::[&amp;NameUserMap]::repeatingweapons_[R:xxxActionIDxxxx]_weapon[/sheetbutton][/c] Enjoy :) Thanks to Gabryel and the Rdump command, I've made a breakthrough for determining how the logic to cast spells works under 5eOGL. If [*R:spelloutput] is "ATTACK", then the syntax to execute the attack is in [*R:rollcontent].&nbsp; It can be executed with a sheetbutton like this: --+Cast Spell:|[sheetbutton]Cast::@{selected|character_name}::[*R:rollcontent][/sheetbutton] Non-Attack spells appear to have a&nbsp; [*R:spelloutput] of "SPELLCARD".&nbsp;&nbsp;
--+|[c][button]Longsword::~WeaponWill|Longsword[/button][/c] &nbsp;That should work. Craven said: Cool thanks for sharing. anyone know how a call a macro from a button off a character sheet? I tried --+|[c][button]Longsword::!&amp;#13; ~WeaponWill|Longsword[/button]&nbsp; Also anyone have a sub routine for sneak attacks. or is there a way to pull in from global attack which would be better?
Been hunting this thread for a Table Row example... Trying to get my head around it a bit... Any one point me to the thread example. or have one as a reference for me, please....tnx..
1619196243
David M.
Pro
API Scripter
BilBo, here is a simple example of rolling on a rollable table and displaying results. TableName below is "AlienD6" (6 item table with values 1-6 and corresponding image) !script {{ --=roll|[T#AlienD6] --+Rolled Value:|[$roll.tableEntryValue] --+Rolled Image:|[img width=32][$roll.tableEntryImgURL][/img] }} Here is a more complicated example, that assembles a string variable comprised of multiple rollable table images in order to put multiple table images on the same line.
@David M. In a scriptcard I tried to work Spawn with ForSelected and am not doing something right.&nbsp; (I tried to PM you so as not to fill this thread with chatter but my PM doesn't work for some reason. I hope I have not offended.)&nbsp; The statement: &nbsp; --:Swap Token | &nbsp; &nbsp; --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer &nbsp; &nbsp; --@forselected|Spawn _name|Giant Ape&nbsp; _qty|1 _size|2,2&nbsp; set the selected token to the gmlayer but did not spawn the Giant Ape.&nbsp; Help? Kurt J.&nbsp; I know that the conditional branch will accept a operation|true|false formula but is it possible to turn the conditional branch into more of an "if...then...else" statement rather than branch to a goto or gosub?&nbsp; Such as...If V = W then X = Z else Y = Z (or branch)...kind of thing?&nbsp; &nbsp;Just musing...
1619199608

Edited 1619206483
String Replace Functionality &amp; Special Characters ({};&amp;|) I've been trying to utilize a roll-template within scriptcards, to Replace roll-template fields with actual values.&nbsp; The problem is roll templates have a ton of special characters ({{, }}, ;, &amp;) that ScriptCards sometimes interprets within the search string blindly as part of the overall command.&nbsp; For example, the string replace function utilizes the semi-colon(;) as a delimiter, and if the string you are searching/replacing has a semi-colon in it, it fails.&nbsp; I've tried replacing some of these characters with HTML replacement codes (e.g. "{" with &amp;#123;), but there are semi-colons in them as well.&nbsp;&nbsp; Is there an easy solution I'm not considering or is there a way to use an alternate delimiter or to enclose my search string in a pair of characters that tells the Replace function to not interpret as part of the command?&nbsp; Example Roll-Template: @{wtype}&amp;amp;{template:spelloutput} {{level=@{spellschool} @{spelllevel}}} {{name=@{spellname}}} {{castingtime=@{spellcastingtime}}} {{range=@{spellrange}}} {{target=@{spelltarget}}} @{spellcomp_v} @{spellcomp_s} @{spellcomp_m} {{material=@{spellcomp_materials}}} {{duration=@{spellduration}}} {{description=@{spelldescription}}} {{athigherlevels=@{spellathigherlevels}}} @{spellritual} {{innate=@{innate}}} {{savedc=@{roll_output_dc}}} @{spellconcentration} @{charname_output} Example replace function calls: &nbsp; --~zNew|string;replace;@{spellschool};[*R:spellconcentration];[&amp;zRollTemplate]&nbsp;// Fails because it sees {{ in the zRollTemplate if I replace { and } with&nbsp; &amp;#123; and &amp;#125;, the Semi-Colons give it fits.&nbsp;&nbsp; Any help would be appreciated.&nbsp; I feel like I'm missing something simple.&nbsp;&nbsp; UPDATE: I figured out another solution.&nbsp; This is still a potential challenge, but I've been able to get around it.
1619200504
David M.
Pro
API Scripter
Michael, there was/is an issue with forselected when @{target...} is also used. I believe timmaugh has released some new meta scripts to handle these cases, but I haven't had the time to dig into them yet. What is the in-game effect you are trying to produce? Not sure I understand sending a target to GM layer while spawning a creature on top of the selected token? There may be another way to go about what you are trying to do.
1619208797

Edited 1619208924
timmaugh
Pro
API Scripter
@Michael... I'm listening, too, if I can help at least from the forselected side. David's right about some new functionality in the SelectManager script I think can help you, but I want to make sure what game effect you're looking for. What token would be selected, which token would be targeted... If the tokens are one and the same, I think you can do forselected to both your token-mod call and your spawn call... forselected is just going to call the downstream script and pass along the selected tokens one at a time. If you change your token-mod call to not ignore selected ids, that might get you where you're looking to go. But you tell us. EDIT : Also not sure if you would have to reorder the scripts to first spawn before you moved the selected token... If spawn has to reference the token location and it needs it to be on the same layer, you would want to make that happen before you changed layers.
1619209677
David M.
Pro
API Scripter
Spawn can also effectively "delete" the target and/or selected token (by setting size parameter in the resize commands to 0). That's one reason I was curious about the reason for moving of the target to the GM layer. Also fyi: I'm prepping for tonight's game now so I may be "going dark" for a while ;)
1619213840

Edited 1619216941
SpellBook Script I've made a lot of progress on my spellbook script for 5e OGL sheets.&nbsp; &nbsp;I'll post future updates to:&nbsp; Working and Sharing &nbsp;thread. This script includes examples of: Reentry buttons, Sheet buttons, Repeating Sections (Spells), String functions (Split) and a few other things.&nbsp;&nbsp; Next Steps Add Slots remaining/max to level header Add "At higher levels" to spell description details Add ability to cast both attack and non-attack spells and auto-deduct from spell counts Add ability to toggle prepare flag (and limit prepared spells to max available) Better support sorcerers (Sorcery Points) and warlocks Continue to clean up the look of the cards (font and color suggestions welcome) Add SoundFX options Add options to whisper spell description to GM or other players !scriptcard {{ --#titleFontSize|1.2em --#subtitleFontSize|1.0em --#titleCardBackground|#800080 --#titleFontFace|Tahoma --#bodyFontFace|Tahoma --#tableBorderRadius|3px --#buttonFontSize|small --#buttonTextColor|#800080 --#buttonBorderColor|#800080 --#reentrant|Spellbook --#oddRowBackground|#FFFFFF --#evenRowBackground|#FFFFFF --#buttonbackground|#FFFFFF --#buttontextcolor|#000000 --#buttonbordercolor|#000000 --#whisper|self --#sourceToken|@{selected|token_id} --#title|Spell Book --#leftsub|@{selected|character_name} (@{selected|caster_level}) --#debug|1 --+Spell Attack Bonus: |[b][*S:spell_attack_bonus][/b] --+Spell Save DC: |[b][*S:spell_save_dc][/b] --&gt;REPORTSPELLS|cantrip --&gt;REPORTSPELLS|1 --&gt;REPORTSPELLS|2 --&gt;REPORTSPELLS|3 --&gt;REPORTSPELLS|4 --&gt;REPORTSPELLS|5 --&gt;REPORTSPELLS|6 --&gt;REPORTSPELLS|7 --&gt;REPORTSPELLS|8 --&gt;REPORTSPELLS|9 --X| DONE --:REPORTSPELLS|Parameter: Level --&amp;zLvl|[%1%] --Rfirst|@{selected|character_id};repeating_spell-[&amp;zLvl] --?"[*R:spellname]" -eq NoRepeatingAttributeLoaded|Done --&amp;STblStyle1|"width:100%;text-align:center;padding:5px;border-spacing:0px;border-collapse:collapse;text-shadow: 1px 1px 3px purple;border: 1px dashed purple;" --&amp;LvlDesc|Cantrip --&amp;zLvlSlots| --?[&amp;zLvl] -eq cantrip|SKIPCANTRIP --&amp;LvlDesc|Level [&amp;zLvl] --=SlotsTotal|[*S:lvl[&amp;zLvl]_slots_total] --=SlotsExpended|[*S:lvl[&amp;zLvl]_slots_expended] --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] --&amp;zLvlSlots|Slots [$SlotsExpended] of [$SlotsTotal] remaining --:SKIPCANTRIP| --&amp;STbl|[t style=[&amp;STblStyle1]][tr][td][&amp;LvlDesc][/td][td][&amp;zLvlSlots][/td][/tr][/t] --+|[&amp;STbl] --:DisplayLoop| --?"[*R:spellname]" -eq NoRepeatingAttributeLoaded|Done --&amp;zRIT|[r] --?"[*R:spellritual]" -inc "Yes"|ENDRIT --&amp;zRIT| --:ENDRIT| --&amp;zCON|[c] --?"[*R:spellconcentration]" -inc "concentration=1"|ENDCON --&amp;zCON| --:ENDCON| --?[&amp;zLvl] -eq cantrip -or [*R:spellprepared] -eq 1|PREPARED --+|[rbutton]::SPELLDETAILS;[*R:spellname]\repeating_spell-[&amp;zLvl]\spellname[/rbutton][rbutton]⬜️::PREPARESPELL;[*R:spellname]\repeating_spell-[&amp;zLvl]\spellname[/rbutton] [*R:spellname] [i][*R:innate] [&amp;zCON][&amp;zRIT][/i] --^ENDIF-1| --:PREPARED| --+|[rbutton]::SPELLDETAILS;[*R:spellname]\repeating_spell-[&amp;zLvl]\spellname[/rbutton][rbutton]✅::PREPARESPELL;[*R:spellname]\repeating_spell-[&amp;zLvl]\spellname[/rbutton] [*R:spellname] [i][*R:innate] [&amp;zCON][&amp;zRIT][/i] --:ENDIF-1| --Rnext| --&gt;DisplayLoop| --:Done| --&lt;| --:SPELLDETAILS| --/+ReEntryVal|[&amp;reentryval] --~rArgs|string;split;\;[&amp;reentryval] --/+Split|[&amp;rArgs]: [&amp;rArgs1], [&amp;rArgs2], [&amp;rArgs3] --Rfind|@{selected|character_id};[&amp;rArgs1];[&amp;rArgs2];[&amp;rArgs3] --Rdump| --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --#rightsub|[*R:spellschool] [*R:spelllevel] --#oddRowBackground|#eeeeee --#evenRowBackground|#ffffff --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&amp;zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&amp;zSCV| --:ENDSCV| --&amp;zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&amp;zSCS| --:ENDSCS| --&amp;zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&amp;zSCM| --:ENDSCM| --+Components:|[&amp;zSCV][&amp;zSCS][&amp;zSCM] [i]([*R:spellcomp_materials])[/i] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --+|[c][sheetbutton] Cast Spell 慄::@{selected|character_name}::[&amp;rArgs2]_[*R:xxxActionIDxxxx]_spell[/sheetbutton][/c] --+|[c][b]Spell Save DC[/b] @{selected|spell_save_dc}[/c] --X| --&lt;| --:PREPARESPELL| --#title|Prepare Spell Toggle --+NOT YET SUPPORTED| --X| --&lt;| }}
@David M. &amp; timmaugh -&nbsp; Appreciate your responses, guys, particularly since I know you work and run your own games as well. What I was trying to attempt was a polymorph spell.&nbsp; The idea would be to have the target token being polymorphed into another creature (Giant Ape in this case).&nbsp; Originally, I tried to get the Spawn command to work inside the scriptcard but it errored out.&nbsp; I did get the Spawn swap to work but to do so I had to place the Spawn into a separate macro and call it with a button.&nbsp;&nbsp; &nbsp; &nbsp; --+|[button]I Call Thee Forth, Giant Ape!::~Macros|SummonApe[/button] The button macro itself included: !Spawn{{&nbsp;&nbsp;--name|Giant Ape&nbsp;&nbsp;--qty|1&nbsp;&nbsp;--size|2,2&nbsp;&nbsp;}} !scriptcard {{&nbsp; --@token-mod| _ids @{selected|token_id} _set layer|gmlayer&nbsp; }} (the stack is implied in Spawn as I understand it.) I didn't know about the size to 0 trick but did try the --DeleteTarget| command [which worked BTW for the selected target] but I didn't want to do that in case it was another player's token that was the target.&nbsp; &nbsp; I approached David about the issue with not being able to call the Spawn script from the scriptcards --# command and he explained the problem, mentioned the !Forselected script that was written to resolve it and suggested I try: &nbsp; &nbsp;--@forselected|Spawn _name|Giant Ape&nbsp; _qty|1 _size|2,2&nbsp; to see if it fixed the problem but I couldn't get it to work.&nbsp;&nbsp;(I did try reversing the order and had no better result.)&nbsp; Perhaps it isn't possible or there is a better way?&nbsp; &nbsp;&nbsp;
I have my attack card pretty much where it needs to be, for now.&nbsp; I'm trying to figure out how incorporate Full Attack functionality into what I already have.&nbsp; I have a roll query that asks if it is a Full Attack and, if so, applies a -4 to attack rolls.&nbsp; I thought about using a conditional that would send the card back to the beginning of the attack sequence.&nbsp; I feel like it would start looping since the conditional that would start the loops would likely send it back again. Any thoughts? !scriptcard {{ --#title|@{selected|weaponname} --Rfind|@{selected|character_id};@{selected|weaponname};repeating_attack;name --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#leftsub|[*R:engagement_range] --#rightsub|[*R:category] --#emoteText|[*S:character_name] knocks da shit outta [*T:character_name] --&gt;ACtype| --&gt;AttackTypeSelect| --+Attack Modifier?|[$AttackMod] --+Enemy AC:|[$AC] --=AttackRoll|10d20kh1 + [*R:total] [Attack Bonus] + [$AttackMod] [Attack Penalty] --+|@{selected|token_name} rolls a [$AttackRoll] to hit versus Armor Class [$AC] --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -lt [$AC]|Miss --:Hit| --&gt;RollDamage| --+Hit!|You did [$Damage] points damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --X| --:Miss| --+|You missed --X| --:Fumble| --+|Ya effed up A-A-Ron --X| --:Crit| --&gt;RollDamage|crit --+Critical Hit!!!| You hit really well. You did [$Damage] points of damage. --X| --:RollDamage| --?[%1%] -eq crit|CritDamage --=Damage|[*R:damage_total] [Base] --&lt;| --:CritDamage| --?[$AttackRoll.Total] -gt [$AC]|FullCrit --=Damage|[*R:total_damage] [Base] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --&lt;| --:FullCrit| --=Damage|[*R:damage_total] [Base] + @[*R:damage_total] [Bonus] + [*R:crit] [Weapon Crit] --+Critical Hit!!!| You hit really well. You did [$Damage] points of damage. --?[&amp;ACtype] -eq Energy|EnergyCrit --=roll|[T#CritDeckKinetic] --+Critical Effect:|[$roll.tableEntryText] --&gt;Done| --:EneryCrit| --=roll|[T#CritDeckEnergy] --+Critical Effect:|[$roll.tableEntryText] --+Crit Effect:|[*R:crit] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --:Done| --X| --:ACtype| --?[*R:type] -eq "b"|KAC --?[*R:type] -eq "p"|KAC --?[*R:type] -eq s|KAC --=AC|[*R:eac] --&amp;ACtype|Energy --+AC Type:|Energy --&lt;| --:KAC| --=AC|[*T:kac] --&amp;ACtype|Kinetic --+AC Type:|Kinetic --&lt;| --:AttackTypeSelect| --=AttackMod|?{Full Attack?|No,0|Yes,-4} --&lt;| }}
Sorry... Might have not been clear on what I was looking for... I have seen the layout before... Might have been with this script, or power cards...or both..?? But I was looking for more of a table type thing... Where I could put the text in the 1st line, then the value in the next line... Yet have them all lined up equally... &nbsp;S&nbsp; &nbsp; D&nbsp; &nbsp;W&nbsp;&nbsp; 15&nbsp; 12&nbsp; &nbsp;14 type format...I know it can be done.... Just cant seem to find it anywhere.... And I don't remember the syntax to accomplish it. Thanks
1619227971

Edited 1619229078
Please Help!&nbsp; If I create an ability on the character sheet with this code, the code works perfectly: !scriptcard&nbsp; {{ &nbsp; --#title|Fire Bolt --#sourceToken|@{selected|token_id} &nbsp; --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} &nbsp; --=Cast|?{What to do|Cast Spell, 1|View Text, 0} --=DmgDie| 10 --=CritDie| 10 --&amp;DmgTyp| Fire --=DmgDieNum| 1 --=Dmg|[$DmgDieNum]d[$DmgDie] --=CritDmg|[$DmgDieNum]d[$CritDie] --?[$Cast] -eq 0|SpellText| --=Cover ?{Cover| None, 0| Half, 2| 3Quarters, 5} --=DMHitMod|?{DMHitBonus|0} --=TmpRoll|?{DMDamageBonus|0} --=DmgMod2|+[$DmgMod]+[$TmpRoll] --=AtkRoll| 1d20 + @{spell_attack_bonus} - [$Cover] + [$DMHitMod] --+Attack: You fire of a bolt and |[$AtkRoll] vs @{target|ac} --?[$AtkRoll.Base] -eq 1|Fumble &nbsp;--?[$AtkRoll.Base] -eq 20|Crit --?[$AtkRoll] -ge @{target|ac}|Hit --?[$AtkRoll] -lt @{target|ac}|Miss --:Fumble| --+Fumbled| You missed horribly! Lose your next turn --^End| --:Hit| --+You hit for| [$Dmg] [&amp;DmgTyp] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Dmg] --^End| --:Crit| --+Critical| You critically hit for [$Dmg] [&amp;DmgTyp] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Dmg] --^End| --:Miss| --+Drat| Missed again. --^End| --:SpellText| --+School &amp; Level| Evocation Cantrip --+Time &amp; Speed| 1 Action Instantaneous --+Range &amp; Components|&nbsp; 120ft VS --+Damage Type| [&amp;DmgTyp] --+Text|You hurl a mote of fire at a creature or object within range. Make a ranged spell attack against the target. On a hit, the target takes 1d10 fire damage. A flammable object hit by this spell ignites if it isn't being worn or carried. This spell's damage increases by 1d10 when you reach 5th level (2d10), 11th level (3d10), and 17th level (4d10). --:End| }} If I cut and paste the above into a macro and then call that macro from an ability on the character sheet. ex:&nbsp; Ability name: FireBolt with #spellFirebolt&nbsp; I get about a dozen" TypeError: undefined has no properties" nothing else, it terminates without executing the first dropdown (Cast). I cannot see why it fails.&nbsp; Closing the program and restarting does not help, restarting the sandbox does not help, however I will also gen the following error in the API Console:&nbsp; "ScriptCards Error: Label&nbsp; is not defined on line 12" which I have not yet determined what that means as line 12 in my script looks good. Thank you for your assistance in this matter.
1619229586

Edited 1619229662
BilBo 2 said: Sorry... Might have not been clear on what I was looking for... I have seen the layout before... Might have been with this script, or power cards...or both..?? But I was looking for more of a table type thing... Where I could put the text in the 1st line, then the value in the next line... Yet have them all lined up equally... &nbsp;S&nbsp; &nbsp; D&nbsp; &nbsp;W&nbsp;&nbsp; 15&nbsp; 12&nbsp; &nbsp;14 type format...I know it can be done.... Just cant seem to find it anywhere.... And I don't remember the syntax to accomplish it. Thanks Try using html table syntax: --+|[t][tr][td]S[/td]D[/td][td]W[/td][/tr][tr][td]15[/td][td]12[/td][td]14[/td][/tr][/t] BTW, you can insert html span and style components in the [t], [td], and [tr] tags and it works.&nbsp; Very handy.&nbsp; Like [td colspan=2] to merge 2 columns on a row.&nbsp;&nbsp;