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

1613688307

Edited 1613690272
1º. question. Is there a way to make 2 attack rolls instead of 1 in the same line? i'm trying to make a simple attack roll card.  2.º question.  Is there a way to hide a roll and then click and roll it? For example, damage, divine smite, sneak attack,.... I have the following macro.... !scriptcard !scriptcard {{ --#title|Longsword --#leftsub|Versatile (1d10) --#emoteText| @{ selected |token_name} attacks with its longsword! --=AttackRoll| 1d20 + @{selected|pb} + @{selected|strength_mod} --+Attack| You roll a [$AttackRoll] to hit! --:FUNCTIONS| --:HasUses| --+Click to activate|[button]Damage::!
# Longsword [/button] --:HasUses| --+Click to activate|[button]Divine Smite::!
# Divine-Smite [/button] }} And this is the result ( img example clicking in Divine Smite ), it's a bit unsightly, since it displays a different template than the card. The question is if there is a way to click on the button to display the chosen damage on the same line or a lower one, but inside the card without resorting to an external template.
1613703732

Edited 1613703881
Kurt J.
Pro
API Scripter
David M. said: Kurt J. said: I just had an idea... but do I really want to go down this road? :) I'm wondering if I created an "ask the user something" statement type that stashed the current script, stacks, variables and program counter in memory and created a new API command that prompted the response and jumped back into scriptcards and retrieved the stashed data from memory and resumed running it............................... I mean.... you'd be a hero, but yeah I completely understand your hesitation haha! Sounds kinda like what I had to go through with Spawn in the good-old pre-SelectManager days. Although I was only doing it for one value. Depending on initial commands (if need both selected and targets), a chat button is created that prompts for targets and then Spawn calls itself again, grabbing the original selectedIDs from a local registry. In case you're interested, see lines 70-94 and then again starting at line 1315 of the one-click version ( GitHub ). Much help from TheAaron on that one. Some comments, including a forum link for the "please help me!" discussion I had: &nbsp;//Due to a bug in the API, if a @{target|...} is supplied, the API does not acknowledge msg.selected anymore &nbsp; &nbsp; &nbsp; &nbsp; //This code block helps enable the user to pass both selected and target info into the script &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //---The initial api call will create a chat button that stores the original msg.content &amp; selected tokenID as a "memento"... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //...clicking this button will trigger a second api call that will prompt for a number of targets.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //"--qty" number of tokens will spawn for EACH origin token (determined by selected or targeted) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Trick developed by TheAaron.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Forum thread here : <a href="https://app.roll20.net/forum/post/8998098/can-you-pass-both-a-selected-and-target-tokenid-to-an-api-script/?pageforid=8998098#post-8998098" rel="nofollow">https://app.roll20.net/forum/post/8998098/can-you-pass-both-a-selected-and-target-tokenid-to-an-api-script/?pageforid=8998098#post-8998098</a> Think I had about a month of js experience at that point, so I wouldn't try to follow anything else in that code ;) Well, I got it to work :)&nbsp;My current test setup uses a statement to request information from the player and sends a whisper to them with a button. They click the button and either target things or respond to roll queries. The script then resumes and knows what you entered. One of my test cases labels the button "target three things" and then passes the token ids back to ScriptCards and resumes running the script. The framework is all in place for suspending and resuming the script (needs testing of course to make sure that *everything* comes back appropriately, and I'll need some time to come up with the best method of incorporating it into the scripting language - but it is definitely doable... it would allow me to create something like the magic missile macro that lets you select a target for each missile AFTER you pick the spell level&nbsp;:) Just noticed that I zoomed in to far so you can't see the "select target" prompts, but it works the same as any other targeting...
1613703785
Kurt J.
Pro
API Scripter
Rober M. said: 1º. question. Is there a way to make 2 attack rolls instead of 1 in the same line? i'm trying to make a simple attack roll card.&nbsp; 2.º question. &nbsp;Is there a way to hide a roll and then click and roll it? For example, damage, divine smite, sneak attack,.... I have the following macro.... !scriptcard !scriptcard {{ --#title|Longsword --#leftsub|Versatile (1d10) --#emoteText| @{ selected |token_name} attacks with its longsword! --=AttackRoll| 1d20 + @{selected|pb} + @{selected|strength_mod} --+Attack| You roll a [$AttackRoll] to hit! --:FUNCTIONS| --:HasUses| --+Click to activate|[button]Damage::!&amp;#13;# Longsword [/button] --:HasUses| --+Click to activate|[button]Divine Smite::!&amp;#13;# Divine-Smite [/button] }} And this is the result ( img example clicking in Divine Smite ), it's a bit unsightly, since it displays a different template than the card.&nbsp;The question is if there is a way to click on the button to display the chosen damage on the same line or a lower one, but inside the card&nbsp;without resorting to an external template. There is not a way to do this right now... It could probably done with some clever CSS to hide/show divs, though I'm not sure if that would fly in the chat panel or not.
1613708441
David M.
Pro
API Scripter
Sounds awesome, Kurt! I might be MIA for a while, though, so not sure when I'd be able to try it out. I'm going to be slammed until prob Sunday PM. @Rober M, closest thing might be to just turn your damage &amp; smite macros into simple scriptcards so they all have the same feel. Maybe adding --#hideTitleCard|1 to reduce the footprint? Something simple like: !scriptcard {{ &nbsp; --#hideTitleCard|1 &nbsp; --=Damage|2d8&nbsp; &nbsp; --+Divine Smite|[$Damage] radiant damage }} I kinda faked it above, doing it all in a live macro window rather than testing with buttons, and forgot to add damage type in the pic but you get the idea.
1613712990

Edited 1613713258
timmaugh
Pro
API Scripter
Kurt J. said: David M. said: Hmm, thinking about this a bit more, I have a question for Kurt: Many of my scripts use vertical pipes between commands and arguments. I'm guessing this is going to cause problems when calling from a scriptcard? Token-mod often has these delimiting characters in them, as well. A couple of examples: !Spawn --name|imp --offset|1,0 !token-mod --set statusmarkers|blue|broken-shield Scriptcards uses a "_" substitution for "--", but could we get one for vertical pipe "|", as well? Or is there already a way to handle this? Related: There might be a way for the user to trigger Spawn from scriptcards without requiring a code change for Spawn (using the "!forselected+" command of the latest version of SelectManager, see below), but I'm thinking the pipes will still cause problems from a scriptcard currently. This following works in chat (1st line only if there is a character sheet in the journal named "imp" that has a default token) !forselected+ Spawn --name|imp --offset|1,0 !forselected+ token-mod --set statusmarkers|blue|broken-shield But this doesn't (though I might have some other syntax wrong - I've actually never called a script from scriptcards) !scriptcard {{ --#hideCard|1 --@forselected+|Spawn _name|imp _offset|1,0 --@forselected+|token-mod _set statusmarkers|blue|broken-shield }} Thoughts? Vertical bars are fine in the content portion of a ScriptCard and get passed along as normal to whatever API is being called. For example, here is the apply damage using token-mod from the expanded magic missile script: --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] I'm not too familiar with SelectManager (yet! it looks like something I need to check out), but by the time ScriptCards calls it, it is likely nothing is selected. It is likely necessary to use !foreselected prior to calling ScriptCards rather that within the card (just a guess though - I haven't tried it), so !forselected+ ScriptCard {{...}} ( note that I might be completely misunderstanding selectmanager :)) I just updated SelectManager to 1) allow forselected to be called by a script (previously, it had only listened for a user-generated call), and 2) to handle line-breaks in the command it is given to pass along in its iteration. I *think* this should answer David's need, but I will wait to get the verdict on that from Kurt or David regarding the necessary syntax in ScriptCards. To Kurt's point, ScriptManager will store the selected, who, and playerid parts of the last user-generated message so they are available for an API-generated message to pick up (or to be inserted into that message). So, Kurt is right that by the time ScriptCards calls forselected, there is no selected array. However, in that case, forselected will grab the array of selected tokens still stored from the last user-generated call (the ScriptCards call), and it will start its down-stream iteration, handing off one token at a time (and restoring the selected property of those downstream, API-generated messages). Any other script, called by ScriptCards, that wanted to recapture the selected tokens would have to use one of the methods described in the SelectManager thread. David's Spawn usage (above) benefits from forselected doing that for him... as it would for any other down-stream script. Let me know if still more tweaking is necessary on SelectManager to work with ScriptCards, but I think this should do it.
David M. said: Sounds awesome, Kurt! I might be MIA for a while, though, so not sure when I'd be able to try it out. I'm going to be slammed until prob Sunday PM. @Rober M, closest thing might be to just turn your damage &amp; smite macros into simple scriptcards so they all have the same feel. Maybe adding --#hideTitleCard|1 to reduce the footprint? Something simple like: !scriptcard {{ &nbsp; --#hideTitleCard|1 &nbsp; --=Damage|2d8&nbsp; &nbsp; --+Divine Smite|[$Damage] radiant damage }} I kinda faked it above, doing it all in a live macro window rather than testing with buttons, and forgot to add damage type in the pic but you get the idea. Nice one, very clever. Thx
Kurt J. said: David M. said: Kurt J. said: I just had an idea... but do I really want to go down this road? :) I'm wondering if I created an "ask the user something" statement type that stashed the current script, stacks, variables and program counter in memory and created a new API command that prompted the response and jumped back into scriptcards and retrieved the stashed data from memory and resumed running it............................... I mean.... you'd be a hero, but yeah I completely understand your hesitation haha! Sounds kinda like what I had to go through with Spawn in the good-old pre-SelectManager days. Although I was only doing it for one value. Depending on initial commands (if need both selected and targets), a chat button is created that prompts for targets and then Spawn calls itself again, grabbing the original selectedIDs from a local registry. In case you're interested, see lines 70-94 and then again starting at line 1315 of the one-click version ( GitHub ). Much help from TheAaron on that one. Some comments, including a forum link for the "please help me!" discussion I had: &nbsp;//Due to a bug in the API, if a @{target|...} is supplied, the API does not acknowledge msg.selected anymore &nbsp; &nbsp; &nbsp; &nbsp; //This code block helps enable the user to pass both selected and target info into the script &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //---The initial api call will create a chat button that stores the original msg.content &amp; selected tokenID as a "memento"... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //...clicking this button will trigger a second api call that will prompt for a number of targets.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //"--qty" number of tokens will spawn for EACH origin token (determined by selected or targeted) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Trick developed by TheAaron.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Forum thread here : <a href="https://app.roll20.net/forum/post/8998098/can-you-pass-both-a-selected-and-target-tokenid-to-an-api-script/?pageforid=8998098#post-8998098" rel="nofollow">https://app.roll20.net/forum/post/8998098/can-you-pass-both-a-selected-and-target-tokenid-to-an-api-script/?pageforid=8998098#post-8998098</a> Think I had about a month of js experience at that point, so I wouldn't try to follow anything else in that code ;) Well, I got it to work :)&nbsp;My current test setup uses a statement to request information from the player and sends a whisper to them with a button. They click the button and either target things or respond to roll queries. The script then resumes and knows what you entered. One of my test cases labels the button "target three things" and then passes the token ids back to ScriptCards and resumes running the script. The framework is all in place for suspending and resuming the script (needs testing of course to make sure that *everything* comes back appropriately, and I'll need some time to come up with the best method of incorporating it into the scripting language - but it is definitely doable... it would allow me to create something like the magic missile macro that lets you select a target for each missile AFTER you pick the spell level&nbsp;:) Just noticed that I zoomed in to far so you can't see the "select target" prompts, but it works the same as any other targeting... That'd be great specially to handle realistic rules like handling RoF (Rate of Fire), Shield usage (provided the PC or NPC has a shield equiped)! Another question : I've seen your post regarding libraries and I was wondering if this could be used to expand compendium to other RPG (huge libraries dedicated to specific RPGs)?
1613740737

Edited 1613740817
David M.
Pro
API Scripter
@DM Goss, if you update SelectManager to v0.0.6+ (found here ), then calling Spawn from within your scriptcard will now work, thanks to timmaugh's latest update! Simple example. Obviously you would have more in here, or you wouldn't need a scriptcard :) For multiple choices, I'd create functions for each Spawn effect/name and a case statement or series of conditionals in your main block. Otherwise you can hardcode. !scriptcard {{ --&amp;name|?{Spawn Name?|Fireball,Fireball|Wildfire Spirit,Wildfire Spirit} --@forselected+|Spawn _name|[&amp;name] _offset|0,0 _targets|1 --X| }} @Rober M, you can probably do something similar (using forselected+) with your Divine Sense application and the !Radar script ( discussion on the Radar forum thread). Check remaining uses with scriptcards as usually and auto-triggering the script rather than creating the api button and clicking to trigger another macro.&nbsp; Really cool, guys - thanks everyone!
Thanks, David M. I appreciate it. I'm going to try it once I get home.&nbsp;
1613744438

