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

Thank you again for the help David, that change worked perfectly.
1616397471
Senjak
Pro
Sheet Author
Kurt J. said: ScriptCards v 0.0.11 There is a new version of ScriptCards up on the GIST. Here are the changes/updates: Button Customization and New Defaults - Buttons added through the [button]Text::Action[/button] sequence now have the blue background of the title card by default (instead of Roll20's dreaded bright pink buttons). New settings for buttonbackgroundcolor , buttontextcolor , and buttonbordercolor allow you to customize the appearance of your buttons.              Plain Text in Roll Equations - You could previously include "flavor text" in rolls by enclosing it in square brackets like [Strength]. If you set the allowplaintextinrolls setting to a non-zero value, you can now exclude the square brackets if desired. New Round Up Setting - By default, integer division rounds down. If roundup is set to a non-default (the default is 0) integer division will round up instead. Dice Font Support - Roll20 includes fonts for each type of standard dice, and there are now inline formatting options to allow you display them in your output. These format markup sequences are [d4]..[/d4], [d6]..[/d6], [d8]..[d8], [d10]..[/d10], [d12]..[/d12] and [d20]..[/d20], so for example to display an 8-sided die on the 4 face: [d8]4[/d8]. Of course variables can be used to specify the face. There are new settings to allow for customization of how the dice are displayed: dicefontcolor , dicefontsize , and usehollowdice .               How do I set the size of the buttons in the first example? Thanks! Senjak
1616410996

Edited 1616521520
Hi, I continue to work on my scripts and have a formatting question again! I plan to do a script that offers a list of actions to players in whisper. He can consult his choices and then validate one which will be displayed in public in the chat. This is quite cumbersome to do as I have to navigate the player from script to script using buttons. I noticed that the - + | accepted html code like : - - + | &lt;img src = "my url" width = 30&gt; In your opinion, would it be possible to do a tooltip on the button ? (as&nbsp; <a href="https://www.w3schools.com/css/css_tooltip.asp" rel="nofollow">https://www.w3schools.com/css/css_tooltip.asp</a> ) Do you think this is possible? and how ? Thank you. Edit 1 : I tried to use the html mouseover attribute with the image tag, but without success.
I'm learning a lot about how to use Scriptcards by looking at other's examples.&nbsp; Keep posting - Love it.&nbsp; Great work Gabryel.&nbsp; Love to see the creative way people have implemented buttons.&nbsp; Both the design and the functionality.&nbsp;&nbsp;
1616417545

Edited 1616519281
Here is a set of Scriptcard-based macros I built for my OOTA D&amp;D 5e campaign to select a type of Madness for a character.&nbsp; &nbsp;It's been updated from my previous version as I finally figured out how to use [button] logic.&nbsp; As you will see by looking at the code, I had to create like 13 different macros to support the branching logic of buttons.&nbsp; I wish buttons could be used to branch to labels within the same macro, as it would be much easier to support.&nbsp;&nbsp; Also, I discovered a number of bugs in my previous version (Label names are case-sensitive) that I've corrected in the logic below.&nbsp;&nbsp; #Madness (Macro) !scriptcard {{ --#title|Madness --#titleCardBackground|#932729 --#whisper|self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --+[c][#C43112]~~~~Madness Type?~~~~[/#][/c]| --+|[c][button]Short Term::!&amp;#13;#MadST[/button][button]Long Term::!&amp;#13;#MadLT[/button][button]Indefinite::!&amp;#13;#MadInd[/button][button]Demon Lord::!&amp;#13;#MadDL[/button][/c] }} #MadST (Macro) !scriptcard {{ --#title|Short Term Madness --#titleCardBackground|#932729 --=MadTime|1d10 --#leftsub|Lasts [$MadTime] minutes --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 30|Mad2 --?[$MadRoll.Total] -le 40|Mad3 --?[$MadRoll.Total] -le 50|Mad4 --?[$MadRoll.Total] -le 60|Mad5 --?[$MadRoll.Total] -le 70|Mad6 --?[$MadRoll.Total] -le 75|Mad7 --?[$MadRoll.Total] -le 80|Mad8 --?[$MadRoll.Total] -le 90|Mad9|Mad10 --:Mad1| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] retreats into his or her mind and becomes [b][#C43112]paralyzed[/#][/b]. The effect ends if [b][#1212C4]@{selected|token_name}[/#][/b] takes any damage. --^ShowMadness| --:Mad2| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] becomes incapacitated and spends the duration screaming, laughing, or weeping. --^ShowMadness| --:Mad3| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] becomes [b][#C43112]frightened[/#][/b] and must use his or her action and movement each round to flee from the source of the fear. --^ShowMadness| --:Mad4| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] begins babbling and is incapable of normal speech or spellcasting. --^ShowMadness| --:Mad5| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] must use his or her action each round to attack the nearest creature. --^ShowMadness| --:Mad6| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] experiences vivid hallucinations and has [b][#C43112]disadvantage[/#][/b] on ability checks. --^ShowMadness| --:Mad7| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] does whatever anyone tells him or her to do that isn’t obviously self-destructive. --^ShowMadness| --:Mad8| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] experiences an overpowering urge to eat something strange such as dirt, slime, or offal. --^ShowMadness| --:Mad9| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] is [b][#C43112]stunned[/#][/b]. --^ShowMadness| --:Mad10| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] falls [b][#C43112]unconscious[/#][/b]. --^ShowMadness| --:ShowMadness| --+|[&amp;Madness] --@forselected+|add-cgmnote Short Term Madness([$MadTime] minutes): [&amp;Madness] }} #MadLT (Macro) !scriptcard {{ --#title|Long Term Madness --#titleCardBackground|#932729 --=MadTime|1d10 * 10 --#leftsub|Duration: [$MadTime] hours --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 10|Mad1 --?[$MadRoll.Total] -le 20|Mad2 --?[$MadRoll.Total] -le 30|Mad3 --?[$MadRoll.Total] -le 40|Mad4 --?[$MadRoll.Total] -le 45|Mad5 --?[$MadRoll.Total] -le 55|Mad6 --?[$MadRoll.Total] -le 65|Mad7 --?[$MadRoll.Total] -le 75|Mad8 --?[$MadRoll.Total] -le 85|Mad9 --?[$MadRoll.Total] -le 90|Mad10 --?[$MadRoll.Total] -le 95|Mad11|Mad12 --:Mad1| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] feels compelled to repeat a specific activity over and over, such as washing hands, touching things, praying, or counting coins. --^ShowMadness| --:Mad2| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] experiences vivid hallucinations and has disadvantage on ability checks. --^ShowMadness| --:Mad3| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] suffers extreme paranoia. [b][#1212C4]@{selected|token_name}[/#][/b] has disadvantage on Wisdom and Charisma checks. --^ShowMadness| --:Mad4| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] regards something (usually the source of madness) with intense revulsion, as if affected by the antipathy effect of the antipathy/sympathy spell. --^ShowMadness| --:Mad5| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] experiences a powerful delusion. Choose a potion. [b][#1212C4]@{selected|token_name}[/#][/b] imagines that he or she is under its effects. --^ShowMadness| --:Mad6| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] becomes attached to a “lucky charm,” such as a person or an object, and has disadvantage on attack rolls, ability checks, and saving throws while more than 30 feet from it. --^ShowMadness| --:Mad7| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] is blinded (25%) or deafened (75%). --^ShowMadness| --:Mad8| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] experiences uncontrollable tremors or tics, which impose disadvantage on attack rolls, ability checks, and saving throws that involve Strength or Dexterity. --^ShowMadness| --:Mad9| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] suffers from partial amnesia. [b][#1212C4]@{selected|token_name}[/#][/b] knows who he or she is and retains racial traits and class features, but doesn’t recognize other people or remember anything that happened before the madness took effect. --^ShowMadness| --:Mad10| --&amp;Madness|Whenever [b][#1212C4]@{selected|token_name}[/#][/b] takes damage, he or she must succeed on a DC 15 Wisdom saving throw or be affected as though he or she failed a saving throw against the confusion spell. The confusion effect lasts for 1 minute.. --^ShowMadness| --:Mad11| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] loses the ability to speak. --^ShowMadness| --:Mad12| --&amp;Madness|[b][#1212C4]@{selected|token_name}[/#][/b] falls [b]unconscious[/b]. No amount of jostling or damage can wake [b][#1212C4]@{selected|token_name}[/#][/b]. --^ShowMadness| --:ShowMadness| --+|[&amp;Madness] --@forselected+|add-cgmnote Long Term Madness([$MadTime] hours): [&amp;Madness] }} #MadInd (Macro) !scriptcard {{ --#title|Indefinite Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 15|Mad1 --?[$MadRoll.Total] -le 25|Mad2 --?[$MadRoll.Total] -le 30|Mad3 --?[$MadRoll.Total] -le 35|Mad4 --?[$MadRoll.Total] -le 45|Mad5 --?[$MadRoll.Total] -le 50|Mad6 --?[$MadRoll.Total] -le 55|Mad7 --?[$MadRoll.Total] -le 70|Mad8 --?[$MadRoll.Total] -le 80|Mad9 --?[$MadRoll.Total] -le 85|Mad10 --?[$MadRoll.Total] -le 95|Mad11|Mad12 --:Mad1| --&amp;Madness|“Being drunk keeps me sane.” --^ShowMadness| --:Mad2| --&amp;Madness|“I keep whatever I find.” --^ShowMadness| --:Mad3| --&amp;Madness|“I try to become more like someone else I know — adopting his or her style of dress, mannerisms, and name.” --^ShowMadness| --:Mad4| --&amp;Madness|“I must bend the truth, exaggerate, or outright lie to be interesting to other people.” --^ShowMadness| --:Mad5| --&amp;Madness|“Achieving my goal is the only thing of interest to me, and I’ll ignore everything else to pursue it.” --^ShowMadness| --:Mad6| --&amp;Madness|“I find it hard to care about anything that goes on around me.” --^ShowMadness| --:Mad7| --&amp;Madness|“I don’t like the way people judge me all the time.” --^ShowMadness| --:Mad8| --&amp;Madness|“I am the smartest, wisest, strongest, fastest, and most beautiful person I know.” --^ShowMadness| --:Mad9| --&amp;Madness|“I am convinced that powerful enemies are hunting me, and their agents are everywhere I go. I am sure they’re watching me all the time.” --^ShowMadness| --:Mad10| --&amp;Madness|“There’s only one person I can trust. And only I can see this special friend.” --^ShowMadness| --:Mad11| --&amp;Madness|“I can’t take anything seriously. The more serious the situation, the funnier I find it.” --^ShowMadness| --:Mad12| --&amp;Madness|“I’ve discovered that I really like killing people.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote Indefinite Madness: [&amp;Madness] }} #MadDL (Macro) !scriptcard {{ --#title|Demon Lord Madness --#titleCardBackground|#932729 --#whisper|self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --+[c][#C43112]~~~~Demon Lord?~~~~[/#][/c]| --+|[c][button]Baphomet::!&amp;#13;#MadDL_Bap[/button] [button]Demogorgon::!&amp;#13;#MadDL_Dem[/button][/c] --+|[c][button]Fraz-Urbluu::!&amp;#13;#MadDL_Fra[/button] [button]Grazzt::!&amp;#13;#MadDL_Gra[/button][/c] --+|[c][button]Juiblex::!&amp;#13;#MadDL_Jui[/button] [button]Orcas::!&amp;#13;#MadDL_Orc[/button][/c] --+|[c][button]Yeenoghu::!&amp;#13;#MadDL_Yee[/button] [button]Zuggtmoy::!&amp;#13;#MadDL_Zug[/button][/c] }} #MadDL_Bap (Macro) !scriptcard {{ --&amp;DL|Baphomet --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|1 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad5 --+[c][#C43112]Something went wrong!!![/#][/c]| --X| --:Mad1| --&amp;Madness|“My anger consumes me. I can’t be reasoned with when my rage has been stoked.” --^ShowMadness| --:Mad2| --&amp;Madness|“I degenerate into beastly behavior, seeming more like a wild animal than a thinking being.” --^ShowMadness| --:Mad3| --&amp;Madness|“The world is my hunting ground. Others are my prey.” --^ShowMadness| --:Mad4| --&amp;Madness|“Hate comes easily to me and explodes into rage.” --^ShowMadness| --:Mad5| --&amp;Madness|“I see those who oppose me not as people, but as beasts meant to be preyed upon.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Dem (Macro) !scriptcard {{ --&amp;DL|Demogorgon --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|1 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad5 --+[c][#C43112]Something went wrong!!![/#][/c]| --X| --:Mad1| --&amp;Madness|“Someone is plotting to kill me. I need to strike first to stop them!” --^ShowMadness| --:Mad2| --&amp;Madness|“There is only one solution to my problems: kill them all!” --^ShowMadness| --:Mad3| --&amp;Madness|“There is more than one mind inside my head.” --^ShowMadness| --:Mad4| --&amp;Madness|“If you don’t agree with me, I’ll beat you into submission to get my way.” --^ShowMadness| --:Mad5| --&amp;Madness|“I can’t allow anyone to touch anything that belongs to me. They might try to take it away from me!” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Fra (Macro) !scriptcard {{ --&amp;DL|Fraz-Urbluu --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --#title|Fraz-Urbluu Madness --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad5 --:Mad1| --&amp;Madness|“I never let anyone know the truth about my actions or intentions, even if doing so would be beneficial to me.” --^ShowMadness| --:Mad2| --&amp;Madness|“I have intermittent hallucinations and fits of catatonia.” --^ShowMadness| --:Mad3| --&amp;Madness|“My mind wanders as I have elaborate fantasies that have no bearing on reality. When I return my focus to the world, I have a hard time remembering that it was just a daydream.” --^ShowMadness| --:Mad4| --&amp;Madness|“I convince myself that things are true, even in the face of overwhelming evidence to the contrary.” --^ShowMadness| --:Mad5| --&amp;Madness|“My perception of reality doesn’t match anyone else’s. It makes me prone to violent delusions that make no sense to anyone else.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Gra (Macro) !scriptcard {{ --&amp;DL|Grazzt --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4 --?[$MadRoll.Total] -le 90|Mad5|Mad6 --:Mad1| --&amp;Madness|“There is nothing in the world more important than me and my desires.” --^ShowMadness| --:Mad2| --&amp;Madness|“Anyone who doesn’t do exactly what I say doesn’t deserve to live.” --^ShowMadness| --:Mad3| --&amp;Madness|“Mine is the path of redemption. Anyone who says otherwise is intentionally misleading you.” --^ShowMadness| --:Mad4| --&amp;Madness|“I will not rest until I have made someone else mine, and doing so is more important to me than my own life—or the lives of others.” --^ShowMadness| --:Mad5| --&amp;Madness|“My own pleasure is of paramount importance. Everything else, including social graces, is a triviality.” --^ShowMadness| --:Mad6| --&amp;Madness|“Anything that can bring me happiness should be enjoyed immediately. There is no point to saving anything pleasurable for later.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Jui (Macro) !scriptcard {{ --&amp;DL|Juiblex --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad5 --:Mad1| --&amp;Madness|“I must consume everything I can!” --^ShowMadness| --:Mad2| --&amp;Madness|“I refuse to part with any of my possessions.” --^ShowMadness| --:Mad3| --&amp;Madness|“I’ll do everything I can to get others to eat and drink beyond their normal limits.” --^ShowMadness| --:Mad4| --&amp;Madness|“I must possess as many material goods as I can.” --^ShowMadness| --:Mad5| --&amp;Madness|“My personality is irrelevant. I am defined by what I consume.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Orc (Macro) !scriptcard {{ --&amp;DL|Orcas --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad5 --:Mad1| --&amp;Madness|“I often become withdrawn and moody, dwelling on the insufferable state of life.” --^ShowMadness| --:Mad2| --&amp;Madness|“I am compelled to make the weak suffer.” --^ShowMadness| --:Mad3| --&amp;Madness|“I have no compunction against tampering with the dead in my search to better understand death.” --^ShowMadness| --:Mad4| --&amp;Madness|“I want to achieve the everlasting existence of undeath.” --^ShowMadness| --:Mad5| --&amp;Madness|“I am awash in the awareness of life’s futility.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Yee (Macro) !scriptcard {{ --&amp;DL|Yeenoghu --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|DLBYMad5 --:Mad1| --&amp;Madness|“I get caught up in the flow of anger, and try to stoke others around me into forming an angry mob.” --^ShowMadness| --:Mad2| --&amp;Madness|“The flesh of other intelligent creatures is delicious!” --^ShowMadness| --:Mad3| --&amp;Madness|“I rail against the laws and customs of civilization, attempting to return to a more primitive time.” --^ShowMadness| --:Mad4| --&amp;Madness|“I hunger for the deaths of others, and am constantly starting fights in the hope of seeing bloodshed.” --^ShowMadness| --:Mad5| --&amp;Madness|“I keep trophies from the bodies I have slain, turning them into adornments.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }} #MadDL_Zug (Macro) !scriptcard {{ --&amp;DL|Zuggtmoy --#title|[&amp;DL] Induced Madness --#titleCardBackground|#932729 --#leftsub|Duration: Until cured --#whisper|gm, self --#emoteState|1 --#oddRowBackground|#CEC7B6 --#evenRowBackground|#B6AB91 --#debug|0 --=MadRoll|1d100 --?[$MadRoll.Total] -le 20|Mad1 --?[$MadRoll.Total] -le 40|Mad2 --?[$MadRoll.Total] -le 60|Mad3 --?[$MadRoll.Total] -le 80|Mad4|Mad1 --:Mad1| --&amp;Madness|“I see visions in the world around me that others do not.” --^ShowMadness| --:Mad2|| --&amp;Madness|“I periodically slip into a catatonic state, staring off into the distance for long stretches at a time.” --^ShowMadness| --:Mad3|| --&amp;Madness|“I see an altered version of reality, with my mind convincing itself that things are true even in the face of overwhelming evidence to the contrary.” --^ShowMadness| --:Mad4| --&amp;Madness|“My mind is slipping away, and my intelligence seems to wax and wane.” --^ShowMadness| --:Mad5| --&amp;Madness|“I am constantly scratching at unseen fungal infections.” --^ShowMadness| --:ShowMadness| --+|[b][#1212C4]@{selected|token_name}[/#][/b] - [&amp;Madness] --@forselected+|add-cgmnote [&amp;DL] the Demon Lord Madness(Indefinite): [&amp;Madness] }}
I second Gabryel's query about tooltips (and I also want to register the awesomeness of Gabryel's design -- that black "torn" background with the violet is pretty sweet).&nbsp;&nbsp;
Jay R. said: I second Gabryel's query about tooltips (and I also want to register the awesomeness of Gabryel's design -- that black "torn" background with the violet is pretty sweet).&nbsp;&nbsp; Thanks, it's a lot of work but Scriptcards is so full of possibilities that it becomes a pleasure to create all these cards. It's amazing what Kurt has managed to do. I'm having almost as much fun setting up my table as I am playing!
Will M. said: The logic is farily simple, just wish I had a better handle on things like the [button] logic and formatting.&nbsp; The&nbsp; add-cgmnote &nbsp;(Line 22) API command writes the madness information to the GM Note on the selected characters sheet.&nbsp; Handy for future reference. WHOA. That is a huge nugget of useful info for me. What API script is that? GMNote? I already use Supernotes but Supernotes doesn't (AFAIK) provide write functionality to character sheets.
1616518875

