Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "ScriptCards Scripts"

From Roll20 Wiki

Jump to: navigation, search
(Created page with "Script:ScriptCards = Repository of working scripts for ScriptCards = {{tocright}} This page is intended to be a centralized repository of working scripts that have bee...")
 
m (add category)
 
(68 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Script:ScriptCards]]
+
{{revdate}}
  
= Repository of working scripts for ScriptCards =  
+
{{NavboxN
{{tocright}}
+
|1 =
This page is intended to be a centralized repository of working scripts that have been tested and are working as expected.  Please describe the intended results of the script, include any screenshots/images you think will support the script and then please post the script itself.
+
|2 = 350px
 +
|3 = right
 +
|4 =
 +
<span style="font-size: x-large; font-weight: bold;"> Related Links</span> <br>
 +
<hr>
 +
<span style="font-size: medium; font-weight: bold;"> Roll20 Forum Links:</span> <br>
 +
- [https://app.roll20.net/forum/permalink/9752053/ Main ScriptCards Thread]<br>
 +
- [https://app.roll20.net/forum/permalink/10000297/ ScriptCards Working and Sharing thread]<br>
 +
 
 +
<span style="font-size: medium; font-weight: bold;"> GitHub Links:</span> <br>
 +
- [https://github.com/kjaegers/ScriptCards/blob/main/ScriptCards_API/changelog.txt ScriptCards Changelog]<br>
 +
- [https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_API ScriptCards API]<br>
 +
- [https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_Examples ScriptCards Samples]<br>
 +
 
 +
<span style="font-size: medium; font-weight: bold;"> Roll20 Wiki Links:</span> <br>
 +
- [https://wiki.roll20.net/Script:ScriptCards Main Page]<br>
 +
- (This Page) [https://wiki.roll20.net/index.php?title=ScriptCards_Scripts User-submitted scripts]<br>
 +
- [https://wiki.roll20.net/ScriptCards_LibrariesHandouts User-submitted Libraries]<br>
 +
- [https://wiki.roll20.net/ScriptCards_Triggers User-submitted Triggers]<br>
 +
 
 +
<span style="font-size: medium; font-weight: bold;"> Official Discord:</span> <br>
 +
- [https://discord.gg/jSB4wTNpXb ScriptCards Official Discord Channel]<br>
 +
 
 +
<span style="font-size: medium; font-weight: bold;"> YouTube Tutorials:</span> <br>
 +
- [https://youtu.be/hyR7Jnq4mQM ScriptCards Intro]<br>
 +
- [https://youtu.be/u50xvNzS9Zk ScriptCards Magic Missile Deep Dive]<br>
 +
}}
 +
 
 +
<span style="font-size:small;">{{toc | clear=none | width=400px | align=left}}</span>
 +
 
 +
== Working scripts for ScriptCards ==
 +
This page is intended to be a centralized repository of working scripts, and meaningful variations, that have been tested and are working as expected.  Use the following guidance to add your masterpiece to the grand library of scripts.<br><br>
 +
*<span style="margin-left:10px; font-size:large;">'''When submitting an original script'''</span> please edit the Template: Example Script Name section and then copy the entire section (starting with '''=== Template Script Name ===''' all the way down through the '''<nowiki></div><br></nowiki>''' at the end) and paste this at the end of the Shared Scripts section, after the final script shown.<br>
 +
<span style="margin-left:30px;"> Please update the info section to provide your name, describe if the script is specific to a particular game/system, the purpose, description of intended results, screenshots, and any caveats or notes a user should be aware of up front.</span><br>
 +
<span style="margin-left:30px;">There is a guide below to help you with filling out the information section in case you get stuck anywhere.</span><br><br>
 +
 
 +
*<span style="margin-left:10pxfont-size:large;">'''When submitting a variation of a shared script''' </span> please submit by using the following steps:<br>
 +
<span style="margin-left:30px;">1. '''Use the link''' in the Template: Example Script Name navigation box on the right side of the screen to go to the sample variation Sub-page.  '''Edit the page''' and '''copy the entire template''' from the sub-page.</span><br>
 +
<span style="margin-left:30px;">2. '''Navigate to the not-yet-created URL''' of the sub-page you will create:  '''</span><span style="color:#2D882D;">wiki.roll20.net/ScriptCards_Scripts/</span> <span style="color:#AA6C39;">(Original Script Name)</span> <span style="color:#226666;">_Variation_</span> <span style="color:#AA3939;">(Simple Label of Changes)</span>'''<br>
 +
<span style="margin-left:50px;"> {{c|(e.g. https://wiki.roll20.net/ScriptCards_Scripts/SmartAOE_Variation_Pathfinder2e)}}</span><br>
 +
<span style="margin-left:30px;">3. You should be brought to a '''blank Wiki-style page''' that says:  ''There is currently no text in this page. You can search for this page title in other pages, search the related logs, or edit this page.''</span><br>
 +
<span style="margin-left:50px;">Either click the '''Create''' button or '''Edit this Page''' button as they both do the same thing:  Create the page and take you into edit mode</span><br>
 +
<span style="margin-left:30px;">4. Once in edit mode on the new sub-page, '''paste the template example''' you copied and then '''fill out''' all the juicy details.  Be sure to '''give credit to the amazing work of the original author''' that inspired your variation!</span><br>
 +
<span style="margin-left:30px;">5. You can preview your work with the '''Preview button''', or Save your work with the '''Save button''' and see the finished product!</span><br>
 +
<span style="margin-left:30px;">6. '''Mention in the official Discord''' ScriptCards channel that you added a new sub-page and '''please provide the link''' so that the navigational links can be manually created for others to view your work!</span><br>
 +
<br>
 +
[https://meta.wikimedia.org/wiki/Help:Wikitext_examples WikiText markup cheat sheet:]
 +
<br><br>
 +
 
 +
=== Guide to completing the Info Section: ===
 +
1. <span style="font-size: 14px;">'''Author of script:'''</span> Your Discord or Roll20 Forum name<br>
 +
<br>
 +
2. <span style="font-size: 14px;">'''Game/System specific? Which one:'''</span> If not game/system specific put "System Neutral", otherwise please put the name of the game(s)/system(s) your script works with<br>
 +
<br>
 +
3. <span style="font-size: 14px;">'''Does this script require additional mods to function?  If yes, please list them here:'''</span> If no, put "N/A", otherwise please list any mods, besides ScriptCards, that are required for this script to work correctly.<br>
 +
<br>
 +
4. <span style="font-size: 14px;">'''Purpose of script:'''</span> Provide an overall description of the purpose of the script<br>
 +
::<span style="font-size: 14px;">''Example 1:''</span> This script attempts to haggle with vendors<br>
 +
::<span style="font-size: 14px;">''Example 2:''</span> This script identifies the remaining health of combat targets<br>
 +
<br>
 +
5. <span style="font-size: 14px;">'''Description of intended results:'''</span> Describe how a user should expect to interact with your script and what they should expect to see when it works. Doesn't need to be too detailed; just enough for a user to know if the script is not working as intended.<br>
 +
::<span style="font-size: 14px;">''Example 1:''</span> The user will press a macro button to activate, which will generate several options for their attempt to haggle with vendors based on certain skills or attributes.<br>
 +
::<span style="font-size: 14px;">''Example 2:''</span> This script will always be on once activated.  It will outline combat targets with green/ yellow/ red based on remaining health being above 80%, 50% or below 25% respectively<br>
 +
<br>
 +
6. <span style="font-size: 14px;">'''Screenshots:'''</span> Initial screenshots; more can be added throughout the body of the contents if desired.<br>
 +
<br>
 +
7. <span style="font-size: 14px;">'''Caveats/ Notes:'''</span> N/A if none, otherwise please describe.  Please put any important notes about the script's usage or behavior here.<br>
 +
<br>
 +
8. <span style="font-size: 14px;">'''Script code:'''</span> insert the script code between the ''<nowiki><pre> ... </pre></nowiki>'' tags below this line.<br><br>
 +
<br><br>
 +
 
 +
{{NavboxN
 +
|1 = Variations of karma827's Example Script
 +
|2 = 300px
 +
|3 = right
 +
|4 =
 +
<hr>
 +
1. [https://wiki.roll20.net/ScriptCards_Scripts/Script_Variant_Template#Template:_Example_Variant_Script_Name This is the template for submitting variants!]<br>
 +
2. Mock-up of Link to a different Variant Script
 +
}}
 +
 
 +
=== Template: Example Script Name ===
 +
<span class="mw-customtoggle-SCRIPT_NAME" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-SCRIPT_NAME" style="width: 100%;">
 +
 
 +
<!-- AFTER PASTING THE TEMPLATE:  Delete any text between the internal comment symbols:  <! --  -- >  as they will not be seen by a typical viewer.  They're intended to be a reminder to submitters in how to use this template only.
 +
This template represents some basic syntax to post a script on this page.  Please be sure to copy and then paste this entire section at the end of the existing list of scripts. 
 +
When updating your copy of the template, please remember the following tips:
 +
  In the code just after the heading line (with the ===) be sure the span class name ends in the exact same naming as the ID on the line below the heading.  If they don't match the fabric of space and time will fall apart!  The first part (mw-...) will be different on each row.
 +
      span class="mw-customtoggle-SCRIPT_NAME" and id="mw-customcollapsible-SCRIPT_NAME"
 +
      Capitals matter, so be sure to pay close attention.
 +
AFTER PASTING THE TEMPLATE:  DELETE ABOVE THIS ROW so that "Author of script" comes right after the ''div class'' line above. -->
 +
 
 +
'''Author of script:''' <!-- Your Discord or Roll20 Forum name --><br>
 +
'''Game/System specific? Which one:''' <!-- Either put "System Neutral" or put the name of the game/system your script work with --> <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' <!--  --><br>
 +
'''Purpose of script:''' <!-- Provide an overall description of the purpose of the script --> <br>
 +
'''Description of intended results:''' <!-- Describe how a user should expect to interact with your script and what they should expect to see when it works. Doesn't need to be too detailed; just enough for a user to know if the script is not working as intended. --> <br>
 +
'''Screenshots:''' <!-- Initial screenshots; more can be added throughout the body of the contents if desired. --> <br>
 +
'''Caveats/ Notes:''' <!-- N/A if none, otherwise please describe. Please put any important notes about the script's usage or behavior here. --> <br>
 +
'''Script code:''' <!--Note: Be sure to keep the <pre>...</pre> tags around your main script code to prevent issues with anything in the script being considered as code to the Wiki page.--><br>
 +
<pre>Enter script code here
 +
</pre>
 +
</div>
 +
<br><br>
 +
 
 +
== Shared Scripts ==
 +
Below you'll find the good stuff.  You can use the table of contents for quick navigation.  As long as the Script name is surrounded by "===" on both sides, it'll automatically be added to the table of contents.<br/><br/>
 +
 
 +
=== Displaying multiple rollable table image results on a single line - Alien TTRPG Example ===
 +
 
 +
<span class="mw-customtoggle-multiple_rollable_table_images" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-multiple_rollable_table_images" style="width: 100%;">
 +
'''Author of script:''' [https://app.roll20.net/users/3987469/david-m| David M.]<br>
 +
'''Game/System specific? Which one:''' Alien TTRPG<br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' N/A<br>
 +
'''Purpose of script:''' This example appends URLs to a string variable in a loop and displays the results to a single output line. <br>
 +
'''Description of intended results:''' This example appends URLs to a string variable in a loop and displays the results to a single output line (have to prepend alignment and img size tags, then build URL strings, then append closing tag). Here's what I came up with for the Alien TTRPG. You roll a number of base dice, and a number of "stress" dice. Both count 6's as a success, while the stress dice can also add a failure for each roll of 1. Add successes & failures to determine overall result of the check. Here's a couple of example checks, using rollable table graphics for the cool Alien dice and string building variables to put the dice on a single line. <br>
 +
'''Screenshots:''' <br>
 +
'''Caveats/ Notes:''' N/A <br>
 +
'''Script code:'''<br>
 +
<pre>!scriptcard {{
 +
  --#title|AlienTTRPG Rolls
 +
  --#leftsub|Num Dice ?{Num Dice?|1}
 +
  --#rightsub|Num Stress Dice ?{Num Stress Dice?|0}
 +
 
 +
  --:Initialize Roll Vars|
 +
      --=NumDice|?{Num Dice?}
 +
      --=NumStressDice|?{Num Stress Dice?} 
 +
      --=NumSuccess|0
 +
      --=NumFail|0
 +
  --:String Building Vars| Will store table graphics. Pre-pend opening format tag
 +
      --&DieOutput|+[r]
 +
      --&StressOutput|+[r]
 +
 
 +
  --:Base Dice Block|
 +
      --+[#990000]BASE ROLLS[/#]|
 +
      --=DieCount|0
 +
      --:BaseDiceLoop|
 +
              --=DieCount|[$DieCount] + 1
 +
              -->RollBase|
 +
              --?[$DieCount] -lt [$NumDice]|BaseDiceLoop
 +
  --:Output Main Dice| but first append closing format tag
 +
      --&DieOutput|+[/r]
 +
      --+|[&DieOutput]
 +
 
 +
  --:Stress Dice Block|
 +
      --+[#990000]STRESS ROLLS[/#]|
 +
      --?[$NumStressDice] -eq 0|>NA
 +
      --?[$NumStressDice] -eq 0|EvaluationBlock
 +
      --=DieCount|0
 +
      --:StressLoop|
 +
              -->RollStress|
 +
              --=DieCount|[$DieCount] + 1
 +
              --?[$DieCount] -lt [$NumStressDice]|StressLoop
 +
  --:Output Stress Dice| but first append closing format tag
 +
      --&StressOutput|+[/r]
 +
      --+|[&StressOutput]
 +
 
 +
  --:EvaluationBlock|
 +
      --+[#990000]EVALUATION[/#]|
 +
    --:Output Success and Failure counts|
 +
              --+|[r][b]Successes=[$NumSuccess][/b][/r]
 +
              --+|[r][b]Failures=[$NumFail][/b][/r]
 +
      --:Compare rolls|
 +
              --=Diff|[$NumSuccess] - [$NumFail]
 +
              --+|[r][b]Difference[$Diff][/b][/r]
 +
      --+[#990000]RESULT[/#]|
 +
      --:Output Overall Success or Failure|
 +
              --?[$Diff] -gt 0|OverallSuccess
 +
              --?[$Diff] -le 0|OverallFailure 
 +
  --X| End macro
 +
 
 +
--:FUNCTIONS|
 +
--:NA|
 +
    --+|[b][r]N/A[/r][/b]
 +
    --<|
 +
  --:RollBase|
 +
    --=ThisRoll|[T#AlienD6]
 +
    --?[$ThisRoll.tableEntryValue] -eq 6|>AddSuccess
 +
    --&DieOutput|+[img width=32][$ThisRoll.tableEntryImgURL][/img]
 +
    --<|
 +
  --:RollStress|
 +
    --=ThisRoll|[T#AlienStressD6]
 +
    --?[$ThisRoll.tableEntryValue] -eq 6|>AddSuccess
 +
    --?[$ThisRoll.tableEntryValue] -eq 1|>AddFail
 +
    --&StressOutput|+[img width=32][$ThisRoll.tableEntryImgURL][/img]
 +
    --<|
 +
--:AddSuccess|
 +
    --=NumSuccess|[$NumSuccess] + 1
 +
    --<|
 +
--:AddFail|
 +
    --=NumFail|[$NumFail] + 1
 +
    --<|
 +
--:OverallSuccess|
 +
    --+[c][#009900]~~~SUCCESS~~~[/#][/c]|
 +
    --X|
 +
    --<|
 +
--:OverallFailure|
 +
    --+[c][#ff0000]~~~FAILURE~~~[/#][/c]|
 +
    --X|
 +
}}
 +
</pre>
 +
 
 +
</div>
 +
<br><br>
 +
 
 +
=== Bubble Sort Algorithm===
 +
 
 +
<span class="mw-customtoggle-bubble_sort_algorithm" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-bubble_sort_algorithm" style="width: 100%;">
 +
'''Author of script:''' [https://app.roll20.net/users/3987469/david-m| David M.]<br>
 +
'''Game/System specific? Which one:''' System Neutral <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' N/A<br>
 +
'''Purpose of script:''' The following takes a collection of die rolls and sorts them for display purposes.<br>
 +
'''Description of intended results:''' Die rolls are sorted in ascending order. <br>
 +
'''Screenshots:''' <!-- Initial screenshots; more can be added throughout the body of the contents if desired. --> <br>
 +
'''Caveats/ Notes:''' Currently hardcoded to 4 rolls, but could be generalized by adding loops, etc.  '''Observation:''' the HiLow formatting is lost if a particular roll changes position. If you sort rolls, it might be best to remove HiLow formatting in your scriptcard to avoid potential confusion.<br>
 +
'''Script code:'''<br>
 +
<pre>!scriptcards {{ 
 +
  --=NumDice|4
 +
 
 +
  --=Roll1|1d6
 +
  --=Roll2|1d6
 +
  --=Roll3|1d6
 +
  --=Roll4|1d6
 +
 
 +
  --+Unsorted Rolls|
 +
  --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4]
 +
 
 +
  --:PERFORM A BUBBLE SORT|
 +
  --=i|0
 +
  --=max_i|[$NumDice]-1
 +
  --:OuterLoop|
 +
        --=i|[$i]+1
 +
                --=j|[$i]
 +
                --:InnerLoop|
 +
                    --=j|[$j]+1
 +
                    --?[$Roll[$i.Raw]] -gt [$Roll[$j.Raw]] |>BubbleUp;[$i.Raw];[$j.Raw]
 +
                --?[$j.Raw] -lt [$NumDice.Raw]|InnerLoop
 +
        --?[$i.Raw] -lt [$max_i.Raw]|OuterLoop
 +
 
 +
  --+Rolls sorted ascending|
 +
  --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4]
 +
  --X|
 +
 
 +
--:FUNCTIONS| 
 +
  --:BubbleUp| accepts i, j as parameters. Swaps Roll[i] & Roll[j]
 +
      --=Temp|[$Roll[%2%]]
 +
      --=Roll[%2%]|[$Roll[%1%]]
 +
      --=Roll[%1%]|[$Temp]
 +
  --<| 
 +
}}
 +
</pre>
 +
</div>
 +
<br><br>
 +
 
 +
=== 5e Turn Undead ===
 +
<span class="mw-customtoggle-5e_turn_undead" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-5e_turn_undead" style="width: 100%;">
 +
'''Author of script:''' [https://app.roll20.net/users/3987469/david-m| David M.]<br>
 +
'''Game/System specific? Which one:''' D&D 5e <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' Scriptcards, Token-mod (with Players can use --ids set to true!), Radar (just for show, doesn't really do anything mechanics-wise), and SelectManager.<br>
 +
'''Purpose of script:''' Sharing a scriptcard below for 5e Turn Undead, using Kurt's Fireball card as a starting point. <br>
 +
'''Description of intended results:'''
 +
*Finds all tokens on objects and gmlayer (for invisible undead)
 +
*Filters for npc_type to affect only those with "undead" keywords<br>
 +
*Makes saves for affected tokens within range (note: Euclidean distance used - so Pythagorean theorem) and displays in chat with color-coded text for pass/fail<br>
 +
*Checks the cleric level (note: assumes single class!) to determine if failure will turn or destroy based on CR of the undead<br>
 +
*'''''[Read this - Important!]''''' Assigns a token condition marker on failure: "dead" marker for destroyed undead, and a custom "fear" marker to indicate turned. These will need to be changed based on the markers you have available (look for the conditional call to the AddConditionMarker procedure found within the FailedSave procedure)<br>
 +
*Creates a 30ft animated wavefront representing the burst of divine energy, using the Radar script (via SelectManager). Silent option to prevent radar chat results, and pingLife|0 to not produce visible "pings". This is optional and requires the Radar script and SelectManager to be installed. <br>
 +
'''Screenshots:''' https://s3.amazonaws.com/files.d20.io/images/213039221/RiUBu8g-01ECiNR5OzazFg/original.gif?1617464582<br>Example gif with a 5th level cleric (destroys CR 1/2 or lower) surrounded by skeletons (CR 1/4), Specters (CR 1), and an Ogre Zombie (CR 2).<br>
 +
'''Caveats/ Notes:''' EDIT- updated to take the greater of the attributes "wisdom_save_bonus" and "npc_wis_save_base". If the latter is blank we do some substitution to ensure the former is used).<br>EDIT 2 - [https://app.roll20.net/forum/post/10000297/scritpcard-api-working-and-sharing/?pageforid=10089625#post-10089625| Here is a link] to a one-off of this scriptcard that adds "Destroy" or "Turn" next to the creature save in the chat output.<br>
 +
'''Script code:'''
 +
<pre>
 +
!script {{
 +
  --#title|@{selected|character_name} Turns Undead!
 +
  --#leftsub|Save DC @{selected|spell_save_dc}
 +
 
 +
  --:(0) CREATE AN ANIMATED WAVEFRONT WITH RADAR SCRIPT| uses SelectManager to retain selected token
 +
  --@forselected|radar_range|30ft _pinglife|0 _wavedelay|20 _wavespacing|10 _silent|true
 +
 
 +
  --:(1) DETERMINE CR OF UNDEAD THAT CAN BE DESTROYED|
 +
  --=charLevel|@{selected|level}
 +
  --?[$charLevel] -lt 5|>SetCRdestroy;0
 +
  --?[$charLevel] -ge 5 -and [$charLevel] -lt 8|>SetCRdestroy;0.5
 +
  --?[$charLevel] -ge 8 -and [$charLevel] -lt 11|>SetCRdestroy;1
 +
  --?[$charLevel] -ge 11 -and [$charLevel] -lt 14|>SetCRdestroy;2
 +
  --?[$charLevel] -ge 14 -and [$charLevel] -lt 17|>SetCRdestroy;3
 +
  --?[$charLevel] -ge 17|>SetCRdestroy;4
 +
 
 +
  --:(2) GET ALL TOKENS INTO THE "allTokens" ARRAY| will have blank 1st element to be removed later
 +
  --~|array;pagetokens;allTokens;@{selected|token_id}
 +
 
 +
  --:(3) CREATE THE "inRange" ARRAY TO HOLD TOKENS IN RANGE|
 +
  --~|array;define;inRange;
 +
 
 +
  --:(4) PREP ARRAY FOR LOOP| if no array elements then end macro
 +
  --~tokenid|array;getfirst;allTokens
 +
  --?[&tokenid] -eq ArrayError|endOutput
 +
 
 +
  --:(5) FIND ALL TOKENS IN RANGE|
 +
  --:RangeLoop|
 +
          --:TOKEN MUST BE ON OBJECTS OR GMLAYER AND TYPE MUST INCLUDE UNDEAD|
 +
          --?[*[&tokenid]:t-layer] -ne objects -and [*[&tokenid]:t-layer] -ne gmlayer|NextToken
 +
          --?"[*[&tokenid]:npc_type]" -ninc "undead"|NextToken
 +
         
 +
          --:CHECK DISTANCE IN UNITS. 30ft is 6UNITS|
 +
          --~dist|euclideandistance;@{selected|token_id};[&tokenid]
 +
          --?[$dist] -gt 6|NextToken
 +
         
 +
          --:ADD TO THE "inRange" ARRAY|
 +
          --~|array;add;inRange;[&tokenid]
 +
 
 +
          --:NextToken|
 +
          --~tokenid|array;getnext;allTokens
 +
          --?[&tokenid] -ne ArrayError|RangeLoop
 +
 
 +
  --:(6) REMOVE DUMMY FIRST ITEM IN inRange ARRAY|
 +
  --~|array;removeat;inRange;0
 +
 
 +
  --:(7) ROLL SAVES FOR EACH TOKEN IN RANGE| if fail, set a token condition marker to denote turned
 +
  --~tokenid|array;getfirst;inRange
 +
  --?[&tokenid] -eq ArrayError|End
 +
  --:SaveLoop|
 +
          -->GetSaveBonus|[&tokenid];wisdom;wis
 +
          --=SaveRoll|1d20 + [$saveBonus] [BONUS]       
 +
          --?[$SaveRoll.Total] -ge @{selected|spell_save_dc}|>MadeSave|>FailedSave
 +
          --~tokenid|array;getnext;inRange
 +
          --?[&tokenid] -ne ArrayError|SaveLoop
 +
 
 +
  --:End|
 +
  --X|
 +
 
 +
--:PROCEDURES|
 +
  --:SetCRdestroy| accepts CR as parameter
 +
      --=CRdestroy|[%1%]
 +
  --<|
 +
 
 +
  --:GetSaveBonus| accepts tokenid, full attribute name, short attribute name as parameters
 +
      --:TAKE THE GREATER OF "attribute_save_bonus" OR "npc_attr_save"|
 +
      --=bonus1|[*[%1%]:[%2%]_save_bonus]
 +
      --&bonus2|[*[%1%]:npc_[%3%]_save_base]
 +
      --:SOMETIMES "npc_attr_save_base" IS BLANK, SO SET TO -99. OTHERWISE USE ATTR VALUE|
 +
          --?X[&bonus2] -eq "X"|>Set_npc_attr_save_bonus;-99|>Set_npc_attr_save_bonus;[&bonus2]
 +
      --:FINALLY SET THE SAVE BONUS|
 +
      --?[$bonus2] -gt [$bonus1]|>SetSaveBonus;[$bonus2]|>SetSaveBonus;[$bonus1]
 +
  --<|
 +
 
 +
  --:Set_npc_attr_save_bonus| blank value is set to -99, otherwise use value stored in attribute
 +
      --=bonus2|[%1%]
 +
  --<|
 +
 
 +
  --:SetSaveBonus|
 +
      --=saveBonus|[%1%]
 +
  --<|
 +
 
 +
  --:MadeSave|
 +
        --+[*[&tokenid]:character_name]:|[#009900][b]Made Save[/b][/#] [$SaveRoll]
 +
  --<|
 +
 
 +
  --:FailedSave| add either a dead or fear condition marker to the token, depending on CR
 +
      --+[*[&tokenid]:character_name]:|[#990000][b]Failed Save[/b][/#] [$SaveRoll]
 +
      --=CR|[*[&tokenid]:npc_challenge]
 +
      --?[$CR] -le [$CRdestroy]|>AddConditionMarker;[&tokenid];dead|>AddConditionMarker;[&tokenid];Fear::1510130
 +
  --<|
 +
 
 +
  --:AddConditionMarker| accepts tokenID and condition marker as parameter
 +
      --@token-mod|_ignore-selected _ids [%1%] _set statusmarkers|[%2%]
 +
  --<|
 +
}}
 +
</pre>
 +
</div>
 +
<br><br>
 +
 
 +
=== 5e Mob Attacks ===
 +
<span class="mw-customtoggle-5e_mob_attacks" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-5e_mob_attacks" style="width: 100%;">
 +
'''Author of script:''' [https://app.roll20.net/users/3987469/david-m| David M.]<br>
 +
'''Game/System specific? Which one:''' D&D 5e <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' N/A<br>
 +
'''Purpose of script:''' <!-- Provide an overall description of the purpose of the script --> <br>
 +
'''Description of intended results:''' <!-- Describe how a user should expect to interact with your script and what they should expect to see when it works. Doesn't need to be too detailed; just enough for a user to know if the script is not working as intended. --> <br>
 +
'''Screenshots:''' https://s3.amazonaws.com/files.d20.io/images/221609567/ZPlgYBvtEFXj22odj5NGSQ/original.png?1620743237; https://s3.amazonaws.com/files.d20.io/images/221609645/qdnShEx0gl9BVogWBbuwHQ/original.png?1620743274 <br>
 +
'''Caveats/ Notes:''' Queries for number of attackers, att/dam modifiers, Norm/Adv/DisAdv, and target AC. <br>
 +
'''Script code:'''
 +
<pre>
 +
!scriptcard  {{
 +
--:USER INPUT|
 +
  --=NumAttacks|?{Number Attackers?|2}
 +
  --&RollString|?{Attack Type?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1}+?{Attack Modifier?|0}
 +
  --&DamDice|?{Damage Dice?|1d8}
 +
  --&DamMod|?{Damage Modifier?|0}
 +
  --=TargetAC|?{Target AC?|10}
 +
 
 +
--:TITLE CARD DISPLAY|
 +
  --#whisper|gm
 +
  --#title|Mob Attack
 +
  --#leftsub|[&RollString] vs AC [$TargetAC]
 +
  --#rightsub|Dam:[&DamDice]+[&DamMod]
 +
 
 +
--:LOOP THROUGH ATTACKS
 +
  --=DisplayCount|1
 +
  --=DamageTotal|0
 +
  --:AttackLoop|
 +
      -->MakeAttack| call function
 +
      --=DisplayCount|[$DisplayCount] + 1
 +
      --?[$DisplayCount] -le [$NumAttacks]|AttackLoop
 +
 
 +
--:DISPLAY TOTAL DAMAGE|
 +
  --+Total|Total damage is [$DamageTotal]
 +
  --X|Exit macro
 +
 
 +
--:PROCEDURES|
 +
  --:MakeAttack|
 +
      --=ThisAttack|[&RollString]
 +
      --?[$ThisAttack.Base] -eq 20|Crit
 +
      --?[$ThisAttack] -ge [$TargetAC]|Hit
 +
      --?[$ThisAttack] -lt [$TargetAC]|Miss
 +
    --:AttackDone|
 +
  --<|
 +
 
 +
  --:Hit|
 +
      --=ThisDamage|[&DamDice][BASE]+[&DamMod][MOD]
 +
      --=DamageTotal|[$DamageTotal] + [$ThisDamage.Total]
 +
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b]Hits[/b] for [$ThisDamage] dam
 +
      --^AttackDone|
 +
  --<|
 +
 
 +
  --:Crit|
 +
      --=ThisDamage|[&DamDice][BASE]+[&DamMod][MOD] + [&DamDice][CRIT]
 +
      --=DamageTotal|[$DamageTotal] + [$ThisDamage.Total]
 +
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b][#009900]Crits[/#][/b] for [$ThisDamage] dam
 +
      --^AttackDone|   
 +
  --<|
 +
 
 +
  --:Miss|
 +
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b][#990000]Misses[/#][/b]
 +
      --^AttackDone|
 +
  --<|
 +
}}
 +
</pre>
 +
</div>
 +
<br><br>
 +
 
 +
=== 5e Conjure Animals ===
 +
<span class="mw-customtoggle-5e_conjure_animals" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-5e_conjure_animals" style="width: 100%;">
 +
'''Author of script:''' [https://app.roll20.net/users/3987469/david-m| David M.]<br>
 +
'''Game/System specific? Which one:''' D&D 5e <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' Scriptcards, SelectManager, SpawnDefaultToken, Table-Export. <br>
 +
'''Purpose of script:''' The caster picks a Challenger Rating of creatures to summon (which also determines a scaled qty of creatures), and some number of random creature types of the appropriate CR are summoned within range. <br>
 +
'''Description of intended results:''' To handle all of the randomness and to have the whole spell in one macro, I ended up using a combination of the Spawn, Scriptcards, and SelectManager api scripts, along with a rollable table that I populated with the Scriptcards version of the Spawn commands (built in excel and imported with Aaron's table-export script). Description below, but fair warning: it's a lot!
 +
Here's what it looks like in action ([https://s3.amazonaws.com/files.d20.io/images/221420890/KFuum3TqQQ23ix9uc3ILmA/original.gif?1620649301| click to play gif]). First, I Spawn a "target" token from a token action ability on the character. This will determine the location where the creatures will spawn. This target token has it's own character sheet and default token (required by Spawn), and I put the scriptcards macro into a token action ability on the target token's sheet. In the example, I selected CR 1/4 creatures. The scriptcards ability rolls on the appropriate rollable table using conditional logic, and you can see 8 CR 1/4 wolves were randomly selected and then spawned at the target location. Note: the grid placement is not ideal for creatures larger than 1x1 (there will be some overlap), as I haven't handled large tokens with grid placement that in the script yet. But, it's easy enough to move them slightly after spawning for now. <br>
 +
'''Screenshots:''' <br>
 +
'''Caveats/ Notes:''' <br>
 +
'''Script code:'''<br>
 +
'''Here's the Spawn ability '''that generated the target token. Note that my characters have access to the spell via a magic item (that I called "Bag of Nature's Allies"). You could call this "Conjure Animals Target" or whatever you want. Just make it match the name of the target "character" sheet.
 +
<pre>!Spawn {{
 +
  --name| Bag of Nature's Allies
 +
  --offset| 1,0
 +
}}
 +
</pre>
 +
'''Here's the scriptcard macro'''. The Rollable table items contain Spawn syntax using the scriptcards format). Also note that the SelectManager script is required to use the "forselected" property to retain the selected token between the two other scripts (Spawn and Scriptcards). The scriptcard populates a "CR" variable, then performs the equivalent of a "Select...Case" (or Switch) statement to call the "RollTable" procedure with the appropriate parameter (the name of the rollable table to use). Finally, it calls the Spawn script (via SelectManager) with the --@forselected line. See the Scriptcard documentation for more info on all of this.
 +
<pre>
 +
!scriptcards {{
 +
--:SETTINGS|
 +
  --#hideCard|1
 +
  --#title|Nature's Allies
 +
 
 +
  --=CR|?{How many creatures?|1x CR 2,2|2x CR 1,1|4x CR 1/2,0.5|8x CR 1/4,0.25}
 +
  --C[$CR.Total]|2:>RollTable;SpawnBeastsCR2|1:>RollTable;SpawnBeastsCR1|0.5:>RollTable;SpawnBeastsCR0.5|0.25:>RollTable;SpawnBeastsCR0.25
 +
 
 +
  --@forselected|[$SpawnSyntax.tableEntryText]
 +
 
 +
  --X| End macro
 +
 
 +
--:PROCEDURES|
 +
  --:RollTable|
 +
        --=SpawnSyntax|[T#[%1%]]
 +
  --<|
 +
}}
 +
</pre>
 +
'''These are the rollable tables I created:'''<br>
 +
https://s3.amazonaws.com/files.d20.io/images/221421534/UT5aKZTCJGFhb-DyQSzGgQ/original.png?1620649730<br><br>
 +
 
 +
'''Here are the table-export macros''' I used to generate the rollable tables. Note the "_p's" referring to the player-controlled copies I made.
 +
<pre>
 +
!import-table --SpawnBeastsCR2 --show
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Saber-Toothed Tiger_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Rhinoceros_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Elk_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Constrictor Snake_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Boar_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Cave Bear_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Allosaurus_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Quetzalcoatlus_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR2 --Spawn _name|Aurochs_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
</pre>
 +
<pre>
 +
!import-table --SpawnBeastsCR1 --show
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Tiger_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Lion_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Vulture_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Toad_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Spider_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Hyena_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Eagle_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Dire Wolf_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Brown Bear_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR1 --Spawn _name|Deinonychus_p _qty|2 _size|1,1 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
</pre>
 +
<pre>
 +
!import-table --SpawnBeastsCR0.5 --show
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Warhorse_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Giant Wasp_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Giant Goat_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Crocodile_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Black Bear_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Ape_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
</pre>
 +
<pre>
 +
!import-table --SpawnBeastsCR0.25 --show
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Wolf_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Pteranodon_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Panther_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Wolf Spider_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Poisonous Snake_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Owl_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Lizard_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Frog_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Centipede_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Bat_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Badger_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Elk_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Draft Horse_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Constrictor Snake_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Boar_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Axe Beak_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Velociraptor_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Ox_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Hadrosaurus_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Dimetrodon_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Cow_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
 +
</pre>
 +
Whew! This is obviously a lot of work for one spell (albeit a complicated spell), but I am pretty happy with the result.
 +
</div>
 +
<br><br>
 +
=== 5e Lay on hands ===
 +
<span class="mw-customtoggle-SCRIPT_NAME" style="font-size:small; font-weight:normal; color:#003399;">[Expand/Collapse This Script]</span>
 +
<div class="mw-collapsible" id="mw-customcollapsible-SCRIPT_NAME" style="width: 100%;">
 +
'''Author of script:''' FarsideGallery<br>
 +
'''Game/System specific? Which one:''' D&D 5e <br>
 +
'''Does this script require additional mods to function?  If yes, please list them here:''' Scriptcards, Token-mod (with Players can use --ids set to true!) <br>
 +
'''Purpose of script:''' Sharing a scriptcard for 5e Paladin Lay on Hands. <br>
 +
'''Description of intended results:''' Queries player for number of conditions to remove or number of HP to restore to target. Verifies class resource (Lay On Hands) has required pool available. Reduces appropriate number of points from the pool and, if heal is chosen, adds the specified
 +
number of hit points to the target.  <br>
 +
'''Screenshots:''' <!-- Initial screenshots; more can be added throughout the body of the contents if desired. --> <br>
 +
'''Caveats/ Notes:''' N/A <br>
 +
'''Script code:''' <br>
 +
<pre>
 +
!scriptcard {{
 +
  --#title|Lay on Hands
 +
  --#sourceToken|@{selected|token_id}
 +
  --#targetToken|@{target|token_id}
 +
  --#leftsub|Healing
 +
  --#rightsub|Resource Pool
 +
 
 +
  --#emoteText|[*S:character_name] uses Lay on Hands on [*T:character_name].
 +
 
 +
  -->GetAndCheckSlotInformation|
 +
  --=Points|0
 +
  --c?{What function do you want to use?|Healing|Remove Condition}|Healing:>Heal|Remove Condition:>Remove|
 +
  -->DeductPoolSlot|
 +
  --x|
 +
 +
  --:Remove|
 +
  --iClick to continue.;Continue|q;input2;How many conditions do you wish to remove?
 +
  --=Conditions|[&input2]
 +
  --=Points|5 * [$Conditions]
 +
  --?[$Points] -gt [*S:class_resource]|[
 +
    --=Conditions|[*S:class_resource] \ 5
 +
--=Points|5 * [$Conditions]
 +
  --+Conditions|You remove [$Conditions] conditions from [*T:character_name].
 +
  -->DeductPoolSlot|
 +
 
 +
  --:Heal|
 +
  --=Missing|[*T:t-bar1_max] - [*T:t-bar1_value]
 +
  --iClick to continue.;Continue|q;input;How many of the [*S:class_resource] points of your healing pool do you want to use?
 +
  --=Points|[&input]
 +
  --?[$Points] -gt [*S:class_resource]|TooManyPoints
 +
  --?[$Points] -le [$Missing]|GoodtoGo
 +
  --<|
 +
 +
  --:TooManyPoints|
 +
  --=Healed|[*S:class_resource]
 +
  --=Points|[*S:class_resource]
 +
  --=NewHealth|[$Healed] + [*T:t-bar1_value]
 +
  -->ApplyHealingTokenmod|@{target|token_id};1;[$NewHealth]
 +
  --+Healing|You healed [*T:character_name] for [$Points] hp.
 +
  -->DeductPoolSlot|
 +
  --<|
 +
 
 +
  --:GoodtoGo|
 +
  --=Healed|[$Missing]
 +
  --=Points|[$Missing]
 +
  --=NewHealth|[$Healed] + [*T:t-bar1_value]
 +
  -->ApplyHealingTokenmod|@{target|token_id};1;[$NewHealth]
 +
  --+Healing|You healed [*T:character_name] for [$Points] hp.
 +
  -->DeductPoolSlot|
 +
  --<|
 +
 
 +
  --:ApplyHealingTokenmod|Parameters are tokenid;bar#;amount
 +
  --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%]
 +
  --<|
 +
 
 +
  --:GetAndCheckSlotInformation|
 +
  --=PointsTotal|0
 +
  --=PointsExpended|[*S:class_resource]
 +
  --?[$PointsExpended.Raw] -eq [$PointsTotal.Raw]|NoSlotsLeft
 +
  --<|
 +
 
 +
  --:DeductPoolSlot|
 +
  --=PointsExpended|[$PointsExpended] - [$Points]
 +
  --@setattr|_charid [*S:character_id] _class_resource|[$PointsExpended] _silent
 +
  --+|Lay on Hands Points Left: [$PointsExpended]
 +
  --X|Full Stop
 +
 
 +
  --:NoSlotsLeft|
 +
  --+|[*S:character_name] has no healing pool points available.
 +
  --#emoteText|[*S:character_name] tries to to use Lay on Hands, but has no pool points left and needs to take a long rest.
 +
  --X|NoSlotsLeftStop
 +
}}
 +
</pre>
 +
</div>
 +
<br><br>
 +
[[Category:ScriptCards]]

Latest revision as of 06:59, 5 June 2024


Contents

[edit] Working scripts for ScriptCards

This page is intended to be a centralized repository of working scripts, and meaningful variations, that have been tested and are working as expected. Use the following guidance to add your masterpiece to the grand library of scripts.

  • When submitting an original script please edit the Template: Example Script Name section and then copy the entire section (starting with === Template Script Name === all the way down through the </div><br> at the end) and paste this at the end of the Shared Scripts section, after the final script shown.

Please update the info section to provide your name, describe if the script is specific to a particular game/system, the purpose, description of intended results, screenshots, and any caveats or notes a user should be aware of up front.
There is a guide below to help you with filling out the information section in case you get stuck anywhere.

  • When submitting a variation of a shared script please submit by using the following steps:

1. Use the link in the Template: Example Script Name navigation box on the right side of the screen to go to the sample variation Sub-page. Edit the page and copy the entire template from the sub-page.
2. Navigate to the not-yet-created URL of the sub-page you will create: wiki.roll20.net/ScriptCards_Scripts/ (Original Script Name) _Variation_ (Simple Label of Changes)
(e.g. https://wiki.roll20.net/ScriptCards_Scripts/SmartAOE_Variation_Pathfinder2e)
3. You should be brought to a blank Wiki-style page that says: There is currently no text in this page. You can search for this page title in other pages, search the related logs, or edit this page.
Either click the Create button or Edit this Page button as they both do the same thing: Create the page and take you into edit mode
4. Once in edit mode on the new sub-page, paste the template example you copied and then fill out all the juicy details. Be sure to give credit to the amazing work of the original author that inspired your variation!
5. You can preview your work with the Preview button, or Save your work with the Save button and see the finished product!
6. Mention in the official Discord ScriptCards channel that you added a new sub-page and please provide the link so that the navigational links can be manually created for others to view your work!

WikiText markup cheat sheet:

[edit] Guide to completing the Info Section:

1. Author of script: Your Discord or Roll20 Forum name

2. Game/System specific? Which one: If not game/system specific put "System Neutral", otherwise please put the name of the game(s)/system(s) your script works with

3. Does this script require additional mods to function? If yes, please list them here: If no, put "N/A", otherwise please list any mods, besides ScriptCards, that are required for this script to work correctly.

4. Purpose of script: Provide an overall description of the purpose of the script

Example 1: This script attempts to haggle with vendors
Example 2: This script identifies the remaining health of combat targets


5. Description of intended results: Describe how a user should expect to interact with your script and what they should expect to see when it works. Doesn't need to be too detailed; just enough for a user to know if the script is not working as intended.

Example 1: The user will press a macro button to activate, which will generate several options for their attempt to haggle with vendors based on certain skills or attributes.
Example 2: This script will always be on once activated. It will outline combat targets with green/ yellow/ red based on remaining health being above 80%, 50% or below 25% respectively


6. Screenshots: Initial screenshots; more can be added throughout the body of the contents if desired.

7. Caveats/ Notes: N/A if none, otherwise please describe. Please put any important notes about the script's usage or behavior here.

8. Script code: insert the script code between the <pre> ... </pre> tags below this line.



Variations of karma827's Example Script


1. This is the template for submitting variants!
2. Mock-up of Link to a different Variant Script


[edit] Template: Example Script Name

[Expand/Collapse This Script]


Author of script:
Game/System specific? Which one:
Does this script require additional mods to function? If yes, please list them here:
Purpose of script:
Description of intended results:
Screenshots:
Caveats/ Notes:
Script code:

Enter script code here



[edit] Shared Scripts

Below you'll find the good stuff. You can use the table of contents for quick navigation. As long as the Script name is surrounded by "===" on both sides, it'll automatically be added to the table of contents.

[edit] Displaying multiple rollable table image results on a single line - Alien TTRPG Example

[Expand/Collapse This Script]

Author of script: David M.
Game/System specific? Which one: Alien TTRPG
Does this script require additional mods to function? If yes, please list them here: N/A
Purpose of script: This example appends URLs to a string variable in a loop and displays the results to a single output line.
Description of intended results: This example appends URLs to a string variable in a loop and displays the results to a single output line (have to prepend alignment and img size tags, then build URL strings, then append closing tag). Here's what I came up with for the Alien TTRPG. You roll a number of base dice, and a number of "stress" dice. Both count 6's as a success, while the stress dice can also add a failure for each roll of 1. Add successes & failures to determine overall result of the check. Here's a couple of example checks, using rollable table graphics for the cool Alien dice and string building variables to put the dice on a single line.
Screenshots:
Caveats/ Notes: N/A
Script code:

!scriptcard {{
  --#title|AlienTTRPG Rolls
  --#leftsub|Num Dice ?{Num Dice?|1}
  --#rightsub|Num Stress Dice ?{Num Stress Dice?|0}
  
  --:Initialize Roll Vars|
      --=NumDice|?{Num Dice?}
      --=NumStressDice|?{Num Stress Dice?}  
      --=NumSuccess|0
      --=NumFail|0
  --:String Building Vars| Will store table graphics. Pre-pend opening format tag
      --&DieOutput|+[r]
      --&StressOutput|+[r]

  --:Base Dice Block|
      --+[#990000]BASE ROLLS[/#]|
      --=DieCount|0
      --:BaseDiceLoop|
              --=DieCount|[$DieCount] + 1
              -->RollBase|
              --?[$DieCount] -lt [$NumDice]|BaseDiceLoop
  --:Output Main Dice| but first append closing format tag
      --&DieOutput|+[/r]
      --+|[&DieOutput]

  --:Stress Dice Block|
      --+[#990000]STRESS ROLLS[/#]|
      --?[$NumStressDice] -eq 0|>NA
      --?[$NumStressDice] -eq 0|EvaluationBlock
      --=DieCount|0
      --:StressLoop|
              -->RollStress|
              --=DieCount|[$DieCount] + 1
              --?[$DieCount] -lt [$NumStressDice]|StressLoop
  --:Output Stress Dice| but first append closing format tag
      --&StressOutput|+[/r]
      --+|[&StressOutput]

  --:EvaluationBlock|
      --+[#990000]EVALUATION[/#]|
     --:Output Success and Failure counts|
              --+|[r][b]Successes=[$NumSuccess][/b][/r]
              --+|[r][b]Failures=[$NumFail][/b][/r]
      --:Compare rolls|
              --=Diff|[$NumSuccess] - [$NumFail]
              --+|[r][b]Difference[$Diff][/b][/r]
      --+[#990000]RESULT[/#]|
      --:Output Overall Success or Failure|
              --?[$Diff] -gt 0|OverallSuccess
              --?[$Diff] -le 0|OverallFailure  
  --X| End macro
  
--:FUNCTIONS|
 --:NA|
    --+|[b][r]N/A[/r][/b]
    --<|
  --:RollBase|
    --=ThisRoll|[T#AlienD6]
    --?[$ThisRoll.tableEntryValue] -eq 6|>AddSuccess
    --&DieOutput|+[img width=32][$ThisRoll.tableEntryImgURL][/img]
    --<|
  --:RollStress|
    --=ThisRoll|[T#AlienStressD6]
    --?[$ThisRoll.tableEntryValue] -eq 6|>AddSuccess
    --?[$ThisRoll.tableEntryValue] -eq 1|>AddFail
    --&StressOutput|+[img width=32][$ThisRoll.tableEntryImgURL][/img]
    --<|
--:AddSuccess|
    --=NumSuccess|[$NumSuccess] + 1
    --<|
--:AddFail|
    --=NumFail|[$NumFail] + 1
    --<|
--:OverallSuccess|
    --+[c][#009900]~~~SUCCESS~~~[/#][/c]|
    --X|
    --<|
--:OverallFailure|
    --+[c][#ff0000]~~~FAILURE~~~[/#][/c]|
    --X|
}}



[edit] Bubble Sort Algorithm

[Expand/Collapse This Script]

Author of script: David M.
Game/System specific? Which one: System Neutral
Does this script require additional mods to function? If yes, please list them here: N/A
Purpose of script: The following takes a collection of die rolls and sorts them for display purposes.
Description of intended results: Die rolls are sorted in ascending order.
Screenshots:
Caveats/ Notes: Currently hardcoded to 4 rolls, but could be generalized by adding loops, etc. Observation: the HiLow formatting is lost if a particular roll changes position. If you sort rolls, it might be best to remove HiLow formatting in your scriptcard to avoid potential confusion.
Script code:

!scriptcards {{  
  --=NumDice|4

  --=Roll1|1d6
  --=Roll2|1d6
  --=Roll3|1d6
  --=Roll4|1d6

  --+Unsorted Rolls|
  --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4]

  --:PERFORM A BUBBLE SORT|
  --=i|0
  --=max_i|[$NumDice]-1
  --:OuterLoop|
        --=i|[$i]+1
                --=j|[$i]
                --:InnerLoop|
                    --=j|[$j]+1
                    --?[$Roll[$i.Raw]] -gt [$Roll[$j.Raw]] |>BubbleUp;[$i.Raw];[$j.Raw]
                --?[$j.Raw] -lt [$NumDice.Raw]|InnerLoop
        --?[$i.Raw] -lt [$max_i.Raw]|OuterLoop

  --+Rolls sorted ascending|
  --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4]
  --X|

--:FUNCTIONS|  
  --:BubbleUp| accepts i, j as parameters. Swaps Roll[i] & Roll[j]
      --=Temp|[$Roll[%2%]]
      --=Roll[%2%]|[$Roll[%1%]]
      --=Roll[%1%]|[$Temp]
  --<|  
}}



[edit] 5e Turn Undead

[Expand/Collapse This Script]

Author of script: David M.
Game/System specific? Which one: D&D 5e
Does this script require additional mods to function? If yes, please list them here: Scriptcards, Token-mod (with Players can use --ids set to true!), Radar (just for show, doesn't really do anything mechanics-wise), and SelectManager.
Purpose of script: Sharing a scriptcard below for 5e Turn Undead, using Kurt's Fireball card as a starting point.
Description of intended results:

  • Finds all tokens on objects and gmlayer (for invisible undead)
  • Filters for npc_type to affect only those with "undead" keywords
  • Makes saves for affected tokens within range (note: Euclidean distance used - so Pythagorean theorem) and displays in chat with color-coded text for pass/fail
  • Checks the cleric level (note: assumes single class!) to determine if failure will turn or destroy based on CR of the undead
  • [Read this - Important!] Assigns a token condition marker on failure: "dead" marker for destroyed undead, and a custom "fear" marker to indicate turned. These will need to be changed based on the markers you have available (look for the conditional call to the AddConditionMarker procedure found within the FailedSave procedure)
  • Creates a 30ft animated wavefront representing the burst of divine energy, using the Radar script (via SelectManager). Silent option to prevent radar chat results, and pingLife|0 to not produce visible "pings". This is optional and requires the Radar script and SelectManager to be installed.

Screenshots: https://s3.amazonaws.com/files.d20.io/images/213039221/RiUBu8g-01ECiNR5OzazFg/original.gif?1617464582
Example gif with a 5th level cleric (destroys CR 1/2 or lower) surrounded by skeletons (CR 1/4), Specters (CR 1), and an Ogre Zombie (CR 2).
Caveats/ Notes: EDIT- updated to take the greater of the attributes "wisdom_save_bonus" and "npc_wis_save_base". If the latter is blank we do some substitution to ensure the former is used).
EDIT 2 - Here is a link to a one-off of this scriptcard that adds "Destroy" or "Turn" next to the creature save in the chat output.
Script code:

 
!script {{
  --#title|@{selected|character_name} Turns Undead!
  --#leftsub|Save DC @{selected|spell_save_dc}

  --:(0) CREATE AN ANIMATED WAVEFRONT WITH RADAR SCRIPT| uses SelectManager to retain selected token
  --@forselected|radar_range|30ft _pinglife|0 _wavedelay|20 _wavespacing|10 _silent|true

  --:(1) DETERMINE CR OF UNDEAD THAT CAN BE DESTROYED|
  --=charLevel|@{selected|level}
  --?[$charLevel] -lt 5|>SetCRdestroy;0
  --?[$charLevel] -ge 5 -and [$charLevel] -lt 8|>SetCRdestroy;0.5
  --?[$charLevel] -ge 8 -and [$charLevel] -lt 11|>SetCRdestroy;1
  --?[$charLevel] -ge 11 -and [$charLevel] -lt 14|>SetCRdestroy;2
  --?[$charLevel] -ge 14 -and [$charLevel] -lt 17|>SetCRdestroy;3
  --?[$charLevel] -ge 17|>SetCRdestroy;4

  --:(2) GET ALL TOKENS INTO THE "allTokens" ARRAY| will have blank 1st element to be removed later
  --~|array;pagetokens;allTokens;@{selected|token_id}

  --:(3) CREATE THE "inRange" ARRAY TO HOLD TOKENS IN RANGE|
  --~|array;define;inRange;

  --:(4) PREP ARRAY FOR LOOP| if no array elements then end macro
  --~tokenid|array;getfirst;allTokens
  --?[&tokenid] -eq ArrayError|endOutput

  --:(5) FIND ALL TOKENS IN RANGE|
  --:RangeLoop|
          --:TOKEN MUST BE ON OBJECTS OR GMLAYER AND TYPE MUST INCLUDE UNDEAD|
          --?[*[&tokenid]:t-layer] -ne objects -and [*[&tokenid]:t-layer] -ne gmlayer|NextToken
          --?"[*[&tokenid]:npc_type]" -ninc "undead"|NextToken
          
          --:CHECK DISTANCE IN UNITS. 30ft is 6UNITS|
          --~dist|euclideandistance;@{selected|token_id};[&tokenid]
          --?[$dist] -gt 6|NextToken
          
          --:ADD TO THE "inRange" ARRAY|
          --~|array;add;inRange;[&tokenid]

          --:NextToken|
          --~tokenid|array;getnext;allTokens
          --?[&tokenid] -ne ArrayError|RangeLoop

  --:(6) REMOVE DUMMY FIRST ITEM IN inRange ARRAY|
  --~|array;removeat;inRange;0

  --:(7) ROLL SAVES FOR EACH TOKEN IN RANGE| if fail, set a token condition marker to denote turned
  --~tokenid|array;getfirst;inRange
  --?[&tokenid] -eq ArrayError|End
  --:SaveLoop|
          -->GetSaveBonus|[&tokenid];wisdom;wis
          --=SaveRoll|1d20 + [$saveBonus] [BONUS]        
          --?[$SaveRoll.Total] -ge @{selected|spell_save_dc}|>MadeSave|>FailedSave
          --~tokenid|array;getnext;inRange
          --?[&tokenid] -ne ArrayError|SaveLoop

  --:End|
  --X|

--:PROCEDURES|
  --:SetCRdestroy| accepts CR as parameter
      --=CRdestroy|[%1%]
  --<|

  --:GetSaveBonus| accepts tokenid, full attribute name, short attribute name as parameters
      --:TAKE THE GREATER OF "attribute_save_bonus" OR "npc_attr_save"|
      --=bonus1|[*[%1%]:[%2%]_save_bonus]
      --&bonus2|[*[%1%]:npc_[%3%]_save_base]
      --:SOMETIMES "npc_attr_save_base" IS BLANK, SO SET TO -99. OTHERWISE USE ATTR VALUE|
          --?X[&bonus2] -eq "X"|>Set_npc_attr_save_bonus;-99|>Set_npc_attr_save_bonus;[&bonus2]
      --:FINALLY SET THE SAVE BONUS|
      --?[$bonus2] -gt [$bonus1]|>SetSaveBonus;[$bonus2]|>SetSaveBonus;[$bonus1]
  --<|

  --:Set_npc_attr_save_bonus| blank value is set to -99, otherwise use value stored in attribute
      --=bonus2|[%1%]
  --<|

  --:SetSaveBonus|
      --=saveBonus|[%1%]
  --<|

  --:MadeSave| 
        --+[*[&tokenid]:character_name]:|[#009900][b]Made Save[/b][/#] [$SaveRoll]
  --<|

  --:FailedSave| add either a dead or fear condition marker to the token, depending on CR
       --+[*[&tokenid]:character_name]:|[#990000][b]Failed Save[/b][/#] [$SaveRoll]
      --=CR|[*[&tokenid]:npc_challenge]
      --?[$CR] -le [$CRdestroy]|>AddConditionMarker;[&tokenid];dead|>AddConditionMarker;[&tokenid];Fear::1510130
  --<|

  --:AddConditionMarker| accepts tokenID and condition marker as parameter
      --@token-mod|_ignore-selected _ids [%1%] _set statusmarkers|[%2%]
  --<|
}}



[edit] 5e Mob Attacks

[Expand/Collapse This Script]

Author of script: David M.
Game/System specific? Which one: D&D 5e
Does this script require additional mods to function? If yes, please list them here: N/A
Purpose of script:
Description of intended results:
Screenshots: https://s3.amazonaws.com/files.d20.io/images/221609567/ZPlgYBvtEFXj22odj5NGSQ/original.png?1620743237; https://s3.amazonaws.com/files.d20.io/images/221609645/qdnShEx0gl9BVogWBbuwHQ/original.png?1620743274
Caveats/ Notes: Queries for number of attackers, att/dam modifiers, Norm/Adv/DisAdv, and target AC.
Script code:

 
!scriptcard  {{ 
--:USER INPUT|
  --=NumAttacks|?{Number Attackers?|2}
  --&RollString|?{Attack Type?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1}+?{Attack Modifier?|0}
  --&DamDice|?{Damage Dice?|1d8}
  --&DamMod|?{Damage Modifier?|0}
  --=TargetAC|?{Target AC?|10}

--:TITLE CARD DISPLAY|
  --#whisper|gm
  --#title|Mob Attack
  --#leftsub|[&RollString] vs AC [$TargetAC]
  --#rightsub|Dam:[&DamDice]+[&DamMod]

--:LOOP THROUGH ATTACKS
  --=DisplayCount|1
  --=DamageTotal|0
  --:AttackLoop|
      -->MakeAttack| call function
      --=DisplayCount|[$DisplayCount] + 1
      --?[$DisplayCount] -le [$NumAttacks]|AttackLoop

--:DISPLAY TOTAL DAMAGE|
  --+Total|Total damage is [$DamageTotal]
   --X|Exit macro

--:PROCEDURES|
  --:MakeAttack|
      --=ThisAttack|[&RollString]
      --?[$ThisAttack.Base] -eq 20|Crit
      --?[$ThisAttack] -ge [$TargetAC]|Hit
      --?[$ThisAttack] -lt [$TargetAC]|Miss
     --:AttackDone|
  --<|
  
  --:Hit|
      --=ThisDamage|[&DamDice][BASE]+[&DamMod][MOD]
      --=DamageTotal|[$DamageTotal] + [$ThisDamage.Total]
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b]Hits[/b] for [$ThisDamage] dam
      --^AttackDone|
  --<|

  --:Crit|
      --=ThisDamage|[&DamDice][BASE]+[&DamMod][MOD] + [&DamDice][CRIT]
      --=DamageTotal|[$DamageTotal] + [$ThisDamage.Total]
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b][#009900]Crits[/#][/b] for [$ThisDamage] dam
      --^AttackDone|     
  --<|

  --:Miss|
      --+Attack[$DisplayCount.Total]|[$ThisAttack] [b][#990000]Misses[/#][/b]
      --^AttackDone|
  --<|
}}



[edit] 5e Conjure Animals

[Expand/Collapse This Script]

Author of script: David M.
Game/System specific? Which one: D&D 5e
Does this script require additional mods to function? If yes, please list them here: Scriptcards, SelectManager, SpawnDefaultToken, Table-Export.
Purpose of script: The caster picks a Challenger Rating of creatures to summon (which also determines a scaled qty of creatures), and some number of random creature types of the appropriate CR are summoned within range.
Description of intended results: To handle all of the randomness and to have the whole spell in one macro, I ended up using a combination of the Spawn, Scriptcards, and SelectManager api scripts, along with a rollable table that I populated with the Scriptcards version of the Spawn commands (built in excel and imported with Aaron's table-export script). Description below, but fair warning: it's a lot! Here's what it looks like in action (click to play gif). First, I Spawn a "target" token from a token action ability on the character. This will determine the location where the creatures will spawn. This target token has it's own character sheet and default token (required by Spawn), and I put the scriptcards macro into a token action ability on the target token's sheet. In the example, I selected CR 1/4 creatures. The scriptcards ability rolls on the appropriate rollable table using conditional logic, and you can see 8 CR 1/4 wolves were randomly selected and then spawned at the target location. Note: the grid placement is not ideal for creatures larger than 1x1 (there will be some overlap), as I haven't handled large tokens with grid placement that in the script yet. But, it's easy enough to move them slightly after spawning for now.
Screenshots:
Caveats/ Notes:
Script code:
Here's the Spawn ability that generated the target token. Note that my characters have access to the spell via a magic item (that I called "Bag of Nature's Allies"). You could call this "Conjure Animals Target" or whatever you want. Just make it match the name of the target "character" sheet.

!Spawn {{
  --name| Bag of Nature's Allies
  --offset| 1,0
}}

Here's the scriptcard macro. The Rollable table items contain Spawn syntax using the scriptcards format). Also note that the SelectManager script is required to use the "forselected" property to retain the selected token between the two other scripts (Spawn and Scriptcards). The scriptcard populates a "CR" variable, then performs the equivalent of a "Select...Case" (or Switch) statement to call the "RollTable" procedure with the appropriate parameter (the name of the rollable table to use). Finally, it calls the Spawn script (via SelectManager) with the --@forselected line. See the Scriptcard documentation for more info on all of this.

!scriptcards {{
--:SETTINGS|
  --#hideCard|1
  --#title|Nature's Allies

  --=CR|?{How many creatures?|1x CR 2,2|2x CR 1,1|4x CR 1/2,0.5|8x CR 1/4,0.25}
  --C[$CR.Total]|2:>RollTable;SpawnBeastsCR2|1:>RollTable;SpawnBeastsCR1|0.5:>RollTable;SpawnBeastsCR0.5|0.25:>RollTable;SpawnBeastsCR0.25

  --@forselected|[$SpawnSyntax.tableEntryText]

  --X| End macro

--:PROCEDURES|
  --:RollTable|
        --=SpawnSyntax|[T#[%1%]]
  --<|
}}

These are the rollable tables I created:
https://s3.amazonaws.com/files.d20.io/images/221421534/UT5aKZTCJGFhb-DyQSzGgQ/original.png?1620649730

Here are the table-export macros I used to generate the rollable tables. Note the "_p's" referring to the player-controlled copies I made.

!import-table --SpawnBeastsCR2 --show
!import-table-item --SpawnBeastsCR2 --Spawn _name|Saber-Toothed Tiger_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Rhinoceros_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Elk_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Constrictor Snake_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Giant Boar_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Cave Bear_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Allosaurus_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Quetzalcoatlus_p _qty|1 _size|3,3 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR2 --Spawn _name|Aurochs_p _qty|1 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table --SpawnBeastsCR1 --show
!import-table-item --SpawnBeastsCR1 --Spawn _name|Tiger_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Lion_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Vulture_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Toad_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Spider_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Hyena_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Giant Eagle_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Dire Wolf_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Brown Bear_p _qty|2 _size|2,2 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR1 --Spawn _name|Deinonychus_p _qty|2 _size|1,1 _placement|grid 1 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table --SpawnBeastsCR0.5 --show
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Warhorse_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Giant Wasp_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Giant Goat_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Crocodile_p _qty|4 _size|2,2 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Black Bear_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.5 --Spawn _name|Ape_p _qty|4 _size|1,1 _placement|grid 2 _offset|0,0 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table --SpawnBeastsCR0.25 --show
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Wolf_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Pteranodon_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Panther_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Wolf Spider_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Poisonous Snake_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Owl_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Lizard_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Frog_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Centipede_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Bat_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Giant Badger_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Elk_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Draft Horse_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Constrictor Snake_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Boar_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Axe Beak_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Velociraptor_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Ox_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Hadrosaurus_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Dimetrodon_p _qty|8 _size|1,1 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --
!import-table-item --SpawnBeastsCR0.25 --Spawn _name|Cow_p _qty|8 _size|2,2 _placement|grid 3 _offset|-1,-1 _resizeSource|0,0,20,50 _expand|20,50 --1 --

Whew! This is obviously a lot of work for one spell (albeit a complicated spell), but I am pretty happy with the result.



[edit] 5e Lay on hands

[Expand/Collapse This Script]

Author of script: FarsideGallery
Game/System specific? Which one: D&D 5e
Does this script require additional mods to function? If yes, please list them here: Scriptcards, Token-mod (with Players can use --ids set to true!)
Purpose of script: Sharing a scriptcard for 5e Paladin Lay on Hands.
Description of intended results: Queries player for number of conditions to remove or number of HP to restore to target. Verifies class resource (Lay On Hands) has required pool available. Reduces appropriate number of points from the pool and, if heal is chosen, adds the specified number of hit points to the target.
Screenshots:
Caveats/ Notes: N/A
Script code:

!scriptcard {{ 
  --#title|Lay on Hands
  --#sourceToken|@{selected|token_id}
  --#targetToken|@{target|token_id}
  --#leftsub|Healing
  --#rightsub|Resource Pool
  
  --#emoteText|[*S:character_name] uses Lay on Hands on [*T:character_name].

  -->GetAndCheckSlotInformation|
  --=Points|0
  --c?{What function do you want to use?|Healing|Remove Condition}|Healing:>Heal|Remove Condition:>Remove| 
  -->DeductPoolSlot|
  --x| 
 
  --:Remove|
   --iClick to continue.;Continue|q;input2;How many conditions do you wish to remove?
   --=Conditions|[&input2]
   --=Points|5 * [$Conditions]
   --?[$Points] -gt [*S:class_resource]|[
     --=Conditions|[*S:class_resource] \ 5
	 --=Points|5 * [$Conditions] 
   --+Conditions|You remove [$Conditions] conditions from [*T:character_name].
   -->DeductPoolSlot|

  --:Heal|
   --=Missing|[*T:t-bar1_max] - [*T:t-bar1_value]
   --iClick to continue.;Continue|q;input;How many of the [*S:class_resource] points of your healing pool do you want to use?
   --=Points|[&input]
   --?[$Points] -gt [*S:class_resource]|TooManyPoints
   --?[$Points] -le [$Missing]|GoodtoGo
   --<|
	
  --:TooManyPoints|
   --=Healed|[*S:class_resource] 
   --=Points|[*S:class_resource]
   --=NewHealth|[$Healed] + [*T:t-bar1_value]
   -->ApplyHealingTokenmod|@{target|token_id};1;[$NewHealth]
   --+Healing|You healed [*T:character_name] for [$Points] hp.
   -->DeductPoolSlot|
   --<|
   
  --:GoodtoGo|
   --=Healed|[$Missing] 
   --=Points|[$Missing]
   --=NewHealth|[$Healed] + [*T:t-bar1_value]
   -->ApplyHealingTokenmod|@{target|token_id};1;[$NewHealth]
   --+Healing|You healed [*T:character_name] for [$Points] hp.
   -->DeductPoolSlot|
   --<|

  --:ApplyHealingTokenmod|Parameters are tokenid;bar#;amount
   --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%]
   --<|

  --:GetAndCheckSlotInformation|
   --=PointsTotal|0
   --=PointsExpended|[*S:class_resource]
   --?[$PointsExpended.Raw] -eq [$PointsTotal.Raw]|NoSlotsLeft
   --<|

  --:DeductPoolSlot|
   --=PointsExpended|[$PointsExpended] - [$Points]
   --@setattr|_charid [*S:character_id] _class_resource|[$PointsExpended] _silent
   --+|Lay on Hands Points Left: [$PointsExpended] 
   --X|Full Stop

  --:NoSlotsLeft|
   --+|[*S:character_name] has no healing pool points available.
   --#emoteText|[*S:character_name] tries to to use Lay on Hands, but has no pool points left and needs to take a long rest.
   --X|NoSlotsLeftStop 
}}