Edited 1613746880
David M. said: @DM Goss, if you update SelectManager to v0.0.6+ (found here ), then calling Spawn from within your scriptcard will now work, thanks to timmaugh's latest update! Simple example. Obviously you would have more in here, or you wouldn't need a scriptcard :) For multiple choices, I'd create functions for each Spawn effect/name and a case statement or series of conditionals in your main block. Otherwise you can hardcode. !scriptcard {{ --&amp;name|?{Spawn Name?|Fireball,Fireball|Wildfire Spirit,Wildfire Spirit} --@forselected+|Spawn _name|[&amp;name] _offset|0,0 _targets|1 --X| }} @Rober M, you can probably do something similar (using forselected+) with your Divine Sense application and the !Radar script ( discussion on the Radar forum thread). Check remaining uses with scriptcards as usually and auto-triggering the script rather than creating the api button and clicking to trigger another macro.&nbsp; Really cool, guys - thanks everyone! Thx, i try to do something.&nbsp; One question ,&nbsp;is there any possibility to roll the 3d dice on the screen when using the scriptcard? I have noticed that with the use of this script no dice roll on the screen? (call me a classic, but I'm still pretty old school) :P
1613755181

Edited 1613761692
1. Is there any way to change the background color of a single button ?&nbsp;I have tried to change it, but they all change with buttonbackgroundColor. I only wants to change de Critical button (to red color #993333) near to the Damage button.&nbsp; 2. &nbsp;Is there any way to handle commands like this? [[ {[[1d8]]], 2}kh1 ]]. I'm trying to make the 1 on a die always be considered 2, but it doesn't seem to support this sequence.&nbsp; 3.&nbsp; For some reason, obviously my clumsiness since I still do not control the Scriptcards, I would like that when a natural 20 is rolled on the die, the Critical message is displayed, and with a natural 1, a Fumble. As I have it configured it always appears, and I don't know how to make it conditional. 4. &nbsp;I don't know if the Scriptcards supports or has any function to roll the 3d dice on the screen , but if not it would be very nice to have that functionality.....&nbsp; 5. &nbsp;Does Scriptcards allow to roll on rollable tables?&nbsp;I tried to do it for an attack roll, but it doesn't seem to work. 1t[example] 6. &nbsp;How can I increase the critical range to 19-20? Maybe changing that line&nbsp; --?[$AttackRoll.Base] -eq 20 |Crit &nbsp; &nbsp; to&nbsp; &nbsp; &nbsp; --?[$AttackRoll.Base] -&lt; 19 |Crit &nbsp; ¿?&nbsp; the script does not seem to recognize the command 1d20cs&gt;19 into the&nbsp; --=AttackRoll| 1d20 cs&gt;19 + @{selected|pb} [pb] + @{selected|strength_mod} [str] &nbsp; Here is the macro,&nbsp;some help on this would be appreciated :) !scriptcard {{ --#title|Longsword --#leftsub|Balanced, Versatile (1d10) --#emoteText|@{selected|token_name} attacks with its longsword! --#sourceToken|@{selected|token_id} --=AttackRoll| 1d20 + @{selected|pb} [pb] + @{selected|strength_mod} [str] --=AttackRoll2| 1d20 + @{selected|pb} [pb] + @{selected|strength_mod} [str] --+Attack| You roll a [$AttackRoll] or [$AttackRoll2] to hit! --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --^Done| --:Crit| --+Crit|``CRITICAL`` --^Done| --:Fumble| --+Fumble|``FUMBLE``. --^Done| --:FUNCTIONS| --:HasUses| --+Roll damage|[button]Damage::!&amp;#13;#(Sc)Astrid[/button] [button]Critical::!&amp;#13;#(Sc)Astrid2[/button] --:HasUses| --+Feature|[button]Divine Smite::!&amp;#13; #(Sc)Divine-Smite[/button] --:HasUses| --+Spell|[button]Divine Favor::!&amp;#13;#(Sc)Divine-Favor[/button] }} Thx in advc.&nbsp;
Rober M. said: 1. Is there any way to change the background color of a single button ?&nbsp;I have tried to change it, but they all change with buttonbackgroundColor. I only wants to change de Critical button (to red color #993333) near to the Damage button.&nbsp; 2. &nbsp;Is there any way to handle commands like this? [[ {[[1d8]]], 2}kh1 ]]. I'm trying to make the 1 on a die always be considered 2, but it doesn't seem to support this sequence.&nbsp; 3.&nbsp; For some reason, obviously my clumsiness since I still do not control the Scriptcards, I would like that when a natural 20 is rolled on the die, the Critical message is displayed, and with a natural 1, a Fumble. As I have it configured it always appears, and I don't know how to make it conditional. 4. &nbsp;I don't know if the Scriptcards supports or has any function to roll the 3d dice on the screen , but if not it would be very nice to have that functionality.....&nbsp; 5. &nbsp;Does Scriptcards allow to roll on rollable tables?&nbsp;I tried to do it for an attack roll, but it doesn't seem to work. 1t[example] Here is the macro,&nbsp;some help on this would be appreciated :) !scriptcard {{ --#title|Longsword --#leftsub|Versatile (1d10) --#emoteText|@{selected|token_name} attacks with its longsword! --#sourceToken|@{selected|token_id} --=AttackRoll| 1d20 + @{selected|pb} [pb] + @{selected|strength_mod} [str] --=AttackRoll2| 1d20 + @{selected|pb} + @{selected|strength_mod} --+Attack| You roll a [$AttackRoll] or [$AttackRoll2] to hit! --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --^X| --?Crit| --+Crit!|``CRITICAL`` --^X| --?Fumble| --+Fumble!|``FUMBLE`` --^X| --:FUNCTIONS| --:HasUses| --+Roll damage|[button]Damage::!&amp;#13;#(Sc)Astrid[/button] [button]Critical::!&amp;#13;#(Sc)Astrid2[/button] --:HasUses| --+Feature|[button]Divine Smite::!&amp;#13; #(Sc)Divine-Smite[/button] --:HasUses| --+Spell|[button]Divine Favor::!&amp;#13;#(Sc)Divine-Favor[/button] }} Thx in advc.&nbsp; I can answer some &nbsp;of these, I think. 2: ScriptCards does not support inline rolls like these because it uses its own dice parser, not Roll20's. Depending on exactly what you are trying to do, this should work: !scriptcard {{ --=Roll|1d8 --?[$Roll] -eq 1|&gt;Reroll --+Roll|[$Roll] --X| --:Reroll| --=Roll|2 --&lt;| }} For now at least, you'll need the conditional check because only these formats are supported: Format Pattern Example Description XdY 3d8 Simple format. Roll a Y-sided die X times XdYkhZ 2d20kh1 Roll Y-sided die X times and keep the highest Z number of dice XdYklZ 4d6kl3 Roll Y-sided die X times and keep the lowest Z number of dice XdY&gt;Z 5d6&gt;3 Roll Y-sided die X times and count a 1 for each roll greater than Z XdY&lt;Z 5d6&lt;3 Roll Y-sided die X times and count a 1 for each roll less than Z 3: For your "X" lines, you're using a branch command, which tells ScriptCards to "go to label X." What you is just --X| With no ^ I can see that it's not finished yet, but you have multiple labels with the same name in the end portion of your script--that's not going to work. 4: &nbsp;I believe the answer is no, because ScriptCards uses its own internal dice roll parser, rather than Roll20's. The same issue exists with PowerCards. I'm not a programmer, but it seems to me if it were possible, Kurt and co. would have figured it out (or perhaps they may yet still). 5: Rollable tables are supported, but they use different formatting. Rolling on Rollable Tables &nbsp;You can also roll on a rollable table using the expression [T#tablename], where tablename is the case-sensitive name of the table in your game. Proper weighting for each entry in the table is taken into account when rolling on rollable tables. The .tableEntryText and .tableEntryImgURL properties of the Roll Variable will be set to the matching values on the resultant table entry. That's from the wiki.
1613764035

Edited 1613767573
David M.
Pro
API Scripter
@Rober M: regarding (6), you would just use -ge for "greater than or equal to" (see available comparisons in the&nbsp; conditional statements &nbsp;part of the wiki) --?[$AttackRoll.Base] -ge 19|Crit I also think there is a little bit of confusion as to how functions (aka procedures) work. Normally, the scriptcard will go line by line until it hits the }} or if there is a --X| statement. If a goto is used (^BranchName), the parser skips to that branch label (--:BranchLabel) and continues down each line from there until it is branched again or ends. A function is called with --&gt;FuncName, or just &gt;FuncName if used as part of a conditional. When the parser hits that line, it skips down to the function label, executes the function, and then is told to return to the next line after the function was called. This return command is denoted by the --&lt;| at the end of the function. --:Crit| This is a function. When it hits the third line, it always returns to the line it was called --+Crit|``CRITICAL`` --&lt;| --:Crit| This is a branch label, it keeps going until the goto in the third line, which then skips to the --:Done branch label, wherever that is --+Crit|``CRITICAL`` --^Done| In your example, Crit and Fumble are just branch labels and not functions, because they have no return statement (--&lt;|). Also, your ^Done branch command doesn't do anything because there is no --:Done branch label anywhere. Here is how I would do it. See the difference in the CONDITIONAL OUTPUT block (e.g. using &gt;Crit). Note the functions are placed below the --X| line, which means they will only be called if some code tells them to with a &gt;Crit or &gt;Fumble. EDIT - Fixed the Fumble function label (was missing colon) !scriptcard {{ --#title|Longsword --#leftsub|Balanced, Versatile (1d10) --#emoteText|@{selected|token_name} attacks with its longsword! --#sourceToken|@{selected|token_id} --:ROLL DICE| --=AttackRoll| 1d20 + @{selected|pb} [pb] + @{selected|strength_mod} [str] --=AttackRoll2| 1d20 + @{selected|pb} [pb] + @{selected|strength_mod} [str] --+Attack| You roll a [$AttackRoll] or [$AttackRoll2] to hit! --:ALWAYS OUTPUT THESE LINES| --+Roll damage|[button]Damage::!&amp;#13;#(Sc)Astrid[/button] [button]Critical::!&amp;#13;#(Sc)Astrid2[/button] --+Feature|[button]Divine Smite::!&amp;#13; #(Sc)Divine-Smite[/button] --+Spell|[button]Divine Favor::!&amp;#13;#(Sc)Divine-Favor[/button] --:CONDITIONAL OUTPUT| --?[$AttackRoll.Base] -eq 20 -or [$AttackRoll2.Base] -eq 20|&gt;Crit --?[$AttackRoll.Base] -eq 1 -or [$AttackRoll2.Base] -eq 1|&gt;Fumble --X|End macro --:FUNCTIONS| --:Crit| --+Crit|``CRITICAL`` --&lt;| jump back to the conditional output line where this function was called --:Fumble| --+Fumble|``FUMBLE``. --&lt;| jump back to the conditional output line where this function was called }}
I'm trying to run a SpellMaster command through a scriptcard, and it's not working. I suspect the issue is the ^ character used by SpellMaster. Is there a way to render that character in an api call within a Scriptcard? !scriptcard {{&nbsp; &nbsp; --@SpellMaster _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ &nbsp; --+Come on, SpellMaster, work for me!| }} If you're wondering, I have tried it with&nbsp;@{selected|character_name} as part of the command (which SpellMaster doesn't need on its own) and haven't had any success either.
1613765589

