Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] ScriptCards - My "Spiritual Successor" to PowerCards

Thank you David for the help.
1615329169
David M.
Pro
API Scripter
Sooo, am I using noMinMaxHilight incorrectly, or just not understanding it? My rolls are using highlight colors no matter what I put as a parameter. Using v1.0.8, Chrome Incognito mode (no extensions). noMinMaxHilight If set to a non-zero value, rolls included in direct output lines will always have the standard yellow background The following is resulting in a blue (mixed) highlight for me whether I use 0 or 1. !scriptcards {{    --#noMinMaxHilight|1   --=Roll|1d1   --+Roll|[$Roll] }}
1615334468

Edited 1615334744
Kurt J.
Pro
API Scripter
David M. said: Sooo, am I using noMinMaxHilight incorrectly, or just not understanding it? My rolls are using highlight colors no matter what I put as a parameter. Using v1.0.8, Chrome Incognito mode (no extensions). noMinMaxHilight If set to a non-zero value, rolls included in direct output lines will always have the standard yellow background The following is resulting in a blue (mixed) highlight for me whether I use 0 or 1. !scriptcards {{    --#noMinMaxHilight|1   --=Roll|1d1   --+Roll|[$Roll] }} Looks like I might have broken that while adding something else. I'll take a look. Ok... that was weird. When I launched my game it behaved exactly as you described. Then I restarted the API sandbox and it started behaving normally..........
1615336082
David M.
Pro
API Scripter
Hmm, mine's still not working after a browser refresh and sandbox restart. Maybe it will fix itself eventually. Thanks!
1615337239
David M.
Pro
API Scripter
Mangouste, I took a crack at your Shaan RPG roller. Got the basic part down, but the optional substitutions/additions are proving difficult. Was going to use Colin's suggestion of an Information request, but the problem is that you don't see any of the output before the Information request is triggered. You could have it say "The roll failed, do you want to...etc", but the player wouldn't see any of the formatted rolls ahead of time to make an informed decision. So, at least here is something that can do the basic rolls. I added some conditional formatting to some of the labels in the comparison section of the card, to make it clear what skill you are rolling against. I also did everything in English to help me keep it straight, but figured you could do a find/replace in a text editor pretty easily. I created 4 attributes "Spirit", "Soul", and "Body" on a character sheet, and am referencing those by name. The card queries for which domain to roll against as well as the skill and object modifiers, then rolls and compares to a target number determined by the respective attribute value. !scriptcards {{ --:FORMATTING| --#title|Shaan Roller --#evenRowBackground|#abceed --#oddRowBackground|#eeeeee --#noMinMaxHilight|1 --:USER INPUT| --&RollType|?{What Domain are you rolling against?|Spirit,Spirit|Soul,Soul|Body,Body} --=SkillMod|?{Enter Skill Bonus|3} --=ObjectMod|?{Enter Object Bonus|2} --=TotalMod|[$SkillMod]+[$ObjectMod] --#leftsub|Skill Bonus: [$SkillMod] --#rightsub|Object Mod: [$ObjectMod] --:INITIALIZE ROLL & STRING VARIABLES| --=Spirit|@{selected|Spirit} --=Soul|@{selected|Soul} --=Body|@{selected|Body} --=SpiritRoll|1d10 --=SoulRoll|1d10 --=BodyRoll|1d10 --=BaseRoll|[$[&RollType]Roll] --&Yellow|FEF68E --&Blue|1C6EA4 --&Red|990000 --&Green|007700 --DISPLAY ATRIBUTES & ROLLS| --+Current Attributes| --+|[c][b][#[&Yellow]]Spirit[/#] [$Spirit.Total] _____ [#[&Blue]]Soul [/#][$Soul.Total] _____ [#[&Red]]Body [/#][$Body.Total][/b][/c] --+Rolls| --+|[c][#[&Yellow]][b]Spirit[/b][/#] [$SpiritRoll] - [#[&Blue]][b]Soul[/b] [/#][$SoulRoll] - [#[&Red]][b]Body[/b] [/#][$BodyRoll][/c] --:COMPARE| --+Compare Roll vs. Target| --=Target|[$[&RollType]] --?[&RollType] -inc Spirit|>CompareRoll;[$BaseRoll];[$Target];[&Yellow] --?[&RollType] -inc Soul|>CompareRoll;[$BaseRoll];[$Target];[&Blue] --?[&RollType] -inc Body|>CompareRoll;[$BaseRoll];[$Target];[&Red] --X| --:PROCEDURES| --:CompareRoll| accepts roll(1), target(2), and color(3) as parameters --+|[c][b][#[%3%]] [&RollType][/#] [$BaseRoll] vs. Target [$Target][/b][/c] --?[%1%] -le [%2%]|>Success|>Failure --<| --:Success| --+Result| --+|[c][#[&Green]][b]~~~Success!~~~[/b][/#][/c] --=HitScore|[$BaseRoll][Roll] + [$SkillMod][Skill] + [$ObjectMod][Object] --+Hit Score|[$HitScore] --<| --:Failure| --+Result| --+|[c][#[&Red]][b]~~~Failure!~~~[/b][/#][/c] --<| }} Example output (kept skill & object bonuses the same for all). Also, as mentioned above, I am currently unable to disable the highlighted min/max rolls due to Roll20 weirdness, so the examples below are highlighted even though the card tells it not to.
Initiative and Scriptcards Good evening everyone. I am trying to create a Scriptcard for initiative (which I thought was going to be easy) but I'm doing something wrong. Here's what I currently have: !scriptcard  {{ --#sourceToken|@{selected|token_id} --#title|[*S:character_name]’s Initiative --#titleFontSize|1.4em --=Init|?{Initiative|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + [*S:initiative_bonus] --@act| 0 [$Init]  _[*S:character_name] --+You Rolled:|[$Init] for initiative }} Issues I'm having: The initiative bonus will not add to the roll. It appears when I hover over the result in the chat window, I can see the (1.13) for a Dex of 13, but it doesn't add to whatever is rolled The @act passes the value over but it adds +1 to the value as I scroll through the rounds. I imagine I should use a different command to pass it to the turn tracker but I don't know what it is or how to code it The @act also doesn't include the players token in the Turn tracker like my old Powercard script did Any help someone can offer me would be greatly appreciated. Thanks in advance. Have a great night.
1615347022

Edited 1615347897
David M.
Pro
API Scripter
Wookie, when I run your card, the initiative appears in my chat output correctly (with the decimal tiebreaker). The issue with !act adding the +1 is that it is meant to be a round counter and expects a non-zero increment. Line 48 of the script is your problem. (EDIT - assuming you are using the version found here ) change=parseFloat(cmds[1])||'+1'; Since you are passing 0 as the first argument to !act, cmds[1] evaluates to false, so the default value of +1 is substituted by the script. You could try changing it to this: change=parseFloat(cmds[1]); There is still the problem of it removing the decimal as you advance the turn tracker, though. This is likely due to a parseInt() or similar function in how the turn tracker formulas are calculated by the Roll20 engine (the assumption being it is a whole number). You could replace lines 53 to 60 of !act with this, which would bypass the formula only if a 0 is passed as the increment value:  if(entry.length){ let to=JSON.parse(Campaign().get('turnorder')||'[]'); if (parseInt(change)===0) { to.unshift({ id: "-1", pr: initial, custom: entry }); } else { to.unshift({ id: "-1", pr: initial, custom: entry, formula: change }); } It's a hack job, for sure (and there's prob a more elegant way to do this in js) but it seems to work. That being said, normally you can add turns to the tracker by selecting a token and using an inline roll, something like: [[1d20&{tracker}]] Scriptcards has the --e command to simulate a sendChat message, but I tried to use something like: --e|[[[$Init]&{tracker}]] in place of your !act call with no luck. Looks like it bypasses the expansion of your [$Init] variable, perhaps? Kurt might be able to shed some more light on this. 
Reply to David M. Thanks so much for the information. I'm going to, hopefully, have some time this morning before I head to work and I'll try it out. It's funny, I had a working PowerCard Initiative that worked for 2 of my 3 players but for whatever reason the third (using the same code) just never worked. I thought I'd try creating a ScriptCard version but I've just been going in circles. Have a great day.
David M. said: Nice, Mark! As a fun brainteaser project, I took your base logic and added some condensed roll output in case you wanted to see all of the rolls in one line without mouseover. This outputs the base dice and exploded dice as separate line items. --EDIT: updated to start the rolls on the left for readability !scriptcard {{ --#title|Exploding Dice Example --:INITIALIZE VARIABLES| --=NumDice|?{Number of dice?|10} --=Target|?{Target Number?|7} --=Aces|0 --=Ones|0 --=Successes|0 --&BaseRolls| --&ExplodedRolls| --:MAIN ROLL LOOP| --=i|0 --:RollLoop| --=i|[$i]+1 -->MakeRoll|1 --?[$i] -lt [$NumDice]|RollLoop --:OUTPUT| --+Base dice:| --+|[&BaseRolls] --+Exploded Dice:| --+|[&ExplodedRolls] --+Target:|[$Target] --+[c]~~~~~~~RESULTS~~~~~~[/c]| --+[#990000]Num Ones[/#]|[$Ones] --+[#007700]Num Successes[/#]|[$Successes] --:CHECK FOR FUMBLE| --?[$Ones] -gt [$Successes]|>Fumble --X| End Macro --PROCEDURES| --:MakeRoll| accepts boolean as parameter to determine if base roll or exploded roll --=ThisRoll|1d10 --=Aces|[$Aces] + [$ThisRoll.Aces] --=Ones|[$Ones.Total] + [$ThisRoll.Ones] --?[%1%] -eq 1|>AddBaseRoll|>AddExplodedRoll --?[$ThisRoll] -ge [$Target]|>AddSuccess --?[$ThisRoll.Aces] -eq 1|>MakeRoll;0 --<| --:AddBaseRoll| --&BaseRolls|+[$ThisRoll] --<| --:AddExplodedRoll| --&ExplodedRolls|+[$ThisRoll] --<| --:AddSuccess| --=Successes|[$Successes] + 1 --<| --:Fumble| --+[#990000]Fumble! - [/#]|[#990000][b]Things went horribly wrong.[/b][/#] --<| }} Example output Very Nice, and much cleaner Going to look at: 1) the Success used in next roll - non exploding (This should be simple) 2) the Success used in next roll - exploding (Not 100% if can reuse the loop or new loop needed) 3) Opposed roll where Selected Success vs Target Success (Damage is Success Margin either way, On Draw attacker loses) 4) The Break Neck (Grapple Opposed Roll) Success Margin non explode new roll All look within reach now, which is great, just need to verify If I can reuse the loop for more than one roll, or create a variant for each roll
1615384587

Edited 1615390934
Opposed Exploding Roll comparing Success Margins (still need to tweak the final lines, so the Math is reversed and text changed depending on the greater number) But the Core of Reusing the loop is good. ---Edited to inc clode thingy--- !scriptcard  {{    --#title|Exploding Dice Example - Opposed Roll --:InitializeVariablesBase|   --=Target|?{Target Number?|7}   --=Aces|0   --=Ones|0   --=Successes|0   --&BaseRolls|   --&ExplodedRolls| --:InitializeVariablesSelected|   --=NumDice|?{Selected Number of dice?|10}   --=Aces|0   --=Ones|0   --=Successes|0  --=SuccessesS|0  --=SorT|0   --&BaseRolls|   --&ExplodedRolls|   --+[c]~~~~~~~Selected~~~~~~[/c]|   -->MainRollLoop| --:InitializeVariablesTarget|   --=NumDice|?{Target Number of dice?|10}   --=Aces|0   --=Ones|0   --=Successes|0  --=SuccessesT|0   --=SorT|1   --&BaseRolls|   --&ExplodedRolls|   --+[c]~~~~~~~Target~~~~~~[/c]|   -->MainRollLoop| --:MainRollLoop|   --=i|0   --:RollLoop|       --=i|[$i]+1       -->MakeRoll|1       --?[$i] -lt [$NumDice]|RollLoop --:OUTPUT|   --+Base dice:|   --+|[&BaseRolls]   --+Exploded Dice:|   --+|[&ExplodedRolls]   --+Target:|[$Target]   --+[c]~~~~~~~RESULTS~~~~~~[/c]|   --+[#990000]Num Ones[/#]|[$Ones]   --+[#007700]Num Successes[/#]|[$Successes] --:Store Successes Selected   --?[$SorT] -eq 0|>SuccessesSelected   --?[$SorT] -eq 1|SuccessesTarget --:CHECK FOR FUMBLE|   --?[$Ones] -gt [$Successes]|>Fumble --:Store Successes   --?[$SorT] -eq 0|SuccessesS|[$Successes]   --?[$SorT] -eq 1|SuccessesT|[$Successes]   --?[$SorT] -eq 0|>InitializeVariablesTarget|>End --PROCEDURES|   --:MakeRoll| accepts boolean as parameter to determine if base roll or exploded roll       --=ThisRoll|1d10       --=Aces|[$Aces] + [$ThisRoll.Aces]       --=Ones|[$Ones.Total] + [$ThisRoll.Ones]       --?[%1%] -eq 1|>AddBaseRoll|>AddExplodedRoll       --?[$ThisRoll] -ge [$Target]|>AddSuccess       --?[$ThisRoll.Aces] -eq 1|>MakeRoll;0   --<|   --:AddBaseRoll|       --&BaseRolls|+[$ThisRoll]   --<|   --:AddExplodedRoll|       --&ExplodedRolls|+[$ThisRoll]   --<|   --:AddSuccess|       --=Successes|[$Successes] + 1   --<|   --:Fumble|       --+[#990000]Fumble! - [/#]|[#990000][b]Things went horribly wrong.[/b][/#]   --<| --:SuccessesSelected| --=SuccessesS|[$Successes]   --<| --:SuccessesTarget| --=SuccessesT|[$Successes]   --+[c]~~~~~~~Success Margin~~~~~~[/c]|   --=Damage|[$SuccessesS] - [$SuccessesT]   --+Damage math|[$SuccessesS] - [$SuccessesT]   --+Damage|You dish out [$Damage] Pain Damage   -->End --:End|   --X| End Macro }}
1615387980
David M.
Pro
API Scripter
Great, Mark! Btw, you can save space and enhance readability in the thread by adding the "Code" format to your pasted code. You can either select all of the lines first and then apply the format, or start a new line->apply the format->right click and "paste as plain text" into the code-formatted line.
Cool Sorry about that - will go back n try and edit Garesh colours are a go: !scriptcard {{ --#title|Grapple --#emoteText|@{selected|token_name} grapples @{target|token_name} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#titlecardbackground|#871D06 --:InitializeVariablesBase| --=Target|?{Target Number?|7} --=Aces|0 --=Ones|0 --=Successes|0 --&BaseRolls| --&ExplodedRolls| --:InitializeVariablesSelected| --=NumDice|@{selected|Str} + @{selected|Brawl} --=Aces|0 --=Ones|0 --=Successes|0 --=SuccessesS|0 --=SorT|0 --&BaseRolls| --&ExplodedRolls| --#oddrowbackground|#B73E23 --#evenrowbackground|#B73E23 --+[c]@{selected|token_name}[/c]| --#oddrowbackground|#D2E3E8 --#evenrowbackground|#A3C1CA -->MainRollLoop| --:InitializeVariablesTarget| --=NumDice|@{target|Str} + @{target|Brawl} --=Aces|0 --=Ones|0 --=Successes|0 --=SuccessesT|0 --=SorT|1 --&BaseRolls| --&ExplodedRolls| --#oddrowbackground|#B73E23 --#evenrowbackground|#B73E23 --+[c]@{target|token_name}[/c]| --#oddrowbackground|#E7E7E7 --#evenrowbackground|#BEBEBE -->MainRollLoop| --:MainRollLoop| --=i|0 --:RollLoop| --=i|[$i]+1 -->MakeRoll|1 --?[$i] -lt [$NumDice]|RollLoop --:OUTPUT| --+Base dice:| --+|[&BaseRolls] --+Exploded Dice:| --+|[&ExplodedRolls] --+Target:|[$Target] --+[c]~~~~~~~RESULTS~~~~~~[/c]| --+[#990000]Num Ones[/#]|[$Ones] --+[#007700]Num Successes[/#]|[$Successes] --:Store Successes Selected --?[$SorT] -eq 0|>SuccessesSelected --?[$SorT] -eq 1|SuccessesTarget --:CHECK FOR FUMBLE| --?[$Ones] -gt [$Successes]|>Fumble --:Store Successes --?[$SorT] -eq 0|SuccessesS|[$Successes] --?[$SorT] -eq 1|SuccessesT|[$Successes] --?[$SorT] -eq 0|>InitializeVariablesTarget|>End --PROCEDURES| --:MakeRoll| accepts boolean as parameter to determine if base roll or exploded roll --=ThisRoll|1d10 --=Aces|[$Aces] + [$ThisRoll.Aces] --=Ones|[$Ones.Total] + [$ThisRoll.Ones] --?[%1%] -eq 1|>AddBaseRoll|>AddExplodedRoll --?[$ThisRoll] -ge [$Target]|>AddSuccess --?[$ThisRoll.Aces] -eq 1|>MakeRoll;0 --<| --:AddBaseRoll| --&BaseRolls|+[$ThisRoll] --<| --:AddExplodedRoll| --&ExplodedRolls|+[$ThisRoll] --<| --:AddSuccess| --=Successes|[$Successes] + 1 --<| --:Fumble| --+[#990000]Fumble! - [/#]|[#990000][b]Things went horribly wrong.[/b][/#] --<| --:SuccessesSelected| --=SuccessesS|[$Successes] --<| --:SuccessesTarget| --=SuccessesT|[$Successes] --#oddrowbackground|#B73E23 --#evenrowbackground|#B73E23 --+[c]~~~~~~~Success Margin~~~~~~[/c]| --#oddrowbackground|#cceecc --#evenrowbackground|#99ee99 --? [$SuccessesS] -gt [$SuccessesT]|>win|>lose -->End --:win| --=Damage|[$SuccessesS] - [$SuccessesT] --+Damage math|[$SuccessesS] - [$SuccessesT] --+Damage|@{selected|token_name} deals out [$Damage] Pain Damage to @{target|token_name} --X| End Macro --:lose| --=Damage|[$SuccessesT] - [$SuccessesS] --?[$Damage] -eq 0|>draw|>lost --X| End Macro --:lost| --+Damage math|[$SuccessesT] - [$SuccessesS] --+Fail|Ouch, @{selected|token_name} is pathetic at this fighting lark. --+Damage|@{target|token_name} deals out [$Damage] Pain Damage to @{selected|token_name} --X| End Macro --:draw| --=Damage|[$Damage] + 1 --+Damage math|[$SuccessesT] - [$SuccessesS] --+Fail|Ouch, @{selected|token_name} is pathetic at this fighting lark. --+Damage|@{target|token_name} deals out [$Damage] Pain Damage to @{selected|token_name} --X| End Macro --:End| --X| End Macro }}
1615392204
David M.
Pro
API Scripter
Ooh, I didn't realize that multiple odd/evenrowbackground(s) could work. I just always assumed they would get set to the last one defined. Good to know! I also happened to notice that your branch labels  --:Store Successes Selected  and  --:Store Successes  were missing a vertical bar at the end. Are you getting a "No line tag specified" error that you were wondering about? Speaking of which: Kurt, the line tag error has a typo that I keep forgetting to mention. "rror..." should read "Error..." :)   
cool - just noticed and was about to post on that Cheers
I also switched these two around as the Fumble was not triggering on the target. From --:Store Successes Selected| --?[$SorT] -eq 0|>SuccessesSelected --?[$SorT] -eq 1|SuccessesTarget --:CHECK FOR FUMBLE| --?[$Ones] -gt [$Successes]|>Fumble To --:CHECK FOR FUMBLE| --?[$Ones] -gt [$Successes]|>Fumble --:Store Successes Selected| --?[$SorT] -eq 0|>SuccessesSelected --?[$SorT] -eq 1|SuccessesTarget
note on Scriptcards 1d10>5 is 6+ not 5+ 1d10>=5 does not work 1d10=>5 does not work So just a care needed if you are using roll thresholds, as it would be threshold -1
I think it's actually a truncation problem. I've noticed it pop up with the full word sometimes. David M. said: Ooh, I didn't realize that multiple odd/evenrowbackground(s) could work. I just always assumed they would get set to the last one defined. Good to know! I also happened to notice that your branch labels  --:Store Successes Selected  and  --:Store Successes  were missing a vertical bar at the end. Are you getting a "No line tag specified" error that you were wondering about? Speaking of which: Kurt, the line tag error has a typo that I keep forgetting to mention. "rror..." should read "Error..." :)   
1615480430

Edited 1615480500
Struggling tying to work out Buttons of all things! Looking to: Add a button at Result of Script - Say "Area of Effect", which calls the saved Area of Effect API/Marco If possible pass the Successes from Set of Rolls 1 to Area of Effect, as Dice number for each target selected Also is it possible to have a Button to handout? Tried --+Link|[Area of Effect](<a href="http://journal.roll20.net/handout/-MSdTZjw-QOsf8MjzFxW" rel="nofollow">http://journal.roll20.net/handout/-MSdTZjw-QOsf8MjzFxW</a>) - link works --+Link|[button]Area of Effect::(<a href="http://journal.roll20.net/handout/-MSdTZjw-QOsf8MjzFxW)[/button]&nbsp;-" rel="nofollow">http://journal.roll20.net/handout/-MSdTZjw-QOsf8MjzFxW)[/button]&nbsp;-</a> link no longer works and does not look like normal button --+Link|[button]Area of Effect::~Unarmed-Attack[/button]&nbsp;-&nbsp; this at least looks like a button, but errors&nbsp;- TypeError: Cannot read property 'substring' of undefined --+Link|[button]Area of Effect::Unarmed-Attack[/button] - Page not found --+Link|[button]Area of Effect::!Unarmed-Attack[/button] - Nothing --+Link|[button]Area of Effect::@Unarmed-Attack[/button] - Page not found --+Link|[button]Area of Effect::#Unarmed-Attack[/button] - Nothing
1615481627
David M.
Pro
API Scripter
I haven't used buttons in a scriptcard yet. Does it need the html replacement characters and/or charname reference (if ability) as described here ? e.g. (not in scriptcard formatting): [Macro](!&amp;#13;#MacroName) [Ability](!&amp;#13;&amp;#37;{CharName|AbilityName}) &nbsp;
David M. said: I haven't used buttons in a scriptcard yet. Does it need the html replacement characters and/or charname reference (if ability) as described here ? e.g. (not in scriptcard formatting): [Macro](!&amp;#13;#MacroName) [Ability](!&amp;#13;&amp;#37;{CharName|AbilityName}) &nbsp; Cheers this works for calling in a macro as a clickable button --+Link|[Unarmed Attack](!&amp;#13;#Unarmed-Attack)
I'm trying to use the character summary library tool. I've copied the code into the appropriately named handout. But nothing posts to chat. What am I doing wrong? !script {{ +++5E Tools+++ --#leftsub|@{selected|token_name} --#sourceToken|@{selected|token_id} --#emoteText|*@{selected|token_name} checks character sheet.* --&gt;Lib5E_Character_Summary|character_id --X| }}
I believe it is also looking for a custom handout where the library code (Lib5E_Character_Summary) exists. The associated WIKI has the code to place in a handout.&nbsp;&nbsp; Jay R. said: I'm trying to use the character summary library tool. I've copied the code into the appropriately named handout. But nothing posts to chat. What am I doing wrong? !script {{ +++5E Tools+++ --#leftsub|@{selected|token_name} --#sourceToken|@{selected|token_id} --#emoteText|*@{selected|token_name} checks character sheet.* --&gt;Lib5E_Character_Summary|character_id --X| }}
Will M. said: I believe it is also looking for a custom handout where the library code (Lib5E_Character_Summary) exists. The associated WIKI has the code to place in a handout.&nbsp;&nbsp; Jay R. said: I'm trying to use the character summary library tool. I've copied the code into the appropriately named handout. But nothing posts to chat. What am I doing wrong? !script {{ +++5E Tools+++ --#leftsub|@{selected|token_name} --#sourceToken|@{selected|token_id} --#emoteText|*@{selected|token_name} checks character sheet.* --&gt;Lib5E_Character_Summary|character_id --X| }} I've already created that handout and pasted the code (for all the 5E tools) in there. I feel like I'm overlooking something really obvious, lol.
Hey folks,&nbsp; I'm having trouble with repeating sections in my PF2 game. I'm using the following snippet: &nbsp; --Rfind|@{Haggle|character_id};Short Sword +1 Corrosive;repeating_melee-strikes;weapon &nbsp; --+Weapon Name|[*R:weapon] When I run a loop to see the names (repeating_melee-strikes) with an Rfirst and Rnext, I get this which is an accurate list of weapon names:&nbsp; However, when I try to Rfind a specific weapon, the API crashes with the following error:&nbsp; For reference, the error message generated was:&nbsp; TypeError: z.get(...).replace is not a function TypeError: z.get(...).replace is not a function at apiscript.js:24703:87 at Array.forEach (&lt;anonymous&gt;) at getSectionAttrs (apiscript.js:24702:17) at apiscript.js:23570:30 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) Any help would be appreciated.&nbsp;
1615565814
Kurt J.
Pro
API Scripter
David M. said: Ooh, I didn't realize that multiple odd/evenrowbackground(s) could work. I just always assumed they would get set to the last one defined. Good to know! I also happened to notice that your branch labels&nbsp; --:Store Successes Selected &nbsp;and&nbsp; --:Store Successes &nbsp;were missing a vertical bar at the end. Are you getting a "No line tag specified" error that you were wondering about? Speaking of which: Kurt, the line tag error has a typo that I keep forgetting to mention. "rror..." should read "Error..." :) &nbsp;&nbsp; Whenever you see that "not line tag specified" error, it is generally becaus the line is missing a vertical bar. --:Store Success needs to be --:Store Success|
1615565888
Kurt J.
Pro
API Scripter
Jay R. said: I'm trying to use the character summary library tool. I've copied the code into the appropriately named handout. But nothing posts to chat. What am I doing wrong? !script {{ +++5E Tools+++ --#leftsub|@{selected|token_name} --#sourceToken|@{selected|token_id} --#emoteText|*@{selected|token_name} checks character sheet.* --&gt;Lib5E_Character_Summary|character_id --X| }} I am working on some revisions to the 5E Tools, and the Roll20 Editor is causing trouble as well. I'll come up with a recommended process for copying the library into a handout (the Wiki formatting is being injected by a straight copy/paste which is messing things up as well.)
Not fully there For example [Area of Explosion](!&amp;#13;#AoE) If entered in character sheet macro - works&nbsp; If entered in Collections macros (ie to external reference for each target, as not sure how to ref in char sheet macros), get converted to [Area of Explosion](! #AoE) and no longer fires Mark C. said: David M. said: I haven't used buttons in a scriptcard yet. Does it need the html replacement characters and/or charname reference (if ability) as described here ? e.g. (not in scriptcard formatting): [Macro](!&amp;#13;#MacroName) [Ability](!&amp;#13;&amp;#37;{CharName|AbilityName}) &nbsp; Cheers this works for calling in a macro as a clickable button --+Link|[Unarmed Attack](!&amp;#13;#Unarmed-Attack)
Way round is just use Char macros --+Click for each target|[Area of Effect](!&amp;#13;&amp;#37;{selected|AoE})&nbsp;
Funny one of my scripts - things work tickity boo, others nope either no button shown, or the button semi fires - ie does not fire the scriptcards code Run them as token markers - all fine Odd - got headache atm, so will try n work out whats going wrong in the rouge scripts
1615689614

Edited 1615690001
Erik M. said: For reference, the error message generated was:&nbsp; TypeError: z.get(...).replace is not a function TypeError: z.get(...).replace is not a function at apiscript.js:24703: 87 at Array.forEach (&lt;anonymous&gt;) at getSectionAttrs (apiscript.js:24702: 17 ) at apiscript.js:23570: 30 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js: 154:1 ), &lt;anonymous&gt;: 65:16 ) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js: 154:1 ), &lt;anonymous&gt;: 70:8 ) at /home/node/d20-api-server/api.js: 1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 39:147 ) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 93:546 ) Any help would be appreciated. I started a new campaign to do some Rfind testing with spells for 5e. I imported two characters, both have poison spray. Input: !script {{ --Rfind|@{selected|character_id};Poison Spray;repeating_spell;spellname --#debug|1 --+Name|[*R:spellname] --+Description|[*R:spelldescription] }} Works like a charm for one, crashes the API with the other. Getting a nearly identical error message: TypeError: z.get(...).replace is not a function TypeError: z.get(...).replace is not a function at apiscript.js:1789: 87 at Array.forEach (&lt;anonymous&gt;) at getSectionAttrs (apiscript.js:1788: 17 ) at apiscript.js:656: 30 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js: 154:1 ), &lt;anonymous&gt;: 65:16 ) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js: 154:1 ), &lt;anonymous&gt;: 70:8 ) at /home/node/d20-api-server/api.js: 1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 39:147 ) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js: 93:546 )
1615692894

Edited 1615934300
Glenn said: I started a new campaign to do some Rfind testing with spells for 5e. I imported two characters, both have poison spray. Input: !script {{ --Rfind|@{selected|character_id};Poison Spray;repeating_spell;spellname --#debug|1 --+Name|[*R:spellname] --+Description|[*R:spelldescription] }} Works like a charm for one, crashes the API with the other. Getting a nearly identical error message: I did try with a different character to make sure and the error persists.&nbsp; One thing to note is that if I put an weapon in that the character doesn't have, the card simply displays&nbsp; Weapon Name &nbsp;NoRepeatingAttributeLoaded. Which is exactly what it should do, so it is partially working?
1615963820
Senjak
Pro
Sheet Author
Ran into an interesting problem.&nbsp; First a bit of background: The repeating section from my character sheet looks like: &lt;fieldset style="width=60%" class="repeating_skills"&gt; &lt;input style="width: 15%; font-size:24px; text-align:right;" type="text" name="attr_skill_value" value="1"/&gt; &lt;input style="width: 82%; font-size:24px; text-align:left;" type="text" name="attr_skill_name" /&gt; &lt;/fieldset&gt; And then I used: !scriptcard {{ --bgcolor|#000000 --#sourceToken|@{selected|token_id} --#title|@{selected|character_name} --#rightsub|Ship's @{selected|assignment} --#emoteText|Skills --Rfirst|@{selected|character_id};repeating_skills --:DisplayLoop| --?"[*R:skill_name]" -eq NoRepeatingAttributeLoaded|Done --+Skill:|[*R:skill_name]: [*R:skill_value] --Rnext| --&gt;DisplayLoop| --:Done| }} to extract the information. Two runs are as follows: In the first one, Gambling doesn't show up with a value.&nbsp; In the second one I'd gone in and typed in a 1, even though the default was set.&nbsp; Suggestions on how to display the default number without having to go into all of the sheets and type a 1?&nbsp; Or did I just miss something very basic? And I'm not even to the point of adding buttons to roll dice yet :-) thanks! Senjak
1615990877
Senjak
Pro
Sheet Author
I've another question.&nbsp; I've found the magic to make the fonts change size; however, the code to modify the buttons still is evasive.&nbsp;&nbsp; A bit of overkill, but it did make the point that my buttons aren't growing: !scriptcard {{ --#titleFontSize|2.0em --#subtitleFontSize|1.0em --#bodyFontSize|40px --#dicefontsize|3.0em --#buttonfont-size|3.0em --#sourceToken|@{selected|token_id} --#title|@{selected|character_name} --#rightsub|Ship's @{selected|assignment} --#emoteText|Skills --Rfirst|@{selected|character_id};repeating_skills --:DisplayLoop| --?"[*R:skill_name]" -eq NoRepeatingAttributeLoaded|Done --+Skill:|[*R:skill_name]: [*R:skill_value] [button]caption::action[/button] --Rnext| --&gt;DisplayLoop| --:Done| }} And yeah, I know that right now the button doesn't do anything.&nbsp; That will be later. :-) Thanks for any assistance you can offer, Senjak
Hi, I hope someone can help me out here. I am not sure if I am correctly understanding the functionality I am trying to use.&nbsp; When I run this script, the output for&nbsp;[$AttackTotal] is as expected: the sum of&nbsp;[$Attack] + [$Bardic]. !scriptcard&nbsp; {{&nbsp; --#title|Test --#sourceToken|@{selected|token_id} --=Attack|1d20 + [*S:pb] [PROF] --=Bardic|1d6 [BardicInsp] --=AttackTotal|[$Attack.Text] + [$Bardic.Text] --+Attack|[$Attack] --+Bardic|[$Bardic] --+AttackTotal|[$AttackTotal] }} But I would like to see the details of each roll, so I have now added the .Text function to the variables.&nbsp; !scriptcard&nbsp; {{&nbsp; --#title|Test --#sourceToken|@{selected|token_id} --=Attack|1d20 + [*S:pb] [PROF] --=Bardic|1d6 [BardicInsp] --=AttackTotal|[$Attack.Text] + [$Bardic.Text] --+Attack|[$Attack] --+Bardic|[$Bardic] --+AttackTotal|[$AttackTotal] }} But now the&nbsp;[$AttackTotal] value is incorrect. In this instance, the total should be 14, not 24. When I hover over the roll to see the details, it appears that the original values are listed, but new dice rolls were made and added together.&nbsp; Is there a way to just see the details of the two original rolls without a new roll being performed? Not sure what I am doing wrong or if this is a bug. Thanks.&nbsp;
Not sure why my screenshots didn't post, but here they are again.&nbsp; Output from original script: Output after adding .Text function to variables:
1615998441

Edited 1615998486
David M.
Pro
API Scripter
Philip, looks like you pasted the same macro twice, but we get the idea. You could break the rolls down even further, and then build your AttackTotal roll using the individual components with explicit tooltips !scriptcard {{ --#title|Test --#sourceToken|@{selected|token_id} --=d20|1d20 --=pb|[*S:pb] [PROF] --=Attack|[$d20][1d20] + [$pb] [PROF] --=Bardic|1d6 [BardicInsp] --=AttackTotal|[$d20] [1d20] + [$pb] [PROF] + [$Bardic] [BardicInsp] --+Attack|[$Attack] --+Bardic|[$Bardic] --+AttackTotal|[$AttackTotal] }}
Thanks David.&nbsp; For the record, this is the original script I meant to post: !scriptcard {{ --#title|Test --#sourceToken|@{selected|token_id} --=Attack|1d20 + [*S:pb] [PROF] --=Bardic|1d6 [BardicInsp] --=AttackTotal|[$Attack] + [$Bardic] --+Attack|[$Attack] --+Bardic|[$Bardic] --+AttackTotal|[$AttackTotal] }} Your script gives me the output I'm looking for, but I still don't understand why my version doesn't do that and instead and makes new dice rolls.&nbsp; Appreciate the help regardless.&nbsp;
I have sort of an interesting problem that I've been trying to solve with my Witch Bolt macro. I wrote the following macro and for the most part it does what it's supposed to do. After the caster hits a target with the Witch Bolt, it will mark the sheet so that following rounds it will deliver just the damage and not the attack roll again (up to 10-rounds). That works just fine. The part of the macro that doesn't work is that it's supposed to set the token to concentration, but it doesn't do that. Below is my macro: !scriptcard {{ --#title|Witch Bolt --#leftsub|Evocation Spell --#sourceToken|@{selected|token_id} --@token-mod|_set statusmarkers#!white-tower --&gt;CurrentWitchbolt| --&gt;GetAndCheckSlotInformation| --#leftsub|Slot level [$SlotLevel] --#rightsub|Ranged Attack 30-Feet --#targetToken|@{target|token_id} --=TargetAC|@{target|npc_ac} --=AttackRoll|1d20 + @{selected|strength_mod} [INT] + @{selected|pb} [PROF] --=SlotsExpended|[$SlotsExpended] + 1 --@modbattr|_name @{selected|character_name} _lvl[$SlotLevel]_slots_expended|-1 _silent --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] --&gt;PlayEffects|none;burst-smoke;beam-water;electric-sound --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --?[$AttackRoll.Total] -lt [$TargetAC.Total]|Miss --X| --:Miss| --#emoteText|@{selected|token_name} attacks @{target|token_name} with a Witch Bolt! --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC] --+Miss|The attack missed. --X| --:Hit| --#emoteText|@{selected|token_name} attacks @{target|token_name} with a Witch Bolt! --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC] --=Damage|1d12 * [$SlotLevel] --+Hit!|The attack hits @{target|token_name} for [$Damage] lightning damage. --@alter|_target|@{target|token_id} _bar|3 _amount|-[$Damage] --@modbattr|_name @{selected|character_name} _repeatingbolt|+1 _silent --X| --:GetAndCheckSlotInformation| --=SlotLevel|?{Spell # Of Spell Slots To Use?|1|2|3|4|5|6|7|8|9} --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] --=SlotsExpended| [*S:lvl[$SlotLevel]_slots_expended] --?[$SlotLevel.Total] -gt [$SlotsTotal.Total]|NoSlotsLeft --?[$SlotsExpended.Total] -lt 1|NoSlotsLeft --&lt;| --X| --:NoSlotsLeft| --#emoteText|@{selected|token_name} attempts to use Witch Bolt --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --X| --:PlayEffects|Parameters are : source effect; target effect; line effect; sound effect --vtoken|@{selected|token_id} [%1%] --vtoken|@{target|token_id} [%2%] --vbetweentokens|@{selected|token_id} @{target|token_id} [%3%] --@roll20AM|_audio,play,nomenu|[%4%] --&lt;| --X| --:CurrentWitchbolt| --=Repeatbolt|[*S:repeatingbolt] --?[$Repeatbolt.Total] -eq 10|Spellend --?[$Repeatbolt.Total] -gt 0|Dealextradamage --&lt;| --:Dealextradamage| --#emoteText|@{selected|token_name} attacks @{target|token_name} with an additional Witch Bolt! --=Repeatbolt|[*S:repeatingbolt] --=Round|[$Repeatbolt] +1 --+Round|[$Round] --=SlotLevel|?{Spell # Of Spell Slots To Use?|1|2|3|4|5|6|7|8|9} --=Damage|1d12 * [$SlotLevel] --&gt;PlayEffects|none;burst-smoke;beam-water;electric-sound --+Hit!|The attack hits @{target|token_name} for [$Damage] lightning damage. --@alter|_target|@{target|token_id} _bar|3 _amount|-[$Damage] --@modbattr|_name @{selected|character_name} _repeatingbolt|+1 _silent --X| --:Spellend| --#emoteText|@{selected|token_name}'s Witchbolt Spell Has Ended! --X| }} What's funny is that if I use just the top part of the macro with same tokenmod part it works. For example: !scriptcard {{ --#title|Witch Bolt --#leftsub|Evocation Spell --#sourceToken|@{selected|token_id} --@token-mod| _set statusmarkers#!white-tower }} That works, but when it's added to the rest of the Witch Bolt macro it doesn't.
1616012410
David M.
Pro
API Scripter
Phillip K. said: Your script gives me the output I'm looking for, but I still don't understand why my version doesn't do that and instead and makes new dice rolls.&nbsp; If you print out the Attack.Text with this --+AttackText|[$Attack.Text] You end up with something like the following text (roll was 16 for below case): 1d20 (16) + 3 [PROF] This is not a sensible format for a roll variable assignment, so the card is likely getting confused as to what you are trying to tell it.
1616012763
David M.
Pro
API Scripter
DM Goss, if you temporarily remove all of your other --@ api calls, does the token-mod line function again? I sometimes run into problems with macros that have multiple api calls, where one or more get dropped.
I have sort of an interesting problem that I've been trying to solve with my Witch Bolt macro. I wrote the following macro and for the most part it does what it's supposed to do. After the caster hits a target with the Witch Bolt, it will mark the sheet so that following rounds it will deliver just the damage and not the attack roll again (up to 10-rounds). That works just fine. The part of the macro that doesn't work is that it's supposed to set the token to concentration, but it doesn't do that.&nbsp; Is the syntax for your token-mod command correct? I would maybe try changing the line to: --@token-mod|_ids [*S:token_id] _set statusmarkers|white-tower That is the format I use for my token-mod calls, and I haven't had any problems with it working.&nbsp;
f you print out the Attack.Text with this --+AttackText|[$Attack.Text] You end up with something like the following text (roll was 16 for below case): 1d20 (16) + 3 [PROF] This is not a sensible format for a roll variable assignment, so the card is likely getting confused as to what you are trying to tell it. Ah, ok, that makes sense to me now. Thanks again, David!
1616023086

Edited 1616023304
I had posted on the Powercards thread a question about the format and then I just discovered Scriptcards! It's just awesome!!! I was able to format it the way I wanted and with these variables the possibilities are endless. Thank you so much! !scriptcard&nbsp; {{ --/|FORMATS --#hideTitleCard|1 --#evenRowBackground|#ffffff --#oddRowBackground|#ffffff --#diceFontColor|#000000 --#dicefontsize|1.8em --/|VARIABLES --=Initiative|?{Nombre de dés|1|2|3|4|5|6|7|8|9} --=Mod_initiative|@{selected|initiative_mod} --=Compteur|1 --=Destotaux|[$Mod_initiative] --/|CARD --+|[img]<a href="https://i.imgur.com/U8kMLVm.png[/img]" rel="nofollow">https://i.imgur.com/U8kMLVm.png[/img]</a> --+|[img]<a href="https://i.imgur.com/Sygo67H.png[/img]" rel="nofollow">https://i.imgur.com/Sygo67H.png[/img]</a> --:Loop| &nbsp; &nbsp; &nbsp;--&gt;Lancer| &nbsp; &nbsp; &nbsp;--=Compteur|[$Compteur] + 1 --?[$Compteur] -le [$Initiative]|Loop --+|[c] [b] @{selected|token_name} [/b] lance [&amp;MyText] + [$Mod_initiative.RollText]&nbsp; [/c] --+|[img]<a href="https://i.imgur.com/Sygo67H.png[/img]" rel="nofollow">https://i.imgur.com/Sygo67H.png[/img]</a> --+|[c] [$Destotaux] [/c] --+|[img]<a href="https://i.imgur.com/Sygo67H.png[/img]" rel="nofollow">https://i.imgur.com/Sygo67H.png[/img]</a> --+|[img]<a href="https://i.imgur.com/kc4gRef.png[/img]" rel="nofollow">https://i.imgur.com/kc4gRef.png[/img]</a> --X| --:Lancer| &nbsp; &nbsp; &nbsp;--=De|1d6 &nbsp; &nbsp; &nbsp;--=Destotaux|[$Destotaux] + [$De] &nbsp; &nbsp; &nbsp;--&amp;MyText|+[d6][$De.Total][/d6] --&lt;| }}
David M. said: DM Goss, if you temporarily remove all of your other --@ api calls, does the token-mod line function again? I sometimes run into problems with macros that have multiple api calls, where one or more get dropped. No, it doesn't work unless I strip out the whole rest of the macro. If I use the second macro I have listed, then concentration can be set, but if I try to use it in the first macro, it doesn't work.&nbsp;
1616033378
David M.
Pro
API Scripter
Ooh, that card format is slick,&nbsp;Gabryel! Yeah, I think Kurt really hit it out of the park with this script.
I know I have a lot of questions, but bear with me because I think I just have one more. How would I write a drop down menu that queries the user to choose between a standard roll and advantage and then branches off from there?
1616080873
David M.
Pro
API Scripter
A couple of different ways: Put the query directly into the roll. If you don't need to do any more logic or display for the roll type, this is the easiest method !scriptcard {{ --=roll|?{Roll Type?|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --+Roll=|[$roll] }} Query the roll type and apply conditional logic. Use this if you want to output the roll type or make other decisions. Used a case statement below that passes the roll definition to a "Rolld20" function. !scriptcard {{ --&amp;rollType|?{Roll Type?|Standard,Standard|Advantage,Advantage|Disadvantage,Disadvantage} --C[&amp;rollType]|Standard:&gt;Rolld20;1d20|Advantage:&gt;Rolld20;2d20kh1|Disadvantage:&gt;Rolld20;2d20kl1| --+Roll Type =|[&amp;rollType] --+Roll=|[$roll] --X| --:Rolld20| --=roll|[%1%] --&lt;| }}
That's exactly what I was looking for. Thanks, David M.&nbsp;
Here is the Scriptcard I am trying to get to work. !scriptcard {{ --#whisper|gm --#title|Summon Skeletons --=Recharge|1d6 --?[$Recharge] -le 4|NoCharge --?[$Recharge] -ge 5|Recharged --:NoCharge| --+RechargeRoll| [$Recharge] --+Skeletons| could not be summoned. --^End| --:Recharged| --+RechargeRoll| [$Recharge] --+Skeletons| have been summoned! --@Spawn|_name|Skeleton _qty|2 _placement|random6 --:End| }}&nbsp;&nbsp;&nbsp;&nbsp; The card keeps crashing the sandbox when it tries to active the Spawn API. API Output Console Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.&nbsp; More info... &nbsp;If this script was installed from the Script Library, you might find help in the Community API Forum. For reference, the error message generated was:&nbsp; TypeError: Cannot read property 'who' of undefined TypeError: Cannot read property 'who' of undefined at handleInput (apiscript.js:44003:43) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 The Spawn API works fine by itself. !Spawn{{ --name|Skeleton --qty|2 --placement|random6 }} I'm not sure what I'm doing wrong.
1616251226

Edited 1616251501
David M.
Pro
API Scripter
Snow, when I run your card my sandbox doesn't crash but regardless the Spawn api call will not work as written. The easiest solution is to use timmaugh's&nbsp; SelectManager meta-script (it's on one-click, but I'm not sure if it's the latest version). By calling Spawn through SelectManager, the selected token(s) and the calling playerid/who are retained and "injected" so to speak into the Spawn script. I would use the forselected+ command, as shown below &nbsp;--@forselected+|Spawn _name|Skeleton _qty|2 _placement|random6 Your card worked in my test game after changing this syntax, but let me know if you still have issues.