Edited 1616519099
Jay R. said: Will M. said: The logic is farily simple, just wish I had a better handle on things like the [button] logic and formatting.&nbsp; The&nbsp; add-cgmnote &nbsp;(Line 22) API command writes the madness information to the GM Note on the selected characters sheet.&nbsp; Handy for future reference. WHOA. That is a huge nugget of useful info for me. What API script is that? GMNote? I already use Supernotes but Supernotes doesn't (AFAIK) provide write functionality to character sheets. I updated my post above with new code.&nbsp; Figured out how to use buttons (which required me to break my one large macro into 13).&nbsp; I also corrected a number of bugs (branching labels are case-sensitive BTW) and improved the formatting a little.&nbsp;&nbsp; Here is the API Code I use to log text to GM Notes, which I found on one of these forums a while back and tweaked for my purpose.&nbsp; There are commands to add/set Character GM Notes, Token GM Notes and Character Bio which are referenced below the code.&nbsp;&nbsp; on('ready',function(){ 'use strict'; const cmdregex=/^(!(?:set|add)-(?:c?gmnote|bio))\s*/, formatMsg = (c)=&gt;c.replace(cmdregex,'').replace(/(^{{\s*|\s*}}$)/gm,''); on('chat:message',function(msg){ if('api' === msg.type) { let match=msg.content.match(cmdregex); // if(match &amp;&amp; playerIsGM(msg.playerid) ){ if(match){ let content = formatMsg(msg.content), who=(getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); if(_.has(msg,'inlinerolls')){ content = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ var ti=_.reduce(v.results.rolls,function(m2,v2){ if(_.has(v2,'table')){ m2.push(_.reduce(v2.results,function(m3,v3){ m3.push(v3.tableItem.name); return m3; },[]).join(', ')); } return m2; },[]).join(', '); m['$[['+k+']]']= (ti.length &amp;&amp; ti) || v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },content) .value(); } if(content.length){ let tokens = _.chain(msg.selected) .map( s =&gt; getObj('graphic',s._id)) .reject(_.isUndefined) ; var currentdate = new Date(); var datetime = "Note Added: " + (currentdate.getMonth()+1) + "/" + (currentdate.getDate()) + "/" + currentdate.getFullYear() + " @ " + (currentdate.getHours()-5) + ":" + currentdate.getMinutes() + ":" + currentdate.getSeconds(); switch(match[1]){ case '!set-gmnote': tokens.each( o =&gt; { o.set({ gmnotes: content }); }); break; case '!set-cgmnote': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.set({ gmnotes: content }); }); break; case '!set-bio': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.set({ bio: content }); }); break; case '!add-gmnote': tokens.each( o =&gt;{ o.set({ gmnotes: `${o.get('gmnotes')}&lt;br&gt;\n${content}` }); }); break; case '!add-cgmnote': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.get('gmnotes',(notes)=&gt;{ _.defer(()=&gt;o.set({ gmnotes: `${notes}&lt;br&gt;\n&lt;hr&gt;${datetime}&lt;br&gt;${content}` })); }); }); break; case '!add-bio': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.get('bio',(notes)=&gt;{ _.defer(()=&gt;o.set({ bio: `${notes}&lt;br&gt;\n${content}` })); }); }); break; } } else { sendChat('',`/w "${who}" &lt;div&gt;`+ `&lt;div&gt;Use &lt;code&gt;COMMNAD Some Text&lt;/code&gt; or &lt;code&gt;COMMAND {{ some multi-line text}}&lt;/code&gt;.&lt;/div&gt;`+ `&lt;div&gt;&lt;b&gt;Commands:&lt;/b&gt;&lt;/div&gt;`+ `&lt;div&gt;&lt;ul&gt;`+ `&lt;li&gt;&lt;code&gt;!set-gmnote&lt;/code&gt; -- Replaces contents of token gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!set-cgmnote&lt;/code&gt; -- Replaces contents of character gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!set-bio&lt;/code&gt; -- Replaces contents of character bio.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-gmnote&lt;/code&gt; -- Appends to contents of token gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-cgmnote&lt;/code&gt; -- Appends to contents of character gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-bio&lt;/code&gt; -- Appends to contents of character bio.&lt;/li&gt;`+ `&lt;/ul&gt;&lt;/div&gt;` ); } } } }); });
1616525456