Edited 1613778220
David M. said: --Fumble| --+Fumble|``FUMBLE``. --&lt;| jump back to the conditional output line where this function was called }} Thats works, thx a lot... Just a small error at the end&nbsp; -- : Fumble|
Feature Request: One of the things I liked about PowerCards was the various summaries programmed into the code. E.g., NPC Attribute Summary, NPC Qualities Summary, etc. It looks like it uses something like an HTML table to display some of that content? But that is not presently supported in Script Cards, right?
1613772836

Edited 1613778157
Colin C. said: Thx for the help :)
1613775655
David M.
Pro
API Scripter
Hey guys, love the dialog and sharing of ideas, but can we try to avoid quoting giant blocks of text from previous messages unless critical to your post? This thread is getting really bloated and it makes it harder to find stuff, forcing more page turns, etc. If needed, just include enough of the quote to let everyone know what you are talking about. Thanks!&nbsp;&nbsp;
David M. said: Hey guys, love the dialog and sharing of ideas, but can we try to avoid quoting giant blocks of text from previous messages unless critical to your post? This thread is getting really bloated and it makes it harder to find stuff, forcing more page turns, etc. If needed, just include enough of the quote to let everyone know what you are talking about. Thanks!&nbsp;&nbsp; Agreed. We should all try to quote only what we need to quote, and nothing more.
1613776247
Kurt J.
Pro
API Scripter
Colin C. said: Feature Request: One of the things I liked about PowerCards was the various summaries programmed into the code. E.g., NPC Attribute Summary, NPC Qualities Summary, etc. It looks like it uses something like an HTML table to display some of that content? But that is not presently supported in Script Cards, right? This is the kind of thing I'd like to support via Libraries. The PowerCards code was all geared towards D&amp;D 5E and the 5E OGL Sheet, so it was not useful to anyone not playing with that sheet. PowerCards also didn't have th ability to reference attributes and repeating sections the way ScriptCards does, so all of what was hard-coded into the API script in PowerCards can now be implemented as a library in ScriptCards so that things that support other games and sheets can be made available to everyone. I'll look at re-adding the table formatting commands that I added to PowerCards as inline formatting options in ScriptCards as those will be useful for any game.
1613776789

