Difference between revisions of "ScriptCards Scripts"
From Roll20 Wiki
(→Template: Example Script Name) |
(→Shared Scripts) |
||
Line 110: | Line 110: | ||
== Shared Scripts == | == 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/> | 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 SCRIPT NAME]</span> | ||
+ | <div class="mw-collapsible" id="mw-customcollapsible-multiple_rollable_table_images" style="width: 100%;"> | ||
+ | '''Author of script:''' 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:''' <!--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.--> | ||
+ | |||
+ | <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> |
Revision as of 15:37, 22 June 2023
Related Links
Roll20 Forum Links:
ScriptCards Thread on the Roll20 Mod Forums
ScriptCards Mod Working and Sharing thread in the Roll20 Forums
GitHub Links:
ScriptCards Changelog on GitHub
ScriptCards API
ScriptCards Samples on the Official GitHub
Roll20 Wiki Links:
Main ScriptCards Wiki Page
ScriptCards User-submitted scripts
ScriptCards User-submitted Library Handouts
ScriptCards User-submitted Triggers
Official Discord:
ScriptCards Official Discord Channel
YouTube Tutorials:
ScriptCards Intro
ScriptCards Magic Missile Deep Dive
Working scripts for ScriptCards
Contents |
This page is intended to be a centralized repository of working scripts, and meaningful variations, that have been tested and are working as expected.
- 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.
- 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.
- When submitting a variation of a shared script please submit by using the following steps:
- 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.
- 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)
- 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
- 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!
- You can preview your work with the Preview button, or Save your work with the Save button and see the finished product!
- 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!
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
- Example 1: This script attempts to haggle with vendors
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
- 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.
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
Template: Example Script Name
[Expand/Collapse SCRIPT NAME]
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
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.
Displaying multiple rollable table image results on a single line - Alien TTRPG Example
[Expand/Collapse SCRIPT NAME]
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| }}