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 - Thread #2

So the double colon syntax was changed fairly quickly after it was added since double colons were already used so triple colon is the syntax. Per the changelog : v 2.6.4  - Changed the default specifier for [*...] references from :: to ::: to not interfere with staus marker names.            NOTE: this may be a breaking change if your scripts currently use :: It was mentioned in this thread in a previous post  from Kurt. The wiki authentication was broken for a very long time so that prevented updates to it but that was recently fixed so there will need to be updates to catch up on bugfixes and new features over the last few months when the wiki was broken.
Thanks for the info. I didn't realize that the wiki was outdated, and didn't even think to look at the changelog. Three colons works great!
I'm trying to use conditional in Scriptcard for applying different sound, but it's not working. What have I type wrong?  --?@{selected|zip} -eq 0| [  --a|zip] --? @{selected|zip} -eq 1 | [  --a|car] --] --? @{selected|zip} -eq 2 | [  --a|moto] --]
Hey LU, Your API console probably contains some warnings and errors about that section of code you have there. If you want to use a code block you have to close the code block `--]|`. You aren't closing the code blocks. You are also sending the strings zip], car], and moto]. This is a cleaned up version of what you have there. !script {{ --?@{selected|zip} -eq 0|[ --a|zip --]| --?@{selected|zip} -eq 1 |[ --a|car --]| --?@{selected|zip} -eq 2 |[ --a|moto --]| }} An alternative would be to use a case statement  to accomplish the same thing in a single line for multiple conditions like you have: !script {{ --c@{selected|zip}|0:>PlayAudio;zip|1:>PlayAudio;car|2:>PlayAudio;moto --:Done| --X| --:PlayAudio|audiotrack --a|[%1%] --^Done| }} That will send zip, car, or moto to the PlayAudio  procedure  and play the sent track depending on the value of the selected token's zip attribute. LU MASTER said: I'm trying to use conditional in Scriptcard for applying different sound, but it's not working. What have I type wrong?  --?@{selected|zip} -eq 0| [  --a|zip] --? @{selected|zip} -eq 1 | [  --a|car] --] --? @{selected|zip} -eq 2 | [  --a|moto] --]
Thank you for your help, Joshua!
1719201069