Edited 1616525488
Could use some examples of&nbsp;&nbsp; Save and Load (--s and --l) Writing a step by step macro's for creating a Magic item. I am looking to store the "GP cost" &amp; "time in Weeks" variable's to each macro. lets call them ttlGold &nbsp; &amp;&nbsp; ttlTime ie... 1st macro ends up being 2 weeks and 1,400 gp for some initial costs. the 2nd macro will need to add 15 weeks and 5,000 gp Then as I continue to the next macro it will continue to tally these variables. And this might continue in some later macros for the final time and weeks totals. Any advise or examples would be grateful &nbsp;&amp; helpful. If this is possible....tnx
1616591868

Edited 1616592307
Hello everyone, I managed to find a way to display a tooltip in scriptcards! It was not easy to find but it works perfectly! I used the following syntax to display a tooltip on a single character, here a unicode dice&nbsp; [] &nbsp;: [](#" class="showtip" title="Vous pouvez choisir d’utiliser 1 point d’Atout pour augmenter votre score d’initiative de 3 points. Il peut même être utilisé pendant un combat si vous voulez avoir une meilleure initiative à partir du prochain round de combat.) And it gives the following result: I hope this tip will be useful for you.
Gabryel said: Hello everyone, I managed to find a way to display a tooltip in scriptcards! It was not easy to find but it works perfectly! I used the following syntax to display a tooltip on a single character, here a unicode dice&nbsp; [] &nbsp;: [](#" class="showtip" title="Vous pouvez choisir d’utiliser 1 point d’Atout pour augmenter votre score d’initiative de 3 points. Il peut même être utilisé pendant un combat si vous voulez avoir une meilleure initiative à partir du prochain round de combat.) And it gives the following result: I hope this tip will be useful for you. Oh boy, this is SUPER helpful! Thank you, Gabryel.&nbsp;
1616595508
David M.
Pro
API Scripter
Very nice, Gabryel, thanks for the tip! (no pun intended)
Hello, I try to run a modify Divine Smite version of Kurt's example but I can't seem to get the deductspellslots library works ! Surely my poor programming skills....any help ? !scriptcard {{ +++5E Tools+++ --#title|Divine Smite --=DiceCount|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} + 1 --=IsFiendOrUndead|0 --?"@{target|npc_type}" -inc fiend|&gt;IsBoosted --?"@{target|npc_type}" -inc undead|&gt;IsBoosted --=TotalDice|[$DiceCount] + [$IsFiendOrUndead] --=SmiteRoll|[$TotalDice]d8 --#emoteText|@{selected|token_name} smites @{target|token_name} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --+Smite|deals [$SmiteRoll] radiant damage. --=SpellSlots|[$DiceCount] - 1 --+Use | a level [$SpellSlots] spell slot --&gt;Lib5E_DeductSpellSlot|@{selected|character_id};[$SpellSlots] --X| --:IsBoosted| --=IsFiendOrUndead|1 --&lt;| }}
I updated my post above with new code.&nbsp; Figured out how to use buttons (which required me to break my one large macro into 13).&nbsp; I also corrected a number of bugs (branching labels are case-sensitive BTW) and improved the formatting a little.&nbsp;&nbsp; Here is the API Code I use to log text to GM Notes, which I found on one of these forums a while back and tweaked for my purpose.&nbsp; There are commands to add/set Character GM Notes, Token GM Notes and Character Bio which are referenced below the code.&nbsp;&nbsp; on('ready',function(){ 'use strict'; const cmdregex=/^(!(?:set|add)-(?:c?gmnote|bio))\s*/, formatMsg = (c)=&gt;c.replace(cmdregex,'').replace(/(^{{\s*|\s*}}$)/gm,''); on('chat:message',function(msg){ if('api' === msg.type) { let match=msg.content.match(cmdregex); // if(match &amp;&amp; playerIsGM(msg.playerid) ){ if(match){ let content = formatMsg(msg.content), who=(getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); if(_.has(msg,'inlinerolls')){ content = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ var ti=_.reduce(v.results.rolls,function(m2,v2){ if(_.has(v2,'table')){ m2.push(_.reduce(v2.results,function(m3,v3){ m3.push(v3.tableItem.name); return m3; },[]).join(', ')); } return m2; },[]).join(', '); m['$[['+k+']]']= (ti.length &amp;&amp; ti) || v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },content) .value(); } if(content.length){ let tokens = _.chain(msg.selected) .map( s =&gt; getObj('graphic',s._id)) .reject(_.isUndefined) ; var currentdate = new Date(); var datetime = "Note Added: " + (currentdate.getMonth()+1) + "/" + (currentdate.getDate()) + "/" + currentdate.getFullYear() + " @ " + (currentdate.getHours()-5) + ":" + currentdate.getMinutes() + ":" + currentdate.getSeconds(); switch(match[1]){ case '!set-gmnote': tokens.each( o =&gt; { o.set({ gmnotes: content }); }); break; case '!set-cgmnote': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.set({ gmnotes: content }); }); break; case '!set-bio': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.set({ bio: content }); }); break; case '!add-gmnote': tokens.each( o =&gt;{ o.set({ gmnotes: `${o.get('gmnotes')}&lt;br&gt;\n${content}` }); }); break; case '!add-cgmnote': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.get('gmnotes',(notes)=&gt;{ _.defer(()=&gt;o.set({ gmnotes: `${notes}&lt;br&gt;\n&lt;hr&gt;${datetime}&lt;br&gt;${content}` })); }); }); break; case '!add-bio': tokens.map( o =&gt; getObj('character',o.get('represents'))) .reject(_.isUndefined) .each( o =&gt; { o.get('bio',(notes)=&gt;{ _.defer(()=&gt;o.set({ bio: `${notes}&lt;br&gt;\n${content}` })); }); }); break; } } else { sendChat('',`/w "${who}" &lt;div&gt;`+ `&lt;div&gt;Use &lt;code&gt;COMMNAD Some Text&lt;/code&gt; or &lt;code&gt;COMMAND {{ some multi-line text}}&lt;/code&gt;.&lt;/div&gt;`+ `&lt;div&gt;&lt;b&gt;Commands:&lt;/b&gt;&lt;/div&gt;`+ `&lt;div&gt;&lt;ul&gt;`+ `&lt;li&gt;&lt;code&gt;!set-gmnote&lt;/code&gt; -- Replaces contents of token gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!set-cgmnote&lt;/code&gt; -- Replaces contents of character gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!set-bio&lt;/code&gt; -- Replaces contents of character bio.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-gmnote&lt;/code&gt; -- Appends to contents of token gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-cgmnote&lt;/code&gt; -- Appends to contents of character gmnotes.&lt;/li&gt;`+ `&lt;li&gt;&lt;code&gt;!add-bio&lt;/code&gt; -- Appends to contents of character bio.&lt;/li&gt;`+ `&lt;/ul&gt;&lt;/div&gt;` ); } } } }); }); So, is this code a standalone script, or something you pasted into GMNote?&nbsp; Basically, I'm really excited about being able to select something from a menu of options (in my case, lingering injuries) and then dump it into a notes field (character sheet, token, etc.).&nbsp;
Jay R. said: So, is this code a standalone script, or something you pasted into GMNote?&nbsp; Basically, I'm really excited about being able to select something from a menu of options (in my case, lingering injuries) and then dump it into a notes field (character sheet, token, etc.).&nbsp; If you are a pro-user, you can paste this code as a new API script.&nbsp; You can name it anything you want, something like "AddNotes.js" should work.&nbsp; Once it's been added, you can issue the commands at the chat window (or make a macro, or imbed into ScriptCards with its API command) to add notes to character GM notes, Bio, and Token notes.&nbsp; See the commands in my previous post.&nbsp;&nbsp; For example, let's say I want to quickly jot down the fact that one of my players has been cursed and doesn't yet know it to the GM Note area.&nbsp; I would select their character token and In the chat area type:&nbsp; !add-cgmnote &nbsp;. This pops up a simple dialog window, where I type in "Player has been cursed'.&nbsp; I've actually created a simple wrapper macro in my game with this command to make it quicker.&nbsp;&nbsp; Hope this helps
Will M. said: Jay R. said: So, is this code a standalone script, or something you pasted into GMNote?&nbsp; Basically, I'm really excited about being able to select something from a menu of options (in my case, lingering injuries) and then dump it into a notes field (character sheet, token, etc.).&nbsp; If you are a pro-user, you can paste this code as a new API script.&nbsp; You can name it anything you want, something like "AddNotes.js" should work.&nbsp; Once it's been added, you can issue the commands at the chat window (or make a macro, or imbed into ScriptCards with its API command) to add notes to character GM notes, Bio, and Token notes.&nbsp; See the commands in my previous post.&nbsp;&nbsp; For example, let's say I want to quickly jot down the fact that one of my players has been cursed and doesn't yet know it to the GM Note area.&nbsp; I would select their character token and In the chat area type:&nbsp; !add-cgmnote &nbsp;. This pops up a simple dialog window, where I type in "Player has been cursed'.&nbsp; I've actually created a simple wrapper macro in my game with this command to make it quicker.&nbsp;&nbsp; Hope this helps That's very clear. Thank you! Looking forward to trying this out.
Anyone else able to get the buttonBackgroundColor parameter to work? I'm trying to add it as part of a saved setting, but ... it just doesn't work. The buttons continue to be the same default blue background color they've always been. Edit: Also, can you call another API from a button? If so, what is the syntax?
1616654434
Victor B.
Pro
Sheet Author
API Scripter
You keep going down this massive coding path you are going to alienate the majority of Pro Users.&nbsp; This is not the direction you should be going.&nbsp;&nbsp;
1616672684
Kurt J.
Pro
API Scripter
Jay R. said: Anyone else able to get the buttonBackgroundColor parameter to work? I'm trying to add it as part of a saved setting, but ... it just doesn't work. The buttons continue to be the same default blue background color they've always been. Edit: Also, can you call another API from a button? If so, what is the syntax? The [button][/button] markup is just a wrapper around the normal Roll20 button syntax, with what goes between the [] markers before the :: and what goes between the () markers afterwards. Here is the Roll20 Wiki page on API buttons:&nbsp; API: Chat – Roll20 Help Center
1616672804
David M.
Pro
API Scripter
Jay, try&nbsp;buttonBackground instead of&nbsp;buttonBackgroundColor. Kurt, not sure which is intended, but it looks like there is a discrepancy between&nbsp;the wiki documentation and the source code for this property. Victor, not sure I understand your comment? Sure, it's not going to be for everyone, but all api scripts are optional as are most of the features of this script. It is an extremely useful tool that overcomes many existing limitations in typical macros. There are several features I have avoided because I don't have a need for them (at least not yet), but others obviously do. I have written several custom scripts/scriptlets for people on the forums to solve their unique problems, but for most cases I can now write a scriptcard and have them make a single install with a far more flexible tool that they can edit more easily (and can potentially use for other applications if they want) without them having to know/learn js, as opposed to a collection of limited single-function one-off scripts, which is a win IMO. I'm interested in hearing your opinion of the direction Kurt should be going while still providing the functionality that many people are excited about. I want to be clear that this isn't intended to be a snarky rebuttal, as sometimes tone is difficult to convey over text. I'm genuinely interested in the conversation.&nbsp;
1616672861
Kurt J.
Pro
API Scripter
sebastien g. said: Hello, I try to run a modify Divine Smite version of Kurt's example but I can't seem to get the deductspellslots library works ! Surely my poor programming skills....any help ? !scriptcard {{ +++5E Tools+++ --#title|Divine Smite --=DiceCount|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} + 1 --=IsFiendOrUndead|0 --?"@{target|npc_type}" -inc fiend|&gt;IsBoosted --?"@{target|npc_type}" -inc undead|&gt;IsBoosted --=TotalDice|[$DiceCount] + [$IsFiendOrUndead] --=SmiteRoll|[$TotalDice]d8 --#emoteText|@{selected|token_name} smites @{target|token_name} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --+Smite|deals [$SmiteRoll] radiant damage. --=SpellSlots|[$DiceCount] - 1 --+Use | a level [$SpellSlots] spell slot --&gt;Lib5E_DeductSpellSlot|@{selected|character_id};[$SpellSlots] --X| --:IsBoosted| --=IsFiendOrUndead|1 --&lt;| }} You haven't defined/set $SpellSlots anywhere. You could do this by adding something like: --=SpellSlots|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} Right after the assignement for DiceCount.
1616673930
Kurt J.
Pro
API Scripter
David M. said: Jay, try&nbsp;buttonBackground instead of&nbsp;buttonBackgroundColor. Kurt, not sure which is intended, but it looks like there is a discrepancy between&nbsp;the wiki documentation and the source code for this property. Victor, not sure I understand your comment? Sure, it's not going to be for everyone, but all api scripts are optional as are most of the features of this script. It is an extremely useful tool that overcomes many existing limitations in typical macros. There are several features I have avoided because I don't have a need for them (at least not yet), but others obviously do. I have written several custom scripts/scriptlets for people on the forums to solve their unique problems, but for most cases I can now write a scriptcard and have them make a single install with a far more flexible tool that they can edit more easily (and can potentially use for other applications if they want) without them having to know/learn js, as opposed to a collection of limited single-function one-off scripts, which is a win IMO. I'm interested in hearing your opinion of the direction Kurt should be going while still providing the functionality that many people are excited about. I want to be clear that this isn't intended to be a snarky rebuttal, as sometimes tone is difficult to convey over text. I'm genuinely interested in the conversation.&nbsp; Thanks for catching that David. I updated the wiki documentation to reflect the correct setting name.
&nbsp; I'm back for some more help with a script. My friends &amp; I are using a rule with weapons that can be made that have open ended damage. &nbsp; When you attack with this weapon and roll the maximum result for the weapon’s damage dice, you can roll those dice again and add the new roll to the damage of the attack. If you roll the maximum amount again, you can repeat this process until you don’t. I'm not sure how to write that into the scriptcard for weapons that do that. Here is the basic card I have for a longsword. !scriptcard {{ --#title|Longsword --#leftsub|Melee Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=AttackRoll|?{Attack|Normal,1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]|Advantage,2d20kh1 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]|Disadvantage,2d20kl1 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]} --+Attack|[$AttackRoll] vs AC --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Base] -gt 1|Hit --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --=Damage|1d8 + @{selected|strength_mod} [STR] --=DamageTwo| --+Hit!|[$Damage] slashing damage. --^Final| --:Crit| --=Damage|1d8 + @{selected|strength_mod} [STR] + 1d8 [CRIT] --+Critical Hit!|[$Damage] slashing damage. --:Final| }}
1616680691

Edited 1616680724
David M.
Pro
API Scripter
Snow, try replacing your code from the "Hit" line down with the following. Calls a RollDamageDice procedure that loops on max die roll. Currently outputs all the base damage dice via a string variable ("AllDice") to be more clear about where the total [DICE] number came from, as the tooltip will not show all the rolls. You can test it more easily by temporarily changing the die roll and the loop conditional to "1d2" and "-eq 2", respectively. --:Hit| --&gt;RollDamageDice| --=TotalDamage|[$DamageDice][DICE]+@{selected|strength_mod}[STR] --+Hit!|[$TotalDamage] slashing damage. --^Final| --:Crit| --&gt;RollDamageDice| --=TotalDamage|[$DamageDice][DICE]+@{selected|strength_mod}[STR]+1d8[CRIT] --+Critical Hit!|[$TotalDamage] slashing damage. --:Final| --X| --:RollDamageDice| --=DamageDice|0 --:DamageLoop| --=DieRoll|1d8 --=DamageDice|[$DamageDice]+[$DieRoll] --&amp;AllDice|+[$DieRoll] --?[$DieRoll.Total] -eq 8|DamageLoop --+Base Damage Dice|[&amp;AllDice] --&lt;| }}
Kurt J. said: sebastien g. said: Hello, I try to run a modify Divine Smite version of Kurt's example but I can't seem to get the deductspellslots library works ! Surely my poor programming skills....any help ? !scriptcard {{ +++5E Tools+++ --#title|Divine Smite --=DiceCount|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} + 1 --=IsFiendOrUndead|0 --?"@{target|npc_type}" -inc fiend|&gt;IsBoosted --?"@{target|npc_type}" -inc undead|&gt;IsBoosted --=TotalDice|[$DiceCount] + [$IsFiendOrUndead] --=SmiteRoll|[$TotalDice]d8 --#emoteText|@{selected|token_name} smites @{target|token_name} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --+Smite|deals [$SmiteRoll] radiant damage. --=SpellSlots|[$DiceCount] - 1 --+Use | a level [$SpellSlots] spell slot --&gt;Lib5E_DeductSpellSlot|@{selected|character_id};[$SpellSlots] --X| --:IsBoosted| --=IsFiendOrUndead|1 --&lt;| }} You haven't defined/set $SpellSlots anywhere. You could do this by adding something like: --=SpellSlots|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} Right after the assignement for DiceCount. I thought I did it in the line in Bold
1616681803

Edited 1616681814
David M.
Pro
API Scripter
Do you have the ChatSetAttr script installed in your game? Looks like that library function is making a setattr call to deduct the slot. Other than that I'm not sure, as I don't have much experience with libraries.&nbsp;&nbsp;
David M. said: Do you have the ChatSetAttr script installed in your game? Looks like that library function is making a setattr call to deduct the slot. Other than that I'm not sure, as I don't have much experience with libraries.&nbsp;&nbsp; Yes I've got it, I use it a lot. My player will deduce the spell slot by hand :-)
David M. said: Jay, try&nbsp;buttonBackground instead of&nbsp;buttonBackgroundColor. Kurt, not sure which is intended, but it looks like there is a discrepancy between&nbsp;the wiki documentation and the source code for this property. Victor, not sure I understand your comment? Sure, it's not going to be for everyone, but all api scripts are optional as are most of the features of this script. It is an extremely useful tool that overcomes many existing limitations in typical macros. There are several features I have avoided because I don't have a need for them (at least not yet), but others obviously do. I have written several custom scripts/scriptlets for people on the forums to solve their unique problems, but for most cases I can now write a scriptcard and have them make a single install with a far more flexible tool that they can edit more easily (and can potentially use for other applications if they want) without them having to know/learn js, as opposed to a collection of limited single-function one-off scripts, which is a win IMO. I'm interested in hearing your opinion of the direction Kurt should be going while still providing the functionality that many people are excited about. I want to be clear that this isn't intended to be a snarky rebuttal, as sometimes tone is difficult to convey over text. I'm genuinely interested in the conversation.&nbsp; Thanks for the help, David! I suspected it was something like that. :) To echo your response to Victor: Agreed, absolutely. Tone, as you mentioned, is sometimes hard to gauge in an online format. With absolutely no rancor intended, I don't see how all the hard work Kurt has put into Scriptcards could possibly alienate Pro users. If anything, he's given us API users a wonderful new tool that has many different exciting applications. But obviously, as with any script, you use what you want. I don't have the coding chops to do 3/4 of what y'all are doing with Scriptcards, but I'm still getting a lot of value from it. In particular, Scriptcards let me finally solve the problem of distributing and using healing potions, which I'd been struggling with for years. And being able to give each character a menu that tracks all their various powers, while taking advantage of branching functionality not found anywhere else in Roll20, has been a godsend.
Kurt J. said: Jay R. said: Anyone else able to get the buttonBackgroundColor parameter to work? I'm trying to add it as part of a saved setting, but ... it just doesn't work. The buttons continue to be the same default blue background color they've always been. Edit: Also, can you call another API from a button? If so, what is the syntax? The [button][/button] markup is just a wrapper around the normal Roll20 button syntax, with what goes between the [] markers before the :: and what goes between the () markers afterwards. Here is the Roll20 Wiki page on API buttons:&nbsp; API: Chat – Roll20 Help Center Thanks for this, Kurt. So I'd use the @ substitution for a script call, just like if it weren't wrapped by a button. Cool.
Having trouble calling the Wild Shape API from within a button.&nbsp; [button]Use::@ws_ids @{selected|token_id}[/button] Clicking this button crashes the game by taking it to a 404 Page Not Found. Wild Shape is a script where you select the token and run the !ws command, without needing to specify selected tokens in the syntax. So I'm not quite sure what to do. I tried @ws on its own but that also produced the same 404 error.
Thank you again for the help David. I did what you said and tried it with d2 to test it and kept getting 1 on the roll. I then looked at the script and find out why, it was because I forgot to change the -eq 8 to -eq 2 lol. After that fix it works perfectly.
The button syntax is just a different way to use the base API button functionality built into Roll20. Without ScriptCards, you could use this [Use](!&amp;#13;!ws --ids @{selected|token_id}) That would give you a bright pink button in the chat that you could press to execute the Wild Shape script. the "!&amp;#13;" part tells Roll20 "I'm doing an API call and I want to do a carriage return first--"&amp;#13;" is HTML code for the carriage return.&nbsp; With ScriptCards, you use the same parameters but a different structure (and one more HTML substitution): [button]Use::!&amp;#13;!ws &amp;#45;&amp;#45;ids @{selected|token_id}[/button] &amp;#45; is HTML for the "-" character. You need to substitute that out because when ScriptCards encounters "--" it will interpret it as a new line. Jay R. said: Having trouble calling the Wild Shape API from within a button.&nbsp; [button]Use::@ws_ids @{selected|token_id}[/button] Clicking this button crashes the game by taking it to a 404 Page Not Found. Wild Shape is a script where you select the token and run the !ws command, without needing to specify selected tokens in the syntax. So I'm not quite sure what to do. I tried @ws on its own but that also produced the same 404 error.
Colin C. said: The button syntax is just a different way to use the base API button functionality built into Roll20. Without ScriptCards, you could use this [Use](!&amp;#13;!ws --ids @{selected|token_id}) That would give you a bright pink button in the chat that you could press to execute the Wild Shape script. the "!&amp;#13;" part tells Roll20 "I'm doing an API call and I want to do a carriage return first--"&amp;#13;" is HTML code for the carriage return.&nbsp; With ScriptCards, you use the same parameters but a different structure (and one more HTML substitution): [button]Use::!&amp;#13;!ws &amp;#45;&amp;#45;ids @{selected|token_id}[/button] &amp;#45; is HTML for the "-" character. You need to substitute that out because when ScriptCards encounters "--" it will interpret it as a new line. Jay R. said: Having trouble calling the Wild Shape API from within a button.&nbsp; [button]Use::@ws_ids @{selected|token_id}[/button] Clicking this button crashes the game by taking it to a 404 Page Not Found. Wild Shape is a script where you select the token and run the !ws command, without needing to specify selected tokens in the syntax. So I'm not quite sure what to do. I tried @ws on its own but that also produced the same 404 error. Ahhh, I see now. Thank you, Colin!
Thanks to the people on this thread (and a few other threads), I think I've finally been able to organize my Roll20 Macros and associated workflow.&nbsp; I took inspiration from a number of you all including Jay , David M. , Kurt J. and Gabryel .&nbsp; Below are examples of my new Macro Bar and Chat Window Macro Dialogs I created with ScriptCards.&nbsp; I'm too embarrassed to show you my prior setup.&nbsp;&nbsp; New Macro Bar: Chat Window Macro Dialogs (via ScriptCard): &nbsp; &nbsp; &nbsp;
1616712136
David M.
Pro
API Scripter
Sweet! Looks like Will's over there playing Roll30 ;)
Will M. said: Thanks to the people on this thread (and a few other threads), I think I've finally been able to organize my Roll20 Macros and associated workflow.&nbsp; I took inspiration from a number of you all including Jay , David M. , Kurt J. and Gabryel .&nbsp; Below are examples of my new Macro Bar and Chat Window Macro Dialogs I created with ScriptCards.&nbsp; I'm too embarrassed to show you my prior setup.&nbsp;&nbsp; Good work! It looks very complete and very fun! I'm curious to see the script itself, there are some features that look really cool !
1616751979
Senjak
Pro
Sheet Author
Will M. said: Thanks to the people on this thread (and a few other threads), I think I've finally been able to organize my Roll20 Macros and associated workflow.&nbsp; I took inspiration from a number of you all including Jay , David M. , Kurt J. and Gabryel .&nbsp; Below are examples of my new Macro Bar and Chat Window Macro Dialogs I created with ScriptCards.&nbsp; I'm too embarrassed to show you my prior setup.&nbsp;&nbsp; New Macro Bar: Chat Window Macro Dialogs (via ScriptCard): Please share your script, it looks to have many cool features!
Will M. said: Thanks to the people on this thread (and a few other threads), I think I've finally been able to organize my Roll20 Macros and associated workflow.&nbsp; I took inspiration from a number of you all including Jay , David M. , Kurt J. and Gabryel .&nbsp; Below are examples of my new Macro Bar and Chat Window Macro Dialogs I created with ScriptCards.&nbsp; I'm too embarrassed to show you my prior setup.&nbsp;&nbsp; New Macro Bar: Chat Window Macro Dialogs (via ScriptCard): &nbsp; &nbsp; &nbsp; Will, this looks awesome! Well done. And I'll add to the chorus of people who want to see your scriptcards. I'm sure there's stuff I can steal use. ;)
1616777913

Edited 1616787244
Update: &nbsp; So I've copied all my Scripts and Macros into two text files.&nbsp; I don't want to just dump them here as we are talking a couple thousand lines of text.&nbsp; I don't have a public file storage account and don't want to expose my personal DropBox.&nbsp; Any suggestions on how I might make these easily available? Earlier: I'll work to pull this all together for you all.&nbsp; May post it as a couple large text files on a public file server somewhere as in incorporates a number of APIs &amp; Macros.&nbsp; I don't really want to pollute this thread with a ton of code, so will need to find a public file server to post.&nbsp; I need to do this anyways to facilitate the creation of my next campaign.&nbsp;&nbsp;
Scriptcard request for those who are better at this than I am: an Initiative scriptcard that respects whether the character has advantage or disadvantage for Init checks.
Does this API call to Combat Master look right? Do I need a substitute for the = or the comma? &nbsp;--@cmaster|add,condition=broken arm On a related note, it might be worthwhile to update the Wiki section on API Calls to reflect all the character substitutions.
I'm sorry if this is not a new question but I am still a bit of a newb. (5e OGL)&nbsp; I tried to pass a parameter to an attribute: &nbsp; --&gt;Attack|?{Ability?|strength|dexterity|constitution|intelligence|wisdom|charisma} &nbsp; --:Attack &nbsp; --=AttackRoll|1d20 + @{selected|[%1%]_mod} [MOD] + @{selected|pb} [PROF] + @{selected|global_attack_mod} The roll did not add the MOD but showed: 1d20 + selected|dexterity_mod [MOD] + 3 [PROF] + Error:&nbsp;&nbsp; No attribute was found for @{selected|[%1%]_mod} What did&nbsp; I do wrong?
1617022266
David M.
Pro
API Scripter
Michael, the issue is with the macro order of operations. The chat parser attempts to expand attributes (e.g. "@{selected|...}") before scriptcards even starts running.&nbsp; I think this should work: !scriptcards {{ --:VARIABLE ASSIGNMENT| --=Attribute|?{Attribute|Strength,@{selected|strength_mod}|Dexterity,@{selected|dexterity_mod}|Constitution,@{selected|constitution_mod}|Intelligence,@{selected|intelligence_mod}|Wisdom,@{selected|wisdom_mod}|Charisma,@{selected|charisma_mod}} --=AttackRoll|1d20[BASE] + [$Attribute][MOD] + @{selected|pb}[PROF] + @{selected|global_attack_mod} --:OUTPUT| --+Attack Roll|[$AttackRoll] }} Or, if you wanted to use the name of the attribute somewhere else in your card, something like this would work. In the case below, there is an extra output line at the end that references the attribute name.&nbsp; !scriptcards {{ --:VARIABLE ASSIGNMENT| --&amp;Attribute|?{Attribute|Strength|Dexterity|Constitution|Intelligence|Wisdom|Charisma} --=Strength|@{selected|strength_mod} --=Dexterity|@{selected|dexterity_mod} --=Constitution|@{selected|constitution_mod} --=Intelligence|@{selected|intelligence_mod} --=Wisdom|@{selected|wisdom_mod} --=Charisma|@{selected|charisma_mod} --=AttackRoll|1d20[BASE] + [$[&amp;Attribute]][MOD] + @{selected|pb} [PROF] + @{selected|global_attack_mod} --:OUTPUT| --+Attack Roll|[$AttackRoll] --+Note|I just made an attack roll modified by my [&amp;Attribute] }}
Jay R. said: Does this API call to Combat Master look right? Do I need a substitute for the = or the comma? &nbsp;--@cmaster|add,condition=broken arm On a related note, it might be worthwhile to update the Wiki section on API Calls to reflect all the character substitutions. Combat Master requires the "--" notation before "add" (which means you should use "_" within ScriptCards). However, ScriptCards does not appear to work for calling Combat Master. I have had some success using SelectManager --@forselected|cmaster _add,condition=broken arm But, depending on other operations, this doesn't always work (I don't know why).
1617029774
David M.
Pro
API Scripter
Colin, I've never used CM, but are you perhaps sometimes selecting multiple tokens? If so, you might want to try using @forselected+| instead of @forselected| The "plus" tells SelectManger to keep replacing the tokenID used by the subordinate script with the next token in the list of selected tokens (if I am understanding the SM documentation correctly).
Very helpful, thank you both. I'll play around with this tonight with SelectManager installed.
1617035720

Edited 1617035870
timmaugh
Pro
API Scripter
David M. said: Colin, I've never used CM, but are you perhaps sometimes selecting multiple tokens? If so, you might want to try using @forselected+| instead of @forselected| The "plus" tells SelectManger to keep replacing the tokenID used by the subordinate script with the next token in the list of selected tokens (if I am understanding the SM documentation correctly). That's close, but it's a little different. forselected will, just by itself, iterate the command and sub in the next selected token for each call. It works with the at{selected|property} formation to mimic the @{selected|property} formation. The plus-es or minus-es that follow the forselected handle have to do specifically with what it should do if it sees the *first* token id or token name in the command that it keeps sending out, so that you minimize having to change your original command line too much, if you don't want to. So if you didn't want to change an @{selected|token_id} into an at{selected|token_id} to make it work with the forselected handle, you could leave the former construction in the line and use the first '+' following forselected. forselected+ somescript @{selected|token_id} Roll20 parsers will see the token property call and retrieve the information -- for multiple selected tokens, it will leave behind the token id of the FIRST token. That's where SelectManager says: if I see, in the command line I'm about to send, the id of the first token in the set of selected tokens, I should replace it with the id of the next selected token. In effect, the first '+' turns the token id of the first selected token into a de facto at{selected|token_id} call. The second '+' does the same for the name of the first selected token. The thing is, both of these are turned "on" by default... so there's no effective difference between: forselected forselected+ forselected++ What matters is when you want to turn them off. That's when you have to use the '-'... forselected- forselected+- forselected-- For instance, if you had to include the id of one of the selected tokens in *every* call to every token (maybe that token was the source of some effect), then you would want to turn off the auto-replacement of the token id just to make sure you don't accidentally overwrite that part of the command that gets iterated. All of that said, the manner by which SelectManager (and the other meta scripts) shin-kicks its way to the front of the message queue to be able to fiddle in the message before the other scripts see it works with the way *most* other scripts are built. I'll look at CM to see if there could be a problem. Are there specific cases you can point to, @Colin, where forselected doesn't work?