Edited 1613776836
Kurt J.
Pro
API Scripter
Rober M. said: 1. Is there any way to change the background color of a single button ?&nbsp;I have tried to change it, but they all change with buttonbackgroundColor. I only wants to change de Critical button (to red color #993333) near to the Damage button.&nbsp; 4. &nbsp;I don't know if the Scriptcards supports or has any function to roll the 3d dice on the screen , but if not it would be very nice to have that functionality.....&nbsp; David is right on for his answers, so I'll just elaborate on a couple of items: 1- Currently this isn't possible, but I agree that it isn't consistent with the way most other formatting in the script works. I'll take a look at what would be required to allow multiple button styles. 4- 3D dice are part of the internal QuantumRoll server, which ScriptCards doesn't use. It it is technically possible to have the API send 3D dice rolls to the VTT, but the results (the number shown on the die) will be a new die roll and the API won't know what it is.
1613778468

Edited 1613780875
Kurt J. said: 1- Currently this isn't possible, but I agree that it isn't consistent with the way most other formatting in the script works. I'll take a look at what would be required to allow multiple button styles. 4- 3D dice are part of the internal QuantumRoll server, which ScriptCards doesn't use. It it is technically possible to have the API send 3D dice rolls to the VTT, but the results (the number shown on the die) will be a new die roll and the API won't know what it is. 1-Great....&nbsp;It would be great to be able to customize the buttons, especially for cards where you gather different types of features, and you want to highlight them according to their usefulness.&nbsp; 4- wouldn't there be any way for the script to get the values from the QuantumRoll server?
1613780909

Edited 1613780938
GiGs
Pro
Sheet Author
API Scripter
Kurt J. said: Rober M. said: 4. &nbsp;I don't know if the Scriptcards supports or has any function to roll the 3d dice on the screen , but if not it would be very nice to have that functionality.....&nbsp; 4- 3D dice are part of the internal QuantumRoll server, which ScriptCards doesn't use. It it is technically possible to have the API send 3D dice rolls to the VTT, but the results (the number shown on the die) will be a new die roll and the API won't know what it is. It is possible to change your code to use QuantumRoll rolls, but getting 3d dice to work from the API tends to be flaky. I believe there's a bug right now that has existed for months, making 3d dice not show when they should, when triggered from the API. So I wouldnt recommend spending any development time on this until you have done everything else you want.
1613781693

Edited 1613781834
Then i think the best way is mix scriptcards with basic macros to roll the 3d dice (I will use scriptcards to make buttons to features like Divine Smite; Sneak Attack,... or clarifications) i think is the easiest solution. But I noticed one thing, when I create a token action, and put the scriptcards first and then the basic macro in the same token action, the basic macro is always resolved first, no matter the order, is there any way to make the scriptcards run first? !scriptcard {{ --#title| }} %{selected|repeating_attack_$0_attack}
1613845767

Edited 1613846061
Hey guys, any update about the immunities problem i have with the library tool? I have another question too, is there a way to reselect the ''attacking'' token automatically after i use a script like Longsword one (that need to select a different token)? Its kinda boring to loose selected token everytime.. Here's my script: !scriptcard {{ +++5E Tools+++ --#title|Thunder Gauntlets --#leftsub|Melee Attack --#rightsub|5ft range --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{selected|intelligence_mod} [INT] + @{selected|pb} [PROF] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --@roll20AM|_audio,play,nomenu|Epic Fail --^Final| --:Hit| --&gt;Lib5E_CheckDamageModifiers|ResistType;thunder --=Damage|1d8 + @{selected|intelligence_mod} [INT] [&amp;ResistType] --+Hit!|The attack hit @{target|token_name} for [$Damage] [b] [#990099] THUNDER [/#] [/b] damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --@token-mod|_ids @{target|token_id} _ignore-selected _set statusmarkers|all-for-one --^Final| --:Crit| --&gt;Lib5E_CheckDamageModifiers|ResistType;thunder --=Damage|1d8 + @{selected|intelligence_mod} [INT] + 1d8 [CRIT] [&amp;ResistType] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] [b] [#990099] THUNDER [/#] [/b] damage. --@roll20AM|_audio,play,nomenu|Thunder --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --@token-mod|_ids @{target|token_id} _ignore-selected _set statusmarkers|all-for-one --:Final| }}
1613848588
Kurt J.
Pro
API Scripter
Bicio said: Hey guys, any update about the immunities problem i have with the library tool? I have another question too, is there a way to reselect the ''attacking'' token automatically after i use a script like Longsword one (that need to select a different token)? Its kinda boring to loose selected token everytime.. I'm not having any issues with the immunities, with the NPCs you selected pulled right out of the compendium (5E OGL sheet, correct? Not the 5E community sheet?) As far as reselecting, the API can't do anything to select things on the VTT, so there is nothing ScriptCards can do about the targets becoming deselected, unfortunately. It is jus baked into Roll20 that way :(
1613848790

Edited 1613848853
Kurt J.
Pro
API Scripter
5E Tools Library Updated I've updated the 5E Tools library on the Wiki page to include a new procedure : Lib5E_Active_Global_Attack_Modifiers, which will summarize any checked (enabled) items in a character's global attack modifier list into a string that can be added to an attack roll to make include those values in the attack roll (thing like bane, bless, etc.). There was also a minor change to the Lib5E_FindResources procedure to rename a label from "ResourceLoop" to "_Lib5E_ResourceLoop", but shouldn't have any impact on existing scripts.
Jay R. said: I'm trying to run a SpellMaster command through a scriptcard, and it's not working. I suspect the issue is the ^ character used by SpellMaster. Is there a way to render that character in an api call within a Scriptcard? !scriptcard {{&nbsp; &nbsp; --@SpellMaster _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ &nbsp; --+Come on, SpellMaster, work for me!| }} If you're wondering, I have tried it with&nbsp;@{selected|character_name} as part of the command (which SpellMaster doesn't need on its own) and haven't had any success either. Just pushing this query back up in case it got lost in the other messages.
1613850887
Kurt J.
Pro
API Scripter
Jay R. said: Jay R. said: I'm trying to run a SpellMaster command through a scriptcard, and it's not working. I suspect the issue is the ^ character used by SpellMaster. Is there a way to render that character in an api call within a Scriptcard? !scriptcard {{&nbsp; &nbsp; --@SpellMaster _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ &nbsp; --+Come on, SpellMaster, work for me!| }} If you're wondering, I have tried it with&nbsp;@{selected|character_name} as part of the command (which SpellMaster doesn't need on its own) and haven't had any success either. Just pushing this query back up in case it got lost in the other messages. Assuming !spellmaster is the api command, you are missing a vertical bar after it: --@SpellMaster | _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ There shouldn't be any issues I'm aware of with caret characters (^)
Kurt J. said: Jay R. said: Jay R. said: I'm trying to run a SpellMaster command through a scriptcard, and it's not working. I suspect the issue is the ^ character used by SpellMaster. Is there a way to render that character in an api call within a Scriptcard? !scriptcard {{&nbsp; &nbsp; --@SpellMaster _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ &nbsp; --+Come on, SpellMaster, work for me!| }} If you're wondering, I have tried it with&nbsp;@{selected|character_name} as part of the command (which SpellMaster doesn't need on its own) and haven't had any success either. Just pushing this query back up in case it got lost in the other messages. Assuming !spellmaster is the api command, you are missing a vertical bar after it: --@SpellMaster | _UpdateBook ^Iorminas's Spells^ _SetSlots ^Full^ There shouldn't be any issues I'm aware of with caret characters (^) Ah! Thanks. I didn't realize those pipes were required at the end of the API command. I'll test that tonight.
1613894900

Edited 1613895050
I'm not sure if this is a bug or if I'm doing something wrong.&nbsp; I'm playing around with adding flags to a character sheet for different modifiers (Bane and Bless in this instance) and trying to build an attack roll off of them.&nbsp; When I look at the output for the positive modifier, the plus sign is missing. This is my code: !scriptcard {{ --=RollType|?{Roll Type?|Standard,1|Advantage,2|Disadvantage,3} --+Debug: RollType|[$RollType] --&amp;NbrDie|1 --?[$RollType] -eq 1|DoneWithDieNbr --&amp;NbrDie|2 --:DoneWithDieNbr| --+Debug: NbrDie|[&amp;NbrDie] --&amp;KeepRoll| --?[$RollType] -eq 1|DoneWithKeepRoll --?[$RollType] -eq 2|KeepAdv --?[$RollType] -eq 3|KeepDisadv --:KeepAdv| --&amp;KeepRoll|kh1 --^DoneWithKeepRoll| --:KeepDisadv| --&amp;KeepRoll|kl1 --^DoneWithKeepRoll| --:DoneWithKeepRoll| --+Debug: KeepRoll|[&amp;KeepRoll] --&amp;Bane| --?@{selected|bane_flag} -eq 0|DoneWithBane --&amp;Bane| - 1d4 [BANE] --:DoneWithBane| --+Debug: Bane|[&amp;Bane] --&amp;Bless| --?@{selected|bless_flag} -eq 0|DoneWithBless --&amp;Bless| + 1d4 [BLESS] --:DoneWithBless| --+Debug: Bless|[&amp;Bless] --&amp;AttackRollString|[&amp;NbrDie]d20[&amp;KeepRoll] + @{selected|strength_mod} [STR] + @{selected|pb} [PROF][&amp;Bless][&amp;Bane] --+Debug AttackRollString|[&amp;AttackRollString] --=Attack|[&amp;AttackRollString] --+Attack Roll|[$Attack] }} This is the output with both flags set to 1: When I hover over the Attack Roll number, I see this: The plus sign is still missing for the Bless modifier, and all other signs seem to be duplicated in the Result output.&nbsp; What do I need to change so that the plus sign will display for the Bless modifier, and the correct number of signs will show when hovered over?&nbsp; Hope this makes sense. Thanks&nbsp;
1613897391

Edited 1613897831
Kurt J. said: I'm not having any issues with the immunities, with the NPCs you selected pulled right out of the compendium (5E OGL sheet, correct? Not the 5E community sheet?) As far as reselecting, the API can't do anything to select things on the VTT, so there is nothing ScriptCards can do about the targets becoming deselected, unfortunately. It is jus baked into Roll20 that way :( Yes 5e OGL Sheet! When i attack a token with any immunities with that type of element the damage shows normally n alterbar decrease the hp normally too. With vulnerabilities or resistancies everything working instead. EDIT: I pasted again the&nbsp; "ScriptCards Library 5E Tools" &nbsp;n now everything working... maybe i made a mistake while pasting last time... im kinda embarassed now! Thank you, Kurt!
1613904917

Edited 1613904989
David M.
Pro
API Scripter
Phillip K. said: When I look at the output for the positive modifier, the plus sign is missing. The plus sign operator at the beginning of a string assignment means "append whatever comes next to the end of the existing string". So, when activating your Bless string, try this --&amp;Bless|+ +1d4 [BLESS]&nbsp; EDIT - forgot to mention, the duplicated +/- in the roll tooltip is a known bug that Kurt was looking into
1613907262

Edited 1613907712
Kurt J.
Pro
API Scripter
Phillip K. said: The plus sign is still missing for the Bless modifier, and all other signs seem to be duplicated in the Result output.&nbsp; What do I need to change so that the plus sign will display for the Bless modifier, and the correct number of signs will show when hovered over?&nbsp; Hope this makes sense. Thanks&nbsp; See David's answer above, as he is correct on both items. The duplicate symbol bug is fixed in my internal version and that fix will be included in the next release. If you are using the 5E Tools library, there is now a library function to handle global attack modifiers like bane and bless if you add them on the 5E character sheet.
Hi guys In my game the damage is dependent on the success. If [$Atk] &lt;= 0 then it's a fumble ! (Just an emote) if 0 &lt; [$Atk] &lt;= [$Def] then it's a failure. Nothing happens (Call Playeffects &amp; an emote) if [$Def] &lt; [$Atk] &lt; [$DblDef] then it's a light wound (Call Playeffects and Alterbars to decrease health by 2) if [$DblDef] &lt; [$Atk] &lt; [$TplDef] then it's a serious wound (Call Playeffects and Alterbars to decrease health by 4) if [$TplDef] &lt; [$Atk]&nbsp; then it's a mortal wound (Call Playeffects and Alterbars to decrease health by 6) For some reason my scriptcard doesn't seem to execute the conditionnal and I always goto serious wound (BM in my script) whatever my Atk.... Can you help me eout plz ? My script below : !scriptcard&nbsp; {{ &nbsp; --#title|Pistolet-Mitrailleur1 &nbsp; --#leftsub|Armes humaines &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#targetToken|@{target|token_id} &nbsp; --Rfind|[*S:character_id];Pistolet-Mitrailleur1;repeating_armement;aname &nbsp; --=ABonus|[*R:abonus] &nbsp; --=Atk|?{Score|0} [SCORE] + [*S:ArmesHumainesPJ_Bonus] [SPE] + [$ABonus] [ACQUIS] + ?{Bonus-Malus|0} [BONUS]&nbsp; + 1d1 - 1 &nbsp; --=Dbl|@{Target|DefCorpsTotalPJ}*2&nbsp; &nbsp; --=Tpl|@{Target|DefCorpsTotalPJ}*3 &nbsp; --#emoteText|[*S:character_name] attaque [*T:character_name] &nbsp; --Rfind|[*T:character_id];Bouclier;repeating_protection;ptype &nbsp; --=Def|[*T:corps] [CORPS] + [*T:totaldef_corps] [DEFENSE]+ [*R:pcorps] [COUVERT]&nbsp; &nbsp; --+Résultat|[Att] : [$Atk] vs [$Def] : [Def] &nbsp; &nbsp; --?[$Atk] gt [$Tpl]|BM &nbsp; --?[$Atk] gt [$Dbl] -and [$Atk] le [$Tpl.Total]|BG &nbsp; --?[$Atk] gt [$Def] -and [$Atk] le [$Dbl]|BL &nbsp; --?[$Atk] ge 0 -and [$Atk] le [$Def]|Echec &nbsp; --?[$Atk] lt 0|Fumble &nbsp; &nbsp; --:BM| &nbsp; --&gt;PlayEffects|none;splatter-blood;none;Flingue &nbsp; --&gt;ApplyDamageAlterbars|@{target|token_id};3;-6 &nbsp; --+BM|[*T:character_name] subit une Blessure mortelle&nbsp; &nbsp; --^Final| &nbsp;&nbsp; &nbsp; --:BG| &nbsp; --&gt;PlayEffects|none;splatter-blood;none;Flingue &nbsp; --&gt;ApplyDamageAlterbars|@{target|token_id};3;-4 &nbsp; --+BG|[*T:character_name] subit une Blessure grave&nbsp; &nbsp; --^Final| &nbsp;&nbsp; &nbsp; --:BL| &nbsp; --&gt;PlayEffects|none;splatter-blood;none;Flingue &nbsp; --&gt;ApplyDamageAlterbars|@{target|token_id};3;-2 &nbsp; --+BL|[*T:character_name] subit une Blessure légère&nbsp; &nbsp; --^Final| &nbsp;&nbsp; &nbsp; --:Echec|&nbsp; &nbsp; --&gt;PlayEffects|none;none;none;Flingue &nbsp; --+Echec|L'attaque échoue. &nbsp; --^Final| &nbsp; --:Fumble| &nbsp; --+Fumble|L'arme s'enraye et ne peux plus être utilisée du combat! &nbsp; --^Final| &nbsp; --:PlayEffects|Parameters are : source effect; target effect; line effect; sound effect &nbsp; --vtoken|@{selected|token_id} [%1%] &nbsp; --vtoken|@{target|token_id} [%2%] &nbsp; --vbetweentokens|@{selected|token_id} @{target|token_id} [%3%] &nbsp; --@roll20AM|_audio,play,nomenu|[%4%] &nbsp; --&lt;| &nbsp; --:ApplyDamageAlterbars| &nbsp; --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%] &nbsp; --&lt;| &nbsp;&nbsp; &nbsp; --:Final| }} &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
1613914011
Kurt J.
Pro
API Scripter
Mangouste said: Hi guys In my game the damage is dependent on the success. If [$Atk] &lt;= 0 then it's a fumble ! (Just an emote) if 0 &lt; [$Atk] &lt;= [$Def] then it's a failure. Nothing happens (Call Playeffects &amp; an emote) if [$Def] &lt; [$Atk] &lt; [$DblDef] then it's a light wound (Call Playeffects and Alterbars to decrease health by 2) if [$DblDef] &lt; [$Atk] &lt; [$TplDef] then it's a serious wound (Call Playeffects and Alterbars to decrease health by 4) if [$TplDef] &lt; [$Atk]&nbsp; then it's a mortal wound (Call Playeffects and Alterbars to decrease health by 6) For some reason my scriptcard doesn't seem to execute the conditionnal and I always goto serious wound (BM in my script) whatever my Atk.... Can you help me eout plz ? My script below : &nbsp; --?[$Atk] gt [$Tpl]|BM &nbsp; --?[$Atk] gt [$Dbl] -and [$Atk] le [$Tpl.Total]|BG &nbsp; --?[$Atk] gt [$Def] -and [$Atk] le [$Dbl]|BL &nbsp; --?[$Atk] ge 0 -and [$Atk] le [$Def]|Echec &nbsp; --?[$Atk] lt 0|Fumble &nbsp; The comparison operators are -gt, -ge, -lt, etc. You are missing the dash before them.
1613915940
Kurt J.
Pro
API Scripter
5E Tools Library Update - 0.0.5 I've updated the&nbsp; 5E Tools library &nbsp;on the Wiki page to include the following new procedures: Lib5E_Active_Global_Save_Modifiers Lib5E_Active_Global_Skill_Modifiers Lib5E_Active_Global_AC_Modifiers Lib5E_Active_Global_Damage_Modifiers These all function similarly to the Lib5E_Active_Global_Attack_Modifiers that was introduced in 0.0.4, with the exception of the Damage modifiers which requires two string parameters and sets the first one to the normal added damage and the second one to the additional &nbsp;damage that would be done on a critical hit. On a crit, the total added damage would be the addition of BOTH returned strings.
1613916678

Edited 1613919514
Kurt J.
Pro
API Scripter
ScriptCards v1.0.2 Version 1.0.2 of ScriptCards is now available on the development GIST . This version includes a handful of tweaks, and a major new feature: Bug Fix : The duplicative + and - signs in a roll's .Text property should now be removed properly. New Comparison Operator : -ninc is the opposite of -inc, or “not includes”. New Inline Formatting Code : [br] in an output string now adds a new line (&lt;br /&gt;) Behavior Change : Added explicit string variable substitution inside [*id:attribute] references (not the returned results – just the “id” and “attribute” portions of the reference) New Statement Type/Feature : A new statement type and feature that allows your script to pause and “ask” the user for additional input. The statement type is --i, and uses the Tag portion of the statement to define a prompt to the user and the caption of a button that will be displayed for the user to press to provide additional information. The content portion of the line is made up of a series of information request in the format “type;VariableName;PromptText”, with each request separate by double vertical bars. ScriptCards will use the display text and the button caption to whisper the script sender a message with a button to click that can ask for information via roll queries or ask for targets to be selected. Multiples of each type and combinations are allowed. The result of each information request will be stored in a string variable matching the “VariableName” parameter for that request. After the user has clicked the button and responded to the requests, ScriptCards will resume processing the script from where it left off. Here is an example “i” line: --IScriptCards needs additional information to continue;Click to select a target and provide information|t;MyNewTarget;Missile1Target||q;MyNameIs;What is your name? Supported information request types are “t” for target token, and “q” for query. For “t” types, specify the variable name to store the token ID in as the second parameter and the prompt text that will appear in the “Choose Target” window (i.e. Choose Target: Missile1Target above). For “q” types, specify the variable name to store the response in as the second parameter, and the text of the roll query without the ?{} identifiers. You can specify values for dropdowns, etc. For example: q;UserName;What is your name?|Fred|Bob|Sally|Nancy Would have a dropdown menu with four choices. Here is a GIF (Not sure why it is playing at about half speed!) of a revised version of the Magic Missile script that prompts the caster to select the appropriate number of targets. This version of the script itself is at the end of this post. Some Notes The API can’t output a string that causes a prompt to the user directly, hence the use of a button that the user can click to provide input and continue script execution. Because they are used as delimiters, semicolons can’t be used in your display text, button caption, variable names, target specifiers, or roll queries. Additionally, you cannot use double vertical bars (||) as this is a separator between request items. Finally, internally ScriptCards uses the sequence “-|-“ to separate items in the special command used to resume script execution. You CAN have multiple --i lines in a card, but be aware that users might find it tedious to keep clicking buttons to enter information. Try to front load any “always ask” items as roll queries in the original call to ScriptCards and only prompt for information if it becomes necessary based on conditional logic. You can also batch multiple requests into a single button so the user can answer all input questions at the same time. Internally, each suspended script is assigned a GUID number, so it should be possible for multiple users (or even the same user) to be running multiple ScriptCards awaiting input without interfering with each other. Suspended cards happen in memory, so restarting the sandbox or waiting between game sessions will not allow suspended cards to be resumed. Clicking an old button from the chat window will prompt for information, but won’t execute anything in ScriptCards. Here is the "Ask the User for Targets" version of the Magic Missile script: !scriptcard {{ --#title|Magic Missile --#sourceToken|@{selected|token_id} --&gt;GetAndCheckSlotInformation| --=MissileCount|[$SlotLevel] + 2 --&gt;BuildAndAskTargets|[$MissileCount.Total] --=DisplayCount|1 --=MissileDamage|0 --#leftsub|Slot level [$SlotLevel] --#rightsub|Ranged Attack --#emoteText|@{selected|character_name} uses a level [$SlotLevel.Total] spell slot to fire [$MissileCount.Total] missiles of magical force! --:MissileLoop| --&gt;FireMissile|[$DisplayCount.Total] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop --+Total|Total damage is [$MissileDamage] --&gt;DeductSpellSlot| --#rightsub|Level [$SlotLevel] Left: [$SlotsRemaining] --X| --:FireMissile| --&amp;ThisTarget|[&amp;target[%1%]] --=ThisMissile|1d4 + 1 --=MissileDamage|[$MissileDamage] + [$ThisMissile] --+Missile|[$DisplayCount.Total] Hits [*[&amp;ThisTarget]:character_name] for [$ThisMissile] [b]force[/b] damage --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic;spell_01 --&gt;ApplyDamageTokenmod|[*[&amp;ThisTarget]:character_id];3;-[$ThisMissile.Total] --&lt;| --:GetAndCheckSlotInformation| --=SlotLevel|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Total] -ge [$SlotsTotal.Total]|NoSlotsLeft --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --X| --:DeductSpellSlot| --=SlotsExpended|[$SlotsExpended] + 1 --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --&lt;| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --&lt;| --:ApplyDamageAlterbars| --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%] --&lt;| --:BuildAndAskTargets| --&amp;TargetString| --=targetCount|1 --:TargetLoop| --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator --?[$targetCount.Total] -le [%1%]|TargetLoop --iPlease click the button below to select magic missile targets. The same target can be selected multiple times;Select [%1%] Targets|[&amp;TargetString] --/| --&lt;| --:AddSeparator| --&amp;TargetString|+|| --&lt;| }}
Wow, Kurt, you are a beast of productivity! Looking forward to trying the new features out.
Kurt J. said: See David's answer above, as he is correct on both items. The duplicate symbol bug is fixed in my internal version and that fix will be included in the next release. If you are using the 5E Tools library, there is now a library function to handle global attack modifiers like bane and bless if you add them on the 5E character sheet. Thanks to both you and David for the help! I appreciate it! I've looked at the 5E Tools Library and it seems like something that would be very useful to the scripts I have in mind. Unfortunately, my programming skills are pretty rudimentary, so I haven't quite been able to wrap my head around how it works in practice. I will take a closer look and see if I can figure out how to start incorporating it.&nbsp; Thanks again for the fantastic script!
Phillip K. said: Kurt J. said: See David's answer above, as he is correct on both items. The duplicate symbol bug is fixed in my internal version and that fix will be included in the next release. If you are using the 5E Tools library, there is now a library function to handle global attack modifiers like bane and bless if you add them on the 5E character sheet. Thanks to both you and David for the help! I appreciate it! I've looked at the 5E Tools Library and it seems like something that would be very useful to the scripts I have in mind. Unfortunately, my programming skills are pretty rudimentary, so I haven't quite been able to wrap my head around how it works in practice. I will take a closer look and see if I can figure out how to start incorporating it.&nbsp; Thanks again for the fantastic script! You're not alone, Phillip. I too, not being a programmer, am having trouble figuring out how to use the 5E Tools library / understand how to integrate it into current scriptcards. I need to look closer and figure it out. It seems like it would be a powerful addition to my games.
1613929524

Edited 1613929737
Kurt J.
Pro
API Scripter
Jay R. said: Phillip K. said: Kurt J. said: See David's answer above, as he is correct on both items. The duplicate symbol bug is fixed in my internal version and that fix will be included in the next release. If you are using the 5E Tools library, there is now a library function to handle global attack modifiers like bane and bless if you add them on the 5E character sheet. Thanks to both you and David for the help! I appreciate it! I've looked at the 5E Tools Library and it seems like something that would be very useful to the scripts I have in mind. Unfortunately, my programming skills are pretty rudimentary, so I haven't quite been able to wrap my head around how it works in practice. I will take a closer look and see if I can figure out how to start incorporating it.&nbsp; Thanks again for the fantastic script! You're not alone, Phillip. I too, not being a programmer, am having trouble figuring out how to use the 5E Tools library / understand how to integrate it into current scriptcards. I need to look closer and figure it out. It seems like it would be a powerful addition to my games. Think of the library as a quick way to handle common tasks specific to the 5E OGL sheet so that you don't have to rewrite the code to do so into every one of your scripts. The library routines are written to be called as procedures with either a --&gt; statement or as the result of a conditional (--?something -eq something|&gt;CallProcedure) You pass parameters to them to specify the details of what you want to do. For example, the&nbsp; Lib5E_Active_Global_Attack_Modifiers procedure (they are all named with the Lib5E Prefix to avoid conflicting with things you put in your own script) goes through the "repeating_tohitmod" sections on a character (where you can put things like a 1d4 for bless, -1d4 for bane, etc.) and looks for the ones that are active (checked) and returns a string like '+ 1d4 [Bless]' so in an attack roll macro you could do something like: --&gt;Lib5E_Active_Global_Attack_Modifiers|@{selected|character_id};AttackMods --=AttackRoll|1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] [&amp;AttackMods] If there were any Global Attack Mods active on the character, they would be added to the roll. If there aren't, the string is empty and won't impact the roll. Similarly, the Lib5E_FindResource &nbsp;procedure makes it much easier to deal with character resources. You can call the procedure and give it the name of the resource you are looking for and get back the attribute name to interact with the resource a well as the current value: --&gt;Lib5E_FindResource|@{selected|character_id};Ki Points;KiAttr;KiValue After running this line, if the character had a resource named "Ki Points", the [&amp;KiAttr] variable will contain the attribute name (like "repeating_resource_-sdiu3udsnk1_left") for whatever resource is defined with the name "Ki Points", and [&amp;KiValue] will contain the number of Ki points the character has available. Because of the way the library routine is written, it will check for the two "standard" resources and the repeating resources and just give you back the value you are looking for. Basically, I want to make it possible to do the things that PCMHelper does for PowerCards (and more) with the ability to support any game system/sheet if folks are willing to develop libraries for them.
Kurt, I'm loving the new "i" option, at least conceptually (it's only existed for a few hours so I haven't got to use it just yet). This will also be really useful for AoEs, it can send prompts to affects PCs or to the GM to make a particular roll, or even automate that process for the GM and apply damage or whatever to affected tokens. Perhaps this is the wrong place to ask this question, but, for something like Fireball, which originates at a point in space, how could I identify that point as the center of the AoE? This would be useful for visual effects, but also for something like measuring distances between that point and nearby tokens to determine whether they are affected. ScriptCards may not able to handle the automated measuring without use input (i.e., telling the user to select possible targets). I don't know if Radar could do that, or maybe something like the PaladinAura script, which continuously checks distances?
1613955722
David M.
Pro
API Scripter
Destination squares really have to be relative to a token on the map. With the&nbsp; Spawn &nbsp;script, for example, you use either the selected token or a target token as the origin point, and specify an offset relative to that point. With the new SelectManager update discussed above, Spawn can now be called from scriptcards. I suppose Radar could be used if you placed an origin token first, but it's honestly easier to plop a full sized AoE token or a small one with an appropriately-sized aura.
I like the combination of Scriptcards and Spawn, and used it to make a Bag Of Tricks. What I wrote is a little "clunky," but it works the way it was intended. The only problem I've been having is adding a query for 1-3, and a loop. I tried adding one before and it would work with producing 1 creature, but wouldn't make 2 or three creatures. That's probably how I had it setup though. !scriptcard {{ --#titlecardbackground|#65D52A --#title|From The Bag Of Tricks --#sourceToken|@{selected|token_id} --=RollAnimal|1d8 --?[$RollAnimal] -eq 1|Weasel --?[$RollAnimal] -eq 2|GiantRat --?[$RollAnimal] -eq 3|Badger --?[$RollAnimal] -eq 4|Boar --?[$RollAnimal] -eq 5|Panther --?[$RollAnimal] -eq 6|GiantBadger --?[$RollAnimal] -eq 7|DireWolf --?[$RollAnimal] -eq 8|GiantElk --X| --:Weasel| --@forselected+|Spawn _name|weasel|_offset|0,1|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Weasel! --X| --:GiantRat| --@forselected+|Spawn _name|giant rat|_offset|0,2|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Giant Rat! --X| --:Badger| --@forselected+|Spawn _name|badger|_offset|0,3|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Badger! --X| --:Boar| --@forselected+|Spawn _name|boar|_offset|0,4|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Boar! --X| --:Panther| --@forselected+|Spawn _name|panther|_offset|1,0|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Panther! --X| --:GiantBadger| --@forselected+|Spawn _name|giant badger|_offset|2,0|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Giant Badger! --X| --:DireWolf| --@forselected+|Spawn _name|dire wolf|_offset|3,0|_size| 2,2|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Dire Wolf! --X| --:GiantElk| --@forselected+|Spawn _name|giant elk|_offset|4,0|_size| 3,3|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --#emoteText|@{selected|token_name} pulls out a Giant Elk! --X| }}
1614018280
David M.
Pro
API Scripter
DM Goss, Regarding your loop attempt: it seems that there is only 1 emote currently allowed per scriptcard. Would something like the following work for you? It has one emote, then line items for each of the creatures pulled out of the bag. I also changed the creature spawn blocks into functions, as the --X| at the end of each would stop the parser mid-way otherwise. !scriptcard {{ --#titlecardbackground|#65D52A --#title|From The Bag Of Tricks --#sourceToken|@{selected|token_id} --#emoteText|@{selected|token_name} reaches into a Bag of Tricks! --=NumCreatures|?{How many Creatures?|1,1|2,2|3,3} --=Counter|0 --:RollAnimalLoop| --=Counter|[$Counter]+1 --=RollAnimal|1d8 --?[$RollAnimal] -eq 1|&gt;Weasel --?[$RollAnimal] -eq 2|&gt;GiantRat --?[$RollAnimal] -eq 3|&gt;Badger --?[$RollAnimal] -eq 4|&gt;Boar --?[$RollAnimal] -eq 5|&gt;Panther --?[$RollAnimal] -eq 6|&gt;GiantBadger --?[$RollAnimal] -eq 7|&gt;DireWolf --?[$RollAnimal] -eq 8|&gt;GiantElk --?[$Counter.Total] -lt [$NumCreatures.Total]|RollAnimalLoop --X| --:Weasel| --@forselected+|Spawn _name|weasel _offset|0,1 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Weasel! --&lt;| --:GiantRat| --@forselected+|Spawn _name|giant rat _offset|0,2 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Giant Rat! --&lt;| --:Badger| --@forselected+|Spawn _name|badger _offset|0,3 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Badger! --&lt;| --:Boar| --@forselected+|Spawn _name|boar _offset|0,4 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Boar! --&lt;| --:Panther| --@forselected+|Spawn _name|panther _offset|1,0 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Panther! --&lt;| --:GiantBadger| --@forselected+|Spawn _name|giant badger _offset|2,0 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Giant Badger! --&lt;| --:DireWolf| --@forselected+|Spawn _name|dire wolf _offset|3,0 _size| 2,2 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Dire Wolf! --&lt;| --:GiantElk| --@forselected+|Spawn _name|giant elk _offset|4,0 _size| 3,3 _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+Pull [$Counter]|@{selected|token_name} pulls out a Giant Elk! --&lt;| }}
1614018614

Edited 1614018631
Kurt J.
Pro
API Scripter
David M. said: DM Goss, Regarding your loop attempt: it seems that there is only 1 emote currently allowed per scriptcard. Would something like the following work for you? It has one emote, then line items for each of the creatures pulled out of the bag. I also changed the creature spawn blocks into functions, as the --X| at the end of each would stop the parser mid-way otherwise. Multiple #emotetext settings are OK, but only the last one executed shows on the card.
1614018917

Edited 1614018950
David M.
Pro
API Scripter
Ah, thanks for the clarification, Kurt. DM Goss, I suppose then another solution if you really wanted the names listed in the emote rather than the body of the card would be to create a string variable for creature names, appending to it in the individual functions (with a preceding comma if the counter was greater than 1), and having the emoteText reference that string variable.
David M. That's exactly what I was trying to do. Thanks.
David M. said: Destination squares really have to be relative to a token on the map. With the&nbsp; Spawn &nbsp;script, for example, you use either the selected token or a target token as the origin point, and specify an offset relative to that point. With the new SelectManager update discussed above, Spawn can now be called from scriptcards. I suppose Radar could be used if you placed an origin token first, but it's honestly easier to plop a full sized AoE token or a small one with an appropriately-sized aura. Hmmm, how about if I give my caster an AoE token to drop on the map at the right point and then measure from that token? I think that could work.