Edited 1719211601
I'm trying to replace Roll20's Target with a target using ScriptCard. !script {{   --iNeed target for Horrid Reality;Click to select a target |t;tarid; Target for Horrid Reality   --&ctar|[*[&tarid]:character_name]   --&tar|[*[&tarid]:token_name]   --&cid|[*[&tarid]:character_id]   --#title|[&ctar] vs [&tar]   --#leftSub|[&tarid]   --+| cid=[&cid]   --+| [&SC_VERSION_NUMERIC] }} Unfortunately I get this result: Deputy vs undefined -O0-cLzWFZjwhlIlGi4P cid=-NP4Yu_T0kueoDCBQM4r 207100 Looking at the Mod Output Console I see that it is looking at the character ID instead of the token ID. That is I get 'undefined' for token_name because it is looking at the character ID even though tarid is the token ID but the Console complains  it can't find token_name at the character ID sheet field or attribute. Deputy is a mook and I need to know that  the token is Deputy2. When I use target on Roll20 it gives me the token name. Is there a way to get the token name using ScriptCard? As you can see I have the latest ScriptCard version.
Hey James, ScriptCards attribute and token property referencing  uses the prefix t- for token properties . So if you want to find the token name you'd use: --&tar|[*[&tarid]:t-name] ScriptCards referencing without the t- prefix will look for  character attributes . But with the t- it will look for the token property.
Thank you, Joshua. I had tried that but I got confused and had used t_name instead of t-name.
1719352732

Edited 1719352866
Hello everyone, I have a quick dumb question: is there a way to make only a GM output appear in the chat? I want to first display a small description with a GM output that I read out, and then use a Reentrant button to reveal the rest of the script which includes actions for the players. However, every time the output message appears, there is always an extra message that shows up, even when I use hideTitleCard (see picture, the black line). Is there a trick to avoid this? It's purely an 'aesthetic' concern, not a big deal, I can do without that. This is an example of the structure I use to do that : !scriptcard {{ --#hideTitleCard| --*Description :|Blabla [rbutton]Actions Player::Start[/rbutton] --X| --:Start| --+ Attack :|[button:#FFFFFF:#66482d]Attack::!attack-roll[/button] --+ Run :|[button:#FFFFFF:#66482d]Run::!coward-roll[/button] --X| }}
1719355059
Kurt J.
Pro
API Scripter
Atlas said: Hello everyone, I have a quick dumb question: is there a way to make only a GM output appear in the chat? I want to first display a small description with a GM output that I read out, and then use a Reentrant button to reveal the rest of the script which includes actions for the players. However, every time the output message appears, there is always an extra message that shows up, even when I use hideTitleCard (see picture, the black line). Is there a trick to avoid this? It's purely an 'aesthetic' concern, not a big deal, I can do without that. This is an example of the structure I use to do that : !scriptcard {{ --#hideTitleCard| --*Description :|Blabla [rbutton]Actions Player::Start[/rbutton] --X| --:Start| --+ Attack :|[button:#FFFFFF:#66482d]Attack::!attack-roll[/button] --+ Run :|[button:#FFFFFF:#66482d]Run::!coward-roll[/button] --X| }} There is indeed. You can set the tableborder setting at the top of the card and reset it in the :Start section: !scriptcard  {{ --#hideTitleCard|1 --#tableborder|0px --*Description :|Blabla [rbutton]Actions Player::Start[/rbutton] --X| --:Start| --#tableborder|2px solid #000000         --/|system;dropoutputlines;gm --+ Attack :|[button:#FFFFFF:#66482d]Attack::!attack-roll[/button] --+ Run :|[button:#FFFFFF:#66482d]Run::!coward-roll[/button] --X| }}
Nice, thank you for your answer !
1719841164

Edited 1719844684
hello. I continue to have problem with conditional. I want to spawn a fumble, but I cannot understand how I do it. I'm not using d&amp;d. What i'm trying to do is to spawn a "Fumble" section whenever the base Skill roll base is zero. Also the section should have a text and a button. Also, i'd like to add a D.C. and a different output based on Success and Fail, but really, i cannot understand how to do it, nor how I should use the --^Final !script{{ --#titlecardbackground|#a00327 &nbsp;--#titlefontface|Kaushan Script &nbsp;--#titlefontsize|1.4em &nbsp;--#buttonFontFace|Kaushan Script &nbsp; --#bodybackgroundimage| url("<a href="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/The%20One%20Ring/assets/images/parchment.jpg" rel="nofollow">https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/The%20One%20Ring/assets/images/parchment.jpg</a>"); --#bodyFontSize| 13px &nbsp; --#bodyfontface|Kaushan Script &nbsp;--#whisper|self --#Title|Medicina (Primo Intervento) --#leftsub|@{selected|character_name} --#rightsub| Abilità [hr #a90329] &nbsp; --=Skill| 1d10!+@{selected|Spiritoselvaggio_Skill}+@{selected|Tech} --+•[u][F:times new roman:17]Roll:[/F][/u]|[$Skill] &nbsp; --?[$Skill.Base] -eq 1|Fumble &nbsp; --:Fumble| &nbsp; --+Fumble!|The attack went horribly wrong. }} That was the formula when I used Powercard: --Roll|[[ [$Atk] 1d10!+@{Selected|repeating_techskills_$11_OtherTech_Skill}+@{selected|Tech}]] --?? $Atk.base == 1 ?? ***FUMBLE!***| Il paziente subisce un [Impedimenti](!#Impedimenti). Se ha già un'*Impedimento*, questo si trasforma in *Mutilazione* ~~~ --C.D.| [[ [$R] 1D0+45 - @{target|bar3}]] --?? $Atk &gt;= $R ?? Successo!| +2 pf immediati e giorni successivi ~~~ --?? $Atk &lt; $R ?? Fallimento!| -2 pf immediati
LU MASTER, Sorry I never used Powercards so I'm sort of interpretting here with some possible incorrect assumptions. Are you wanting to set a DC for the skill roll of 45 minus whatever the Target's bar3 value is? So the process would be select a token, choose a target, roll a d10, if the d10 roll is a 1, then it's a fumble. If the d10 roll is any other result but 1, then add the appropriate modifiers and compare it the DC of 45 minus target's bar3 value to determine success or fail. Is that understand correct for what you are trying to accomplish? Also you don't ever have to use a GOTO like --^Final if you don't want to. ScriptCards is processed from the top down and so if you want to have a conditional flow, there are ways to do that but if you never want to jump to a label name --:Final| then you never need to. There are lots of ways to stop processing a ScriptCard. Probably the main being --X| So with those assumptions above, here is a way to do conditional and move to various branches. This does not include your formatting settings. I removed those for simplicity reasons but you can add them back in. !script{{ --&amp;TargetBar|3 --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#whisper|self --#title|Medicina (Primo Intervento) --#leftsub|[*S:character_name] --#rightsub| Abilità --=Skill|1d10 + [*S:Spiritoselvaggio_Skill] [SKILL] + [*S:Tech] [TECH] --+|[$Skill] --?[$Skill.Base] -eq 1|Fumble --=DC|45 - [*T:t-bar[&amp;TargetBar]_value] --?[$Skill] -ge [$DC]|Success|Failure --:Done| --X| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Done| --:Success| --+Success|The attack [$Skill] was a successfully above or equal to [$DC] --^Done| --:Failure| --+Failure|The attack [$Skill] failed to be above [$DC] --^Done| }} So the code above checks if the d10 roll is a 1 and moves to the fumble branch if so. If it's not a fumble, then it calculates the DC with the Target's bar3_value and compares the Skill roll variable to the DC. If greater or equal, jump to the Success branch, else jump to the Failure branch. In this case the Fumble, Success, and Failure branches all have a GOTO to jump to the --:Done| label but that's just something I do to make it obvious to me these branches end the ScriptCard. All of those --^Done| lines could be replaced with --X| and it would function the same. Let me know if you need clarification on anything or if I totally missed the mark in what you were trying to accomplish.
1719864892

Edited 1719864945
Joshua, that was exactly was i was talking about. Sorry if I wasn't clearer, and thank you so much! I hadn't catch the fact that Scriptcards are so 'strict' about the code's reading order
I need some help here, because I'm a "copy-paster" and thick as a brick wall when it comes to scripting/coding. I have this macro that I really want to look nice, and thought that this API might help me do that. I just don't know how to go about it. Is there a helpful soul who can "translate" this into a usable code for this API? &amp;{template:default} {{name=Reroll}} {{Number of dice=?{Dice|1|2|3|4|5|6|7|8|9|10}}} {{[1](#)=[[1t[d8]]]}} {{[[[{2,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{3,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{4,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{5,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{6,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{7,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{8,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{9,?{Dice}}kl1]]](#)=[[1t[d8]]]}} {{[[[{10,?{Dice}}kl1]]](#)=[[1t[d8]]]}} Don't know if it's possible, but basically it's just a query to roll an adjustable amount of times from the same rollable table, with individually lined outcomes. Thanks in advance for any help
Hello Kasper, So here is a ScriptCards version that will use the same roll query ?{} from your macro above to query for the number of times to roll on the table and then roll on the table in the --&amp;tableName| string variable , displaying each roll on a new output line. !script {{ --&amp;tableName|d8 --#title|Reroll --&amp;NumberOfRolls|?{Dice|1|2|3|4|5|6|7|8|9|10} --%i|1;[&amp;NumberOfRolls];1 --=tableRoll|[T#[&amp;tableName]] --+Roll [&amp;i]|[$tableRoll.tableEntryText] --%| }} In the example above I set --&amp;tableName| string variable to d8 but you can change d8 to whatever table name you would like. Let me know if have any questions. Hope that helps.
I am attempting to allow a PC to possess an NPC using ScriptCards and token-mod. The line intended to do this is: &nbsp; --@token-mod|&nbsp; _ignore-selected _ids [&amp;tarid] _set represents|[&amp;Nameid] controlledby|[&amp;Nameid] Nameid is the SelectedCharacter_id,&nbsp; tarid is the TargetTokenID. To enable the PC to have access to her abilities (some or all should be available depending on the roll,)&nbsp; I am trying to change the TargetToken's "represents" to the PC character and, to allow the PC to control the NPC token, I am trying to change "controlledby" to the PC character. When I run it using a different e-mail on Firefox to act as purely a player, my PC runs the possession but cannot select or control the token. While I cannot select the token I can left click and open "Token Settings ," which is not normally possible on an unselectable token,&nbsp; and from there I can open the character sheet. When I open the token's character sheet on Firefox it does show the PC sheet as it should but when I click edit on the PC Sheet bio&amp;info it doesn't show the&nbsp; "Can Be Edited &amp; Controlled By" (normal .) Going to my GM display on Chrome the same token shows the PC character sheet and edit on bio&amp;info shows "Can Be Edited &amp; Controlled By" with the PC being the controller. The tokens on both the Firefox screen and the Chrome screen show the same ids, as they should. According to the token sheet on Chrome "Controlled By (Determined by Character settings)" and it shows the PC as "Represents Character." (Perhaps then the " controlledby|[&amp;Nameid]" in token-mod is redundent?) &nbsp;Yet the PC (on Firefox) can't select or move the token. The API Sandbox shows no issues. TokenMod is set to Players can IDs. I have timmaugh's complete MetaScriptToolbox in my Mod Library though I am mystified by its magic. What am I doing wrong?
Hi James, So if your player has controlledby for the original character and you want to change the NPC token to link to the original character you could use something like: !script {{ --#title|Possession --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --!graphic:[*T:t-id]|represents:[*S:t-represents] --+[*T:t-name]|has been possessed by [*S:t-name] }} Running that with a player account takes gives control over the NPC token after running that ScriptCard. No changes to controlledby are necessary there. Let me know if I'm misunderstanding what your goal is or if you have any questions. In this case, it doesn't seem like you need TokenMod and can just use ScriptCards object modification directly.
1720070218

Edited 1720090939
Thanks a bunch Joshua!
I think I've figured it out. I need to put = before the IDs (and apparently can use names instead.) &nbsp;--@token-mod|&nbsp; _ignore-selected _ids [&amp;tarid] _set represents|=[&amp;Nameid] controlledby|=[&amp;Nameid] or &nbsp;--@token-mod|&nbsp; _ignore-selected _ids [&amp;tarid] _set represents|=[&amp;Name] controlledby|=[&amp;Name] Need to check whether controlledby is needed.
Sorry I missed your reply Joshua. I will have to check it out and see if that does what I want instead. I am using a reentrant script to the GM to allow a return to the body. Perhaps I can send the reentry to the possessor. Thank you for a whole new way of thinking about it!
1720118390

Edited 1720118515
Joshua, I just tried your suggestion and I got the result you described. However when I tried to selected the possessed token, I could not select it. It reacted exactly as I described in the token-mod example without the '=', any ideas on how to change your script to allow selection of the possessed token? Since I have figured out how to do it using token-mod, I don't need it so don't spend time if nothing occurs, but your way seems cleaner to me.
So I guess it all depends on setup but if you wanted to have the player that runs the ScriptCard put into the controlledby you could add it to the object modification line !script {{ --#title|Possession --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --!graphic:[*T:t-id]|represents:[*S:t-represents]|controlledby:[&amp;SendingPlayerID] --+[*T:t-name]|has been possessed by [*S:t-name] }} That would set the selected character id to the target token and set the controlledby property to the sending player as well. I didn't need to do that in my setup as the controlledby was linked to the character already but that line seems to be what your token-mod lines are doing. Obviously this can be changed to not use selected and target tokens as you need but this was a basic example without shelling out to token-mod.
1720393464

Edited 1720400692
Sorry to be so slow to respond, was away for holiday. Thank you again for your kind assistance. Unfortunately this still doesn't work when I run it as a pure player in Firefox.&nbsp; I'm puzzled why "controlledby" needs to be changed anyway. By changing "represents" to the player character that should change "controlledby" to whoever controls the player character should it not? Obviously my pure player controls its own player character and the note on the token sheet is that the token is that "controlledby" is set by "represents." (However it also says the bars show what the new&nbsp; 'represents' show--which they do not. So ???) It also turns out that the '=' has been giving me inconsistent results. Rather it has seemed to, I've been changing so many things trying to get everything working together that I'm no longer sure what worked originally.&nbsp; I'm going to have to simplify things in a small program and then follow a written plan. Did that and&nbsp; "represents|[&amp;Nameid]" assigns the possessor to the token. Still haven't found the key to full control. I can't select the token but when I double click on it the token sheet opens which does not happen when I double click other tokens. So I have some slight control which may perhaps indicate to someone more knowledgable what is missing.
Yeah. In my setup, I didn't need to change the controlledby. I just change the represents to the character and that character's controlledby is used. I can't reproduce your issue. It works for me with my test player account. I don't even have a plausible reason as to why it wouldn't work for you. Not sure how your setup could be different enough that it wouldn't work for you when it just works for me.
1720829705

Edited 1720829946
Kurt J.
Pro
API Scripter
ScriptCards 2.7.25 is Live on OneClick Updates since 2.7.10: Expanded array;pagetokens filter syntax to allow multiple filter values and attribute whole/partial filtering New array function: fromrepeatingsection, which will create a hashtable of the content of a repeating section on a given character. The required parameters are a character ID, the name of the repeating section, the field in the repeating section that identifies the row, and the name of the hashtable. Added support for add:character and change:character events as Triggers. Your trigger for add:character will receive [&amp;CharAdded], containing the ID of the added char. For change:character you will receive [&amp;CharChanged] with the char id and the series of [&amp;CharOld...] and [&amp;CharNew...] for properties that changed as with other triggers. Creating a has from a repeating section now includes a _sectionid attribute Added hashtable function: fromrepeatingrow, which will create a hashtable of the content of a repeating section row on a given character. The required parameters are a character ID, the name of the repeating section, the section row id, and the name of the hashtable. array;statusmarkers will now exclude anything that is actually empty in the statusmarkers list Added the ability to have multiple triggers for the same event. Added "hash" to system;dumpvariables (ie, --~|system;dumpvariables;hash) to show all hash tables Updated trigger attribute creation to handle entities with -- in their text. No changes needed to trigger scripts. New referencing syntax that allows a conditional to be used inline as part of a variable reference by using [?...]. The syntax is [?condition|TrueResult|FalseResult] Fixed issues with Destroy triggers not properly returning all properties Added "-csinc" and "-csninc" to the list of valid conditional operators. These are case sensitive versions of -inc and -ninc respectively. Updated the "+" and "*" options for conditionals to output something so it won't duplicate the text in the tag and content if there is not a ";" in the string, which were also including the + or * character. This also lets me push an update to the 5E Character Action Menu ScriptCard (&nbsp; ScriptCards/ScriptCards_Examples/dnd5e/5e_Character_Action_Menu.scard at main · kjaegers/ScriptCards (github.com) &nbsp;) which makes use of some of these new features
Joshua N. said: Hello Kasper, So here is a ScriptCards version that will use the same roll query ?{} from your macro above to query for the number of times to roll on the table and then roll on the table in the --&amp;tableName| string variable , displaying each roll on a new output line. !script {{ --&amp;tableName|d8 --#title|Reroll --&amp;NumberOfRolls|?{Dice|1|2|3|4|5|6|7|8|9|10} --%i|1;[&amp;NumberOfRolls];1 --=tableRoll|[T#[&amp;tableName]] --+Roll [&amp;i]|[$tableRoll.tableEntryText] --%| }} In the example above I set --&amp;tableName| string variable to d8 but you can change d8 to whatever table name you would like. Let me know if have any questions. Hope that helps. Just a quick follow-up question: Is there any way to make it also show an image from the rollable table either instead of the text, or preferably alongside the text?
Just a quick follow-up question: Is there any way to make it also show an image from the rollable table either instead of the text, or preferably alongside the text? Yes. ScriptCards rollable table &nbsp;rolls have access to the text like above .tableEntryText and also any images .tableEntryImgURL Note that Roll20's chat processing when it comes to images can be odd and cause the scrolling to be off. Also there may still be a restriction on the image links with the API being images from your library. That is the case with imgsrc and avatar properties and the API .
1721180469

Edited 1721181240
Joshua N. said: Just a quick follow-up question: Is there any way to make it also show an image from the rollable table either instead of the text, or preferably alongside the text? Yes. ScriptCards rollable table &nbsp;rolls have access to the text like above .tableEntryText and also any images .tableEntryImgURL Note that Roll20's chat processing when it comes to images can be odd and cause the scrolling to be off. Also there may still be a restriction on the image links with the API being images from your library. That is the case with imgsrc and avatar properties and the API . Thanks for the quick response! I have no knowledge on how to implement it though, and my guess of just adding the line --+Roll [&amp;i]|[$tableRoll.tableEntryImgURL] underneath the other line didn't work, as it now only rolls 1 time, no matter how many I set it to roll, even if I replace the tableEntry to Img instead of Text. It does show the image though in both cases
1721186957

Edited 1721188783
So ScriptCards will process the loop and send the content tag for each one but it seems that Roll20 isn't displaying the others. I am not sure why that would be. !script {{ --&amp;tableName|corman-token --#title|Reroll --&amp;NumberOfRolls|?{Dice|1|2|3|4|5|6|7|8|9|10} --%i|1;[&amp;NumberOfRolls];1 --=tableRoll|[T#[&amp;tableName]] --+Roll [&amp;i]|[$tableRoll.tableEntryText] --+|[$tableRoll.tableEntryImgURL] --%| }} Running that ScriptCard with debug ouptut shows that 3 rolls take place with Roll1 being the Old Man image and rolls 2 and 3 being Orc but you are correct that the chat output only shows the first roll and seems to cut off after the first image. "Setting parameter debug to value 1 - 1" "Line Counter: 2, Tag:&amp;tableName, Content:corman-token" "Line Counter: 3, Tag:#title, Content:Reroll" "Setting parameter title to value Reroll - Reroll" "Line Counter: 4, Tag:&amp;NumberOfRolls, Content:3" "ContentIn: 1;[&amp;NumberOfRolls];1 Match: [&amp;NumberOfRolls], vName: NumberOfRolls, replacement 3" "Line Counter: 5, Tag:%i, Content:1;3;1" "ScriptCards: Info - Beginning of loop i" "ContentIn: [T#[&amp;tableName]] Match: [&amp;tableName], vName: tableName, replacement corman-token" "Line Counter: 6, Tag:=tableRoll, Content:[T#corman-token]" "ContentIn: +Roll [&amp;i] Match: [&amp;i], vName: i, replacement 1" "ContentIn: [$tableRoll.tableEntryText] Match: [$tableRoll.tableEntryText], vName: tableRoll, vSuffix: tableEntryText, replacement Old Man" "Line Counter: 7, Tag:+Roll 1, Content:Old Man" "ContentIn: [$tableRoll.tableEntryImgURL] Match: [$tableRoll.tableEntryImgURL], vName: tableRoll, vSuffix: tableEntryImgURL, replacement <a href="https://s3.amazonaws.com/files.d20.io/images/359432944/SjqxP6MiAjN4snp3CBZibQ/max.png?1694970832" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359432944/SjqxP6MiAjN4snp3CBZibQ/max.png?1694970832</a>" "Line Counter: 8, Tag:+, Content:<a href="https://s3.amazonaws.com/files.d20.io/images/359432944/SjqxP6MiAjN4snp3CBZibQ/max.png?1694970832" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359432944/SjqxP6MiAjN4snp3CBZibQ/max.png?1694970832</a>" "Line Counter: 9, Tag:%, Content:" "ContentIn: [T#[&amp;tableName]] Match: [&amp;tableName], vName: tableName, replacement corman-token" "Line Counter: 6, Tag:=tableRoll, Content:[T#corman-token]" "ContentIn: +Roll [&amp;i] Match: [&amp;i], vName: i, replacement 2" "ContentIn: [$tableRoll.tableEntryText] Match: [$tableRoll.tableEntryText], vName: tableRoll, vSuffix: tableEntryText, replacement Orc" "Line Counter: 7, Tag:+Roll 2, Content:Orc" "ContentIn: [$tableRoll.tableEntryImgURL] Match: [$tableRoll.tableEntryImgURL], vName: tableRoll, vSuffix: tableEntryImgURL, replacement <a href="https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983</a>" "Line Counter: 8, Tag:+, Content:<a href="https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983</a>" "Line Counter: 9, Tag:%, Content:" "ContentIn: [T#[&amp;tableName]] Match: [&amp;tableName], vName: tableName, replacement corman-token" "Line Counter: 6, Tag:=tableRoll, Content:[T#corman-token]" "ContentIn: +Roll [&amp;i] Match: [&amp;i], vName: i, replacement 3" "ContentIn: [$tableRoll.tableEntryText] Match: [$tableRoll.tableEntryText], vName: tableRoll, vSuffix: tableEntryText, replacement Orc" "Line Counter: 7, Tag:+Roll 3, Content:Orc" "ContentIn: [$tableRoll.tableEntryImgURL] Match: [$tableRoll.tableEntryImgURL], vName: tableRoll, vSuffix: tableEntryImgURL, replacement <a href="https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983</a>" "Line Counter: 8, Tag:+, Content:<a href="https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983</a>" "Line Counter: 9, Tag:%, Content:" "ScriptCards: Info - End of loop i" Interestingly enough changing the ScriptCard to have the URL after a line break !script {{ --&amp;tableName|corman-token --#title|Reroll --&amp;NumberOfRolls|?{Dice|1|2|3|4|5|6|7|8|9|10} --%i|1;[&amp;NumberOfRolls];1 --=tableRoll|[T#[&amp;tableName]] --+Roll [&amp;i]|[$tableRoll.tableEntryText][br][$tableRoll.tableEntryImgURL] --%| }} will display all 3 rolls but the image URLs are displayed as text and aren't rendered to images. I am not familiar enough with Roll20's chat or image processing to explain why these things are like that. EDIT: Adding some additional logging to ScriptCards to see what it sends. I can see that ScriptCards does send multiple rolls: "DEBUG: cardoutput: &lt;div style=\"display: table; border: 2px solid #000000;; background-color: #EEEEEE; width: 100%; text-align: left; border-radius: 6px;; border-collapse: separate; box-shadow: 5px 3px 3px 0px #aaa;;\"&gt; &lt;div style=\"display: table-header-group; background-color: #1C6EA4; background-image: ; border-bottom: 2px solid #444444;\"&gt; &lt;div style=\"display: table-row;\"&gt; &lt;div style=\"display: table-cell; padding: 2px 2px; text-align: center;\"&gt;&lt;span style=\"font-family: Contrail One; font-style:normal; font-size: 1.2em; line-height: 1.2em; font-weight: strong; color: #FFFFFF; text-shadow: -1px 1px 0 #000, 1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;\"&gt;Reroll&lt;/span&gt;&lt;br /&gt;&lt;span style=\"font-family: Tahoma; font-variant: normal; font-size: 13px; font-style:normal; font-weight: bold; color: #FFFFFF; \"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style=\"display: table-row-group; background-image:;\"&gt;&lt;div style=\"display: table-row; background: #D0E4F5; background-image: ; ;\"&gt; &lt;div style=\"display: table-cell; padding: 0px 0px; font-family: Helvetica; font-style: normal; font-weight:normal; font-size: 14px;; \"&gt;&lt;span style=\"line-height: normal; color: #000000;\"&gt;&lt;strong&gt;Roll 1&lt;/strong&gt; Orc&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style=\"display: table-row; background: #eeeeee; background-image: ; ;\"&gt; &lt;div style=\"display: table-cell; padding: 0px 0px; font-family: Helvetica; font-style: normal; font-weight:normal; font-size: 14px;; \"&gt;&lt;span style=\"line-height: normal; color: #000000;\"&gt;&lt;strong&gt;&lt;/strong&gt; <a href="https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983&lt;/span" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359433439/uQQjA2cAeK71AIzBVQvv7g/max.png?1694970983&lt;/span</a>&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style=\"display: table-row; background: #D0E4F5; background-image: ; ;\"&gt; &lt;div style=\"display: table-cell; padding: 0px 0px; font-family: Helvetica; font-style: normal; font-weight:normal; font-size: 14px;; \"&gt;&lt;span style=\"line-height: normal; color: #000000;\"&gt;&lt;strong&gt;Roll 2&lt;/strong&gt; Corman&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style=\"display: table-row; background: #eeeeee; background-image: ; ;\"&gt;&lt;div style=\"display: table-cell; padding: 0px 0px; font-family: Helvetica; font-style: normal; font-weight:normal; font-size: 14px;; \"&gt;&lt;span style=\"line-height: normal; color: #000000;\"&gt;&lt;strong&gt;&lt;/strong&gt; <a href="https://s3.amazonaws.com/files.d20.io/images/359434074/oaWwzBA7cdvdNf9bj_A5Lw/max.png?1694971194&lt;/span" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/359434074/oaWwzBA7cdvdNf9bj_A5Lw/max.png?1694971194&lt;/span</a>&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;br /&gt;" So ScriptCards sending a complete set of html table rows with all the rolls and images to the sendChat function but it seems that Roll20 is chopping it off after the first image.
Ah well, it was worth a shot. Thanks a bunch for all your work Joshua :D
1722794127

Edited 1722794217
Hi Kurt et al, I'm having a little trouble with a specific conditional and I don't know why. So, the conditional works as the following; --?"[&amp;AbilityBonus]" -inc "Bonus"| --&amp;TDA|[td [&amp;Bonus_Background]] --&amp;TDAC|[/td] --]| But, when written as the following it doesn't work; --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDA;[td [&amp;Bonus_Background]] --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDAC;[/td] As far as I'm aware, these two should be the same thing. I'm most likely missing something, as I'm an amateur at this. EDIT: I don't mind using the first method, just that the second method looks cleaner and takes up one less line. It's really just a matter of me being slightly neurotic.
1722806658

Edited 1722806668
Timothy, What does the variable &amp;Bonus_Background contain? Does it contain a semi-colon? Cause without, I can't seem to replicate what you are seeing with these. If take your code snippets above and add fill-in around them like so: !script {{ --&amp;AbilityBonus|NoBonusHere --&amp;Bonus_Background|something --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDA;[td [&amp;Bonus_Background]] --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDAC;[/td] --~|system;dumpvariables;string }} and !script {{ --&amp;AbilityBonus|NoBonusHere --&amp;Bonus_Background|something --?"[&amp;AbilityBonus]" -inc "Bonus"| --&amp;TDA|[td [&amp;Bonus_Background]] --&amp;TDAC|[/td] --]| --~|system;dumpvariables;string }} Both produce the same string variables in the console: "StringVariable: TDA, Value: [td something]" "StringVariable: TDAC, Value: [/td]" I mean I would probably use the code block on the assumption that that fewer variable substitions and conditional checks are better performing but I haven't benchmarked that so it's purely my assumption. But that said I am not seeing what you are seeing with this and just normal strings. If you do have a semi-colon in your Bonus_Background that could bite you though.
1722901643

Edited 1722902214
Thanks joshua, It could very well be a semi-colon breaking this for me. &amp;bonus_background contains the style information for the [td]. So CSS, so lots of semi-colons. --&amp;Bonus_Background|width=100% style="background-image:url(<a href="https://github.com/VirulentArc/Resources/blob/main/d20/bg3/template/bonus_background.webp?raw=true#.png);background-repeat:no-repeat;background-size:80px;background-position" rel="nofollow">https://github.com/VirulentArc/Resources/blob/main/d20/bg3/template/bonus_background.webp?raw=true#.png);background-repeat:no-repeat;background-size:80px;background-position</a>: center;display: inline-block;margin-left: auto;margin-right: auto;width: 75px;" It in no way hurts me to use the code block, I'm really just curious about why it was happening. But, I think you've cleared it up for me, thanks. EDIT: I thought I'd mention that there were eight of these code blocks all slightly different. So, if the conditional wasn't met, then the td style information and the information contained within the cell itself didn't appear when I did --+| outputs. That's why I was looking to reduce the physical size of the code, just because there were so many of them, not because I'm completely neurotic.
So in this case a code block works but an alternative for you is to use the parameterDelimiter setting parameterDelimiter Specify the character sequence used to separate parameters in various calls (defaults is semi-colon (;)) (1.6.7+) Like in this example scriptcard: !script {{ --&amp;semicolonVar|this string has; a semi-colon in the middle --?1 -ne 2|&amp;busted;[&amp;semicolonVar] --+Busted|[&amp;busted] --#parameterDelimiter|$$$ --?1 -eq 1|&amp;working$$$[&amp;semicolonVar] --#parameterDelimiter|; --+Working|[&amp;working] }} So you can change parameterDelimiter so you can use a different string instead of semi-colons to separate the parameters for when your strings might have a semi-colon in them.
1723069924
Kurt J.
Pro
API Scripter
--?"[&amp;AbilityBonus]" -inc "Bonus"| --&amp;TDA|[td [&amp;Bonus_Background]] --&amp;TDAC|[/td] --]| But, when written as the following it doesn't work; --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDA;[td [&amp;Bonus_Background]] --?"[&amp;AbilityBonus]" -inc "Bonus"|&amp;TDAC;[/td] As far as I'm aware, these two should be the same thing. I'm most likely missing something, as I'm an amateur at this. EDIT: I don't mind using the first method, just that the second method looks cleaner and takes up one less line. It's really just a matter of me being slightly neurotic. Just a note that the first method is missing a [ at the end of the first line to begin a code block, so TDA and TDAC will always get set (condition being true or not). The parameterDelimiter should work around any ; issues, as Joshua indicates.
1723326020

Edited 1723401717
I don't know if this is the correct place but I think it would be awesome for scriptcards to have a dropdown feature! like a named arrow that you can click and will show additional information!
1723337081
vÍnce
Pro
Sheet Author
Changing the attr (savespells_base) on the sheet directly, triggers a sheetworker calc for other attrs.&nbsp; I can also trigger the same sheetworker when using a chatsetattr command; !setattr --sel --savespells_base|10 When setting the same attr with SC, it does not trigger.&nbsp; The attr is set correctly but the sheet does not detect the change event. !script {{ --!a:@{selected|character_id}|!savespells_base:10 }} Interestingly enough, once I've set the attr's value at least once with SC, any subsequent SC set commands (w/new value), triggers the sheetworker as expected. Similarly, I can set the same attr back-to-back within the same command like so; !script {{ --!a:@{selected|character_id}|!savespells_base:10 --!a:@{selected|character_id}|!savespells_base:11 }} and it also triggers. This is on the AD&amp;D1e. I can make changes to the sheetworkers if needed but if the sheet isn't detecting the change at all, I'm not sure what I would need to do help. Any suggestions?&nbsp; TIA
1723847599
Kurt J.
Pro
API Scripter
Tristan P. said: I don't know if this is the correct place but I think it would be awesome for scriptcards to have a dropdown feature! like a named arrow that you can click and will show additional information! Unfortunately, this isn't possible right now in Roll20. Roll20 chat filters the HTML tags that can be used for output, and so far I haven't found a way to collapsable sections, and inputs of any kind (dropdown, check box, text box, etc.) aren't supported.
1723848291
Kurt J.
Pro
API Scripter
vÍnce said: Changing the attr (savespells_base) on the sheet directly, triggers a sheetworker calc for other attrs.&nbsp; I can also trigger the same sheetworker when using a chatsetattr command; !setattr --sel --savespells_base|10 When setting the same attr with SC, it does not trigger.&nbsp; The attr is set correctly but the sheet does not detect the change event. !script {{ --!a:@{selected|character_id}|!savespells_base:10 }} Interestingly enough, once I've set the attr's value at least once with SC, any subsequent SC set commands (w/new value), triggers the sheetworker as expected. Similarly, I can set the same attr back-to-back within the same command like so; !script {{ --!a:@{selected|character_id}|!savespells_base:10 --!a:@{selected|character_id}|!savespells_base:11 }} and it also triggers. This is on the AD&amp;D1e. I can make changes to the sheetworkers if needed but if the sheet isn't detecting the change at all, I'm not sure what I would need to do help. Any suggestions?&nbsp; TIA Vince - Testing a fix for this now... I'm guessing the attribute doesn't pre-exist (hence the "!') and create attribute doesn't trigger workers. I'm updating the code to create the attribute with a dummy value and then immediately set it using the worker. Give me a few minutes to test and I'll put the update on GitHub
1723848708
vÍnce
Pro
Sheet Author
Thanks Kurt
1723848839
Kurt J.
Pro
API Scripter
Just posted the changes... ran a few tests to make sure I didn't break anything else, lol. Posted here as version 2.7.27a :&nbsp;<a href="https://github.com/kjaegers/ScriptCards/blob/main/ScriptCards_API/scriptcards.js" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/ScriptCards_API/scriptcards.js</a>
1723853025
vÍnce
Pro
Sheet Author
That works Kurt. :-)
1724712633
Kurt J.
Pro
API Scripter
ScriptCards 2.7.27a is now live on OneClick The most recent push to OneClick for ScriptCards is now live. The changes since 2.7.25 are: Using --!a| and specifying an attribute that doesn't yet exist (with the "!" prefix on the attribute name) will now create the attribute with a dummy value and then set it to the desired value with the sheetworker. New setting: limitmaxbarvalues (default:0). If set to any non-default value, any use of --!t to set the value of a bar will be limited to the maximum value of the bar. In --!a, --!t, and --c statements, it is now possible to include vertical bar (|) characters in the values by escaping them with a double backslash (ex: \\|) Added code to replace \\[ and \\] with [ and ] in globally in script to allow [ and ] to be escaped
1724785363

Edited 1724786202
Hi all, Doing a rewrite on my Find Familiar macro. I'm having some trouble getting the roll from a description. Specifically, the Poisonous Snake NPC has a poison damage roll in the description of it's bite attack. --?"[&amp;FamiliarType]" -inc "Poisonous Snake"|&amp;AttackOneDesc;The target must make a DC 10 Constitution saving throw, taking 5 (or [[2d4]] (2d4)) poison damage on a failed save, or half as much damage on a successful one. It rolls the [[2d4]] when it writes to the description. So, I thought I'd use the new \\ to escape the brackets, but I get \[\[2d4\]\] written to the description. Almost like the backspaces are escaping the backspaces. What am I doing wrong? EDIT: Should mention that I don't use the actual Poisonous Snake NPC from the compendium. I create a blank NPC and write to it for each summoned familiar. EDIT EDIT: Got around this by using the method the spider NPC uses by making it the secondary damage type of the roll. Still don't know how to escape things lol
Continuing on with my macro rewrite. One of the pieces of information I'm writing to the character is an attack ability based on the first npcaction. So, I use --!ob to create the ability to begin with, but the wiki says to use --!ability or --!b to update the ability. Creating the ability works, but updating it doesn't. Is there a sytnax difference?&nbsp; So, I use the following code to create the ability on first run. --&amp;obrac|{ --&amp;cbrac|} --&amp;perc|% --!ob:AbilID:[&amp;FindFamiliar]:[&amp;AttackOne]:y|[&amp;perc][&amp;obrac]FindFamiliar|repeating_npcaction_$0_npc_action[&amp;cbrac] And then I tried to update it using the same syntax, but replacing !ob with !ability.
1725321471

Edited 1725331253
This is my current output that I am trying to clean up and format I have been struggling making a Button that sends the 'clicker' organized information. I currently have this, it is serviceable but the !wself community API doesnt handle any formatting, just a solid line of txt. does anyone know a better way of doing this? I cant seem to the the echo or whisper commands to function in context with the button. I cant call another macro because I will need to use generated information from the scripcard later on. !script {{ --+| [TEST BUTTON 1](!wself gm weapon name** weapon statsgm weapon typegm weapon description) --+|[button]TEST BUTTON 2::!wself gm weapon name 2 weapon stats 2 gm weapon type2 gm weapon description 2[/button] }} This goal is to implement this to a looped # of randomly generated weapons, make the weapon name a button that will whisper the player who clicks it the full stats of the item. The lack of formatting makes the info hard to read currently. This is my current macro output I would like to clean up
Tristan, To confirm how you want things work, do you want the ScriptCard to output buttons with the generated weapons to everyone and then if a player clicks on the button to whisper results just to them? If so, then I can probably show some example code using reentrant ScriptCards to do this.
1725384528

Edited 1725391590
Hey Joshua Yes, that is correct. I was originally trying to use reentrant buttons but I ran into variables being saved over in my looped script. I might have been doing something incorrectly tho. I'll send you the macro for better context. My issue with was first button click worked but clicks from older scriptcards would be overwritten by the new card or would overwrite 'previous' buttons.&nbsp; this was my first attempt at a larger scriptcard so its a bit jank, I have better coded ones now but if it aint broke why fix it. it uses tables and a library unfortunately so it will be difficult to show the full thing. !script {{ --=loopcount|?{How many?|1} --%LoopCounter|1;[$loopcount];1 --=weapon_table|[T#scriptcard-weapon] --&amp;weapon_tableText|[$weapon_table.tableEntryText] --=material_table|[T#scriptcard-mat] --&amp;material_tableText|[$material_table.tableEntryText] --=size_table|[T#scriptcard-size] --&amp;size_tableText|[$size_table.tableEntryText] --=masterwork_table|[T#scriptcard-masterwork] --&amp;masterwork_tableText|[$masterwork_table.tableEntryText] +++weapon+++ --#title|[$loopcount|] Weapons Found --&gt;weapon[&amp;weapon_tableText]| --&gt;material[&amp;material_tableText]| --&gt;size[&amp;size_tableText]| --&gt;masterwork[&amp;masterwork_tableText]| --?[$weapon_quantity] -ne 0|[ --=masterwork_cost_update|6 --]|[ --=masterwork_cost_update|300 --]| --?"[&amp;weapon_special]" -inc "Reach weapon."|[ --=masterwork_cost_update|600 --]|[ --]| --?"[&amp;masterwork_name]" -inc "Masterwork"|[ --]|[ --=masterwork_cost_update|0 --]| --=total_attack|[$masterwork_att]+[$material_att] --=total_att_positive| --=total_weight|[$weapon_weight]*[$material_weight]*[$size_weight] {ROUND:2} --=total_cost|[$weapon_cost]*[$material_weight]*[$size_cost]+[$masterwork_cost_update] --?[$material_dmg] -eq 0|[ --&amp;print_dmg|*Damage:* [$weapon_dmg_[&amp;size_tableText].RollText] [$weapon_dmg_type.Text] --]|[ --&amp;print_dmg|*Damage:* [$weapon_dmg_[&amp;size_tableText].RollText] [$material_dmg.Text] [$weapon_dmg_type.Text] --]| --?[$total_attack] -ne 0|[ --&amp;print_att|*Attack Bonus:* [$total_attack.Raw] --]|[ --&amp;print_att| --]| --///|PRINT --?[$weapon_quantity] -ne 0|[ --+|[button][$size_name.Text] [&amp;masterwork_name] [$material_name.Text] [$weapon_name.Text] x [$weapon_quantity.Text]::!wself [$size_name.Text] [&amp;masterwork_name] [$material_name.Text] [$weapon_name.Text] x [$weapon_quantity.Text] [$total_weight] **lbs.** [$total_cost] **[$currency.Text]** *Proficiency:* [$weapon_prof.Text] *Type:* [$weapon_category.Text] [&amp;print_att] [&amp;print_dmg] *Critical:* [$weapon_crit.Text] *Range:* [$weapon_range.Text] *Special:* [&amp;weapon_special] *Description:* [$weapon_desc.Text][/button] --]|[ --+|[button][$size_name.Text] [&amp;masterwork_name] [$material_name.Text] [$weapon_name.Text] [$weapon_quantity_update.Text]::!wself [$size_name.Text] [&amp;masterwork_name] [$material_name.Text] [$weapon_name.Text] [$weapon_quantity_update.Text] [$total_weight] **lbs.** [$total_cost] **[$currency.Text]** *Proficiency:* [$weapon_prof.Text] *Type:* [$weapon_category.Text] [&amp;print_att] [&amp;print_dmg] *Critical:* [$weapon_crit.Text] *Range:* [$weapon_range.Text] *Special:* [&amp;weapon_special] *Description:* [$weapon_desc.Text][/button] --]| --+|[$total_weight] **lbs.** [$total_cost] **[$currency.Text]** --%| }}