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

1629676839

Edited 1629676856
David M.
Pro
API Scripter
Ah, I see. With the current versions of the two scripts I don't believe that is possible. Your selected token_id is not the spawned token, it is the token that was selected prior to calling the macro. A similar request came up a while ago: It requires a modification to the Spawn code to return the spawned tokenid and then either modifying scriptcards or preferably using timmaugh's Plugger meta-script to grab that value for use with other api scripts after the spawn. With Tim's help a couple weeks ago, there is an unreleased Spawn version to allow that sort of thing that "mostly" works, though there are still some unresolved edge cases that have issues. Hopefully we can iron these out soon, but life and scheduling keep getting in the way. If/when we get this all figured out, I'll post back both here and on the Spawn forum. In the meantime I believe you will have to just click the newly spawned token and run another macro to add to the turn order. Maybe make a collections macro and turn it into a token action so it is always available for any clicked token?
I have the !ta API and all the monsters I use have initiative as a token action, but its alright! I guess some things will have to be manual!
1629725987
timmaugh
Pro
API Scripter
David M. said: A similar request came up a while ago: It requires a modification to the Spawn code to return the spawned tokenid and then either modifying scriptcards or preferably using timmaugh's Plugger meta-script to grab that value for use with other api scripts after the spawn. With Tim's help a couple weeks ago, there is an unreleased Spawn version to allow that sort of thing that "mostly" works, though there are still some unresolved edge cases that have issues. Hopefully we can iron these out soon, but life and scheduling keep getting in the way. If/when we get this all figured out, I'll post back both here and on the Spawn forum. David is being polite, here. I'm the hold up on this one. I think he has his Spawn script in shape to the parameters he and I discussed. I just have to alter Plugger slightly to accommodate the same change. I will see if I can get this knocked out in the near future.
You're all being polite! You create these great API's for people to use AND help them when they need it. You're all awesome!  As far as the code goes, is there another API that you know of that can assist in patching my problem for the time being? Essentially I want rolling initiative to be as hands-off as possible, and happen as fast as possible comparatively to the spawned monster. 
1629739220
timmaugh
Pro
API Scripter
You can kludge it if you're only spawning one at a time. Basically, if you're spawning 1 token at a time and the token name is unique to the page you're on, you can get the token id from the created token after it's created using Fetch. @($[[0]].value.token_id) Then you can use that in some kind of call to send a token to the tracker If you think about the order of things, though, it's going to go: Metascripts ScriptCards ...launches forselected ......launches Spawn ...launches an initiative command (a script to send a given token to the tracker) Since you have to have a token selected to send an entry to the tracker, just using a simple roll won't get the token there to have it happen in an API call (no selected tokens as far as Roll20 can see). But if you have a script that can send a token to the tracker by token ID, then the above Fetch formation would get you that. Trick is, you have to defer it until after the token is created. If we let it resolve at the initial, top-level of meta processing, the token doesn't exist yet and we won't get a value. To defer it you would use ScriptCards built-in deferral character: ^ @^($[[0]].value.token_id) ScriptCards will remove that before it sends the new call to your initiative script. So, if your initiative script's command line were: !totrack --id|<token id here> --roll|<roll equation here> ...then you would use the Fetch construct in the id argument and convert it to be used in ScriptCards: --@totrack| _id|@^($[[0]].value.token_id) _roll|[[1d20]] Put that in your ScriptCards macro just after the forselected=>Spawn command and you just might get the result you're looking for.   --{& select SB}@forselected|!Spawn _name|[&name] _size| [$tokenSize]  _qty|[$qty] _placement|grid 3 _offset|[[(2*(1d2-1)-1)*1d24]],[[(2*(1d2-1)-1)*1d10]]   --@totrack| _id|@^($[[0]].value.token_id) _roll|[[1d20]] Caveats (and they're big) This would rely on a couple of things. First, the token has to be uniquely named for the page you're on. I have a workaround for this (see below). Second, both Spawn and ScriptCards have to be written synchronously... I know David has a synchronous version of Spawn (not sure if that has been released -- it was part of the Plugger integration which is waiting on me). I can't see any reason for ScriptCards to be asynchronous when it comes to running subsequent script calls, but I haven't looked. Unique Name Workaround Track an iterative value for the "next available Spawn counter" in a character's attribute (like a mule character for your ability macros). When you need the value, refer to the mule character's attribute: @{Muley|NextSpawn} Then run a ChatSetAttr command after the Spawn in your ScriptCard to iterate the value by +1 for the next time you run it.
1629740026
timmaugh
Pro
API Scripter
And now I see from your original macro that you were Spawning 3 tokens at a time... so you would lose the ability to have unique names. In that case, you'd have to retrieve the @{Muley|NextSpawn} attribute from your mule character, then loop over the forselected line in ScriptCards, iterating the name by one each time and only Spawning 1 token each time before finally incrementing your NextSpawn attribute by the quantity you spawned. If you went this direction, though, you'd lose the grid layout of Spawn (I think). Either way should still work, they both just come with some limitations.
1629755368

Edited 1629755385
I don't care if they all have the same initiative, that doesnt bother me, however, the API i'm trying to use is !init-assist, and it doesn't seem to play nice with scriptcards as it works on its own: !init-assist --Troll|[[1d20]] But the following doesn't work: !script {{ --@init-assist| _Troll|[[1d20]] }} I just thought I would try the simple steps first, and slowly integrate it in that way troubleshooting is easier. How do I find the API output so we can see what is going wrong?
Hey guys, Trying to modify some more stuff on my macros and can't seem to figure this part out. I'm trying to add a conditional statement to an attack that will allow the player to get at least 1 damage (They have a negative modifier for STR) when they use an attack. This is what I've come up with, but it won't show the damage in the damage section of the script. Damage Conditional: --:Damage| --=IDamage|1 + [*S:strength_mod] [STR] --?[$IDamage.Total] -le 0| 1 --?[$IDamage.Total] -gt 0| [$IDamage.Total] --X| Damage Roll for Script: --:Hit| --=Damage|[$Damage] --+Hit!|The attack hit [*T:character_name] for [$Damage] Bludgeoning damage. --X| This is what's popping in chat:
1629778905

Edited 1629805499
timmaugh
Pro
API Scripter
daniel e. said:  How do I find the API output so we can see what is going wrong? API Output (Logging?) Not sure about "API output"... there is only the output that the dev builds in to their script (for instance, to log). Typically, logging statements, if they exist in the script, will hit the script console at the bottom of every script tab in your script library. Chances are, there isn't much there typically -- no one wants to spam up your log as a rule. If you have access to the code of that script (ie, you copy/pasted it in or you "imported" it from the 1-click instead of installing), you can drop log statements in at various points to try to figure out where it is going wrong. That isn't for everyone. ZeroFrame offers a log that applies to what it sees, which gets you at least one level of insight. You can get it by adding {&log} to a macro. It will show you how the command line is changing for each of your installed metascripts for each loop over them (if they find a construct and change the line, for instance). Adding that to the ScriptCards call will show you the activity on the ScriptCards message stack. If you just wanted to focus on the init-assist stack, you could defer the logging statement using the ^ character somewhere in the construct: {^&log} Your Issue Now, as to the problem you're facing... I think your roll is being parsed as a part of the ScriptCards message object. All of the data that is a part of the roll is in that message. The command line that reaches your scripts no long contains the roll equation, though. That gets replaced with a roll index marker: $[[0]] Most scripts know how to unpack that to get the value out of the referenced roll, provided they have access to the underlying information in the message object. In this case, ScriptCards is issuing the call to init-assist... but what InitAssist sees is a roll index marker without the underlying data. This is a new message object; the roll was already parsed as a part of the ScriptCards message. You have a few options. First, you could defer the roll using ScriptCards deferral character: --@init-assist| _Troll|[^[^1d20^]^] That will force the roll to wait to be rolled until ScriptCards strips those characters out and sends the roll equation to InitAssist (rather than just the roll index without the underlying data). The second option is to use the ZeroFrame .value construct to extract the value: --@init-assist| _Troll|[[1d20]].value That gets the roll value while we're still in ScriptCards, before we ever call InitAssist. InitAssist will only see the final value. Your third option is the command syntax native to ScriptCards to extract a roll value manually. I'm not completely fluent on the SC syntax, but I think it involves *not* structuring this as an inline roll that Roll20 will detect and parse, but rather just the equation without enclosing brackets. Later in your macro, there is a way to refer to a given roll and get the base value from it. I'm sure one of the SC gurus can tell you what the specific syntax is.
1629803834

Edited 1629805065
David M.
Pro
API Scripter
Daniel, if this is the version of init-assist you are using, I believe the problem you are running into is that line 129 requires the command to be sent from the GM. Since scriptcards is sending it, and scriptcards is not a GM, the script exits prematurely. if (msg.type !== "api" || !playerIsGM(msg.playerid)) { return; } If you change that line to the following, your test example as written worked for me. if (msg.type !== "api") { return; } Also looks like the player ribbon needs to be on the map you are on, but since you said it was working I'm assuming you already have that part sorted.  EDIT - when debugging scriptcard api calls, I will often temporarily change the --@ line to a direct output line (--+). So, in your case: !script {{ --+@init-assist| _Troll|[[1d20]] }} Then you can paste the output into a macro window, remove the pipe ( | ), replace the @ with !  and replace _ with -- for testing the syntax that is actually getting sent to/from scriptcards.
1629805022
David M.
Pro
API Scripter
Arthur, looks like your conditional to set the min damage has incorrect syntax. See the following example for the correct way to directly assign a roll variable value based on a conditional ( here is the section of the wiki describing it). If you spam this in chat a few times you will see it in action. !script {{ --=Damage|1d3 - 1 --+original Damage|[$Damage] --?[$Damage] -le 1|=Damage;1 --+final damage (min 1)|[$Damage] }}
1629805423
timmaugh
Pro
API Scripter
That's a good catch, David. I would add that if Daniel doesn't want to change the lines of code, he could enable SelectManager to give back to the "player" of the message: !smconfig +playerid That will tell SM to give back the playerid property of the message object when it sees an API message come through. The only time this might be unwanted would be if there are campaign-watching scripts that fire off messages if something in the game changes. *Other* scripts sometimes key off of whether the campaign watching script was sent from a player or the API to know what to do in response. This potential unwanted interaction is pretty rare, however.
1629805822
David M.
Pro
API Scripter
I was pretty sure there was a way to do that, Tim, but I was too lazy to look it up, haha! That is a one-time command persistently stored in the State object, right?
1629809435
timmaugh
Pro
API Scripter
Yep, fire and forget! =D Or, I suppose if you really wanted to, you could fire, run your ScriptCards command, then unfire (all in the same macro), and THEN forget. You could do that, too. >D
Ok i've posted this same message 3 times now but it's not showing up on the forum? I'm confused. BUT it works guys! Mostly at least. Code without the 'fluff': !script {{ --&name|[[1t[High-CR-Table]]].value --&charid|@($[[0]].value.character_id) --=tokenSize|[*[&charid]:token_size] --{& select Andee}@forselected|!Spawn _name|[&name] _size| [$tokenSize] --@init-assist| _[&name]|[[1d20]] }} So,  the last hiccup is that the token doesn't spawn in time for the executed line. Init-assist just returns: please spawn a token then [button]Add Turn. After the token is spawned I can click the button and it will add the initiative to the tracker. I dont know how to use the deferral character, I tried it with multiple variations to no avail.
1629821869
timmaugh
Pro
API Scripter
The deferral character only applies for calls to other scripts (lines that begin --@ ). The presence of the character makes normal Roll20-detectable constructions... well... undetectable. If Roll20 sees... [[ It will try to parse it as an inline roll, which happens when you send the ScriptCard command. If you don't want that roll to be detected until the secondary script is called, you have to break up the string of characters that key Roll20 into this being an inline roll. ScriptCards gives you the ^ character to do this: [^[^ SelectManager lets you define one attached to your forselected handle: forselected(†) In any case, it sounds like Spawn might still be asynchronous. Until that changes (which also means I get my butt in gear for the Plugger integration), you might need to utilize a Delay script. Then you can slow down your init-assist a second or two. You don't need lightning-quick registration to the Tracker anyway. You just need the token to get there eventually. Besides, in the meantime your players will be watching the tokens spawn on the map, fearful of what is to come. =D I can't remember the syntax off the top of my head, but it will be something like: --@delay| 2 _!init-assis| _[&name]|[[1d20]]
Timmaugh, Well, I installed the delay script, and looked on the forum. There is this line which I'm a little confused at: API COMMANDS: You can call other API commands and delay them there is a catch however. If the API command in question uses msg.playerid in it do the following to make it compatible with !delay Search for the following in the function that handles chat:message: if (msg.type !== "api") {     return; } And Directly Below it add the following: if (!state. commandname _pid)     state. commandname _pid = "API";                 if (msg.playerid !== "API")     state. commandname _pid = msg.playerid; else     msg.playerid = state. commandname _pid;           Replace " commandname " with the command name in question or the script name. I tried without doing this, and the scriptcards command just ran 3 times spawning whole oodles of monsters. Kinda funny. I then tried following the delay instructions, putting in all of the follwing combinations for [commandname]: scriptcards, init-assist, initiative-assistant, init_assit, Init_assistant, initassist, initassistant. The ones with the '-' returned error something about "left-handed argument", and the rest either did nothing, or duplicated the scriptcards code again. I feel like I'm slightly in over my head, and without you and David fixing all my problems, I's be utterly lost. Thank you guys really...
1629836247
timmaugh
Pro
API Scripter
Yeah... that instruction isn't clear... nor is it set up to protect you from what you're running into. In javascript, you can't have a hyphen in a property name except that you turn it into a string and use it with bracket notation. Lots of words to say the original example should have been: state.[`commandname_pid`] = "API"; I think the one you need is "init-assist"... but I'll have to read the code of that script to tell you for sure.
David M. said: Arthur, looks like your conditional to set the min damage has incorrect syntax. See the following example for the correct way to directly assign a roll variable value based on a conditional ( here is the section of the wiki describing it). If you spam this in chat a few times you will see it in action. !script {{ --=Damage|1d3 - 1 --+original Damage|[$Damage] --?[$Damage] -le 1|=Damage;1 --+final damage (min 1)|[$Damage] }} Hmmm. Still doesn't seem to be working. --:Damage| --=IDamage|1 + [*S:strength_mod] [STR] --+Original Damage|[$Damage] --?[$Damage] -le 1|=Damage;1 --+FinalDamae (min 1)|[$Damage] --X| --:Hit| --=Damage|[$Damage] --+Hit!|The attack hit [*T:character_name] for [$Damage] Bludgeoning damage. --X| Chat Output:
1629891041
David M.
Pro
API Scripter
Arthur, can you post your full scriptcard macro? My suspicion is that your "lDamage" variable is a typo rather than an intentional secondary roll variable? 
Arthur - Just a silly question but there looks like a possible typo: --=IDamage|1 + The character in front of Damage variable? It is not repeated as such in the  --+| or other statement.
I have another fun question for you all! I'm stumped. I'm trying to add sneak attack query to a scriptcards attack roll that auto-applies damage. !scriptcard {{ --#title|Dagger Attack! --#titleFontSize| 40px --#bodyFontSize| 24px --#leftsub|Hybrid Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|1d20 + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[sneakq] -eqi Yes|[ --=sneak|@{Andee|level}/2 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]|[ --=sneak|0 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]| --^Final| --:Crit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[sneakq] -eqi Yes|[ --=sneak|@{Andee|level}/2 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + 1d4 [CRIT] + [$sneak] + [$sneak] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]|[ --=sneak|0 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]| --:Final| }} The ?sneakq prompt comes up, and the damage applies normally, but the sneak attack value in the roll is 0. I'm a little stumped.
1629934270
David M.
Pro
API Scripter
Daniel, Your sneak attack string variable is missing the "&" in each of the conditionals.  Each instance of this:   --?[sneakq] -eqi Yes|[ should be    --?[&sneakq] -eqi Yes|[
1629936742

Edited 1629937668
David M. said: Arthur, can you post your full scriptcard macro? My suspicion is that your "lDamage" variable is a typo rather than an intentional secondary roll variable?  Michael C. said: Arthur - Just a silly question but there looks like a possible typo: --=IDamage|1 + The character in front of Damage variable? It is not repeated as such in the  --+| or other statement. @Michael C. - I fixed the typo @David M. - Here's the whole Macro: !scriptcard {{ --#title|Unarmed strike --#leftsub|Melee Attack --#rightsub|Range: 5 ft. --#whisper|gm --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|[*S:character_name] ?{Unarmed Strike|Punch,punches|Kick,kicks|Head Butt,head butts|Elbow, elbows|Knee,knees} at [*T:character_name]! --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|?{Advantage/Disadvantage|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + [*S:strength_mod] [STR] + [*S:pb] [PROF] --+Attack:|[$AttackRoll] vs [$TargetAC]. --?[$AttackRoll] -eq 20|Crit --?[$AttackRoll] -eq 1|Fumble --?[$AttackRoll] -ne 20 -and [$AttackRoll] -ge [$TargetAC.Total]|Hit --?[$AttackRoll.Base] -ne 1 -and [$AttackRoll] -lt [$TargetAC.Total]|Miss --X| --:Damage| --=Damage|1d1 + [*S:strength_mod] [STR] --+Original Damage|[$Damage] --?[$Damage] -le 0|=Damage;1 --+FinalDamage (min 1)|[$Damage] --X| --:Fumble| --+Fumble!|The attack went horribly wrong! --X| --:Hit| --=Damage|[$Damage] --+Hit!|The attack hit [*T:character_name] for [$Damage] Bludgeoning damage. --X| --:Miss| --+Miss|The attack missed! --X| --+Crit| --=Damage|[$Damage] + 1 [STR] --+Critical Hit!|The attack hit [*T:character_name] for [$Damage] Bludgeoning damage. --X| }}
1629988455

Edited 1629988790
@Arthur B. - couple of things: This line will fail:   --#emoteText|[*S:character_name] ?{Unarmed Strike|Punch,punches|Kick,kicks|Head Butt,head butts|Elbow, elbows|Knee,knees} at [*T:character_name]! It seems to be an attempt to emote a line that is a direct output combined with a conditional parameter with no variable specified for the conditional parameter.  The others here can correct me if I am wrong but I don't believe that you can use emoteText in this manner as it is processed first before other functions such as assigning variables nor can you mix a direct output with a conditional statement. The best you can do would be: --emoteText|[*S:character_name] Launches an Unarmed Attack on [*T:character_name]! Also, a conditional statement requires a variable be assigned first:  --&Unarmed| ?{Unarmed Strike|Punch,punch|Kick,kick|Head Butt,head butt|Elbow,elbow|Knee,knee} --+|[*S:character_name] launches a(n) [&Unarmed] attack at [*S:character_name]! Another thing, your damage subroutine is never called so no damage is ever calculated.  You need a --> or --^ statement in your hit and crit subroutines or eliminate the --X| at the end of your attack subroutine to allow the damage to calculate and add the conditional hit/crit/miss/fumble conditional statements to the end of the damage subroutine.  (You won't need the damage statements in the hit or crit subroutines as they seem superfluous as is the --:Done with AC| branch label.) Edit: I will PM you one of my attack macros to use as a template if you like.
1629997161

Edited 1629997284
David, Thanks for the fix, can't believe I missed that. I'm nearly done with the attack now except for one last instance. I added the option to roll with advantage, and every roll works perfect except for Non-Advantage Crits. If the roll is without Advantage, and rolls a 20 the script does not jump to the :Crit branch. It will process the hit as normal. However, crits work with advantage, and fumbles work correctly for both instances as well. !scriptcard {{ --#title|Dagger Attack! --#titleFontSize| 40px --#bodyFontSize| 24px --#leftsub|Hybrid Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=dmgMOD|0 --=hitMOD|0 --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --&adv|?{Attack with Advantage?|Yes,Yes |No,No} --?[&adv] -eqi Yes|[ --=advRoll|2d20kh1 --=AttackRoll|[$advRoll] + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF] + [$hitMOD] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$advRoll] -eq 20|Crit --?[$advRoll] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --]|[ --=AttackRoll|1d20 + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF] + [$hitMOD] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --]| --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[&sneakq] -eqi Yes|[ --=sneakdie|@{Andee|base_level}/2{ROUND} --=sneak|[$sneakdie]d6 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$dmgMOD] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]|[ --=sneak|0 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$dmgMOD] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]| --^Final| --:Crit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[&sneakq] -eqi Yes|[ --=sneakdie|@{Andee|base_level}/2{ROUND} --=sneak|[$sneakdie]d6 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$dmgMOD] + 1d4 [CRIT] + [$sneak] + [$sneak] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]|[ --=sneak|0 --=Damage|1d4 + @{selected|dexterity_mod} [DEX] + [$dmgMOD] + [$sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]| --:Final| }} EDIT: I'm dumb. I have the crit branch for non-sneak incorrect. Sometimes walking away from the screen helps!
Since the threads are hard to search, I'm wondering if someone could help me. I'm trying to build a script card for Eldritch Blast. I've got the spell part to work just fine, now I'm trying to add in the Dark One's Blessings which gives the character temp HP if they reduce an enemy to 0 HP. Any help would be appreciated. 
@ Michael Michael C. said: @Arthur B. - couple of things: This line will fail:   --#emoteText|[*S:character_name] ?{Unarmed Strike|Punch,punches|Kick,kicks|Head Butt,head butts|Elbow, elbows|Knee,knees} at [*T:character_name]! It seems to be an attempt to emote a line that is a direct output combined with a conditional parameter with no variable specified for the conditional parameter.  The others here can correct me if I am wrong but I don't believe that you can use emoteText in this manner as it is processed first before other functions such as assigning variables nor can you mix a direct output with a conditional statement. The best you can do would be: ^^^This line just gives the PC a chance to select what kind of Unarmed attack they want by giving them a drop down menu to select from.. This part actually works pretty well. --emoteText|[*S:character_name] Launches an Unarmed Attack on [*T:character_name]! Also, a conditional statement requires a variable be assigned first:  --&Unarmed| ?{Unarmed Strike|Punch,punch|Kick,kick|Head Butt,head butt|Elbow,elbow|Knee,knee} --+|[*S:character_name] launches a(n) [&Unarmed] attack at [*S:character_name]! Another thing, your damage subroutine is never called so no damage is ever calculated.  You need a --> or --^ statement in your hit and crit ^^^This part here  I'm not sure how to work those, so I've never worked with them yet. subroutines or eliminate the --X| at the end of your attack subroutine to allow the damage to calculate and add the conditional hit/crit/miss/fumble conditional statements to the end of the damage subroutine.  (You won't need the damage statements in the hit or crit subroutines as they seem superfluous as is the --:Done with AC| branch label.) Edit: I will PM you one of my attack macros to use as a template if you like. I would love an example to use for attacks. I don't have any of my Macros auto-deduct damage though (my players like to do that on their own).
Hi all, I'm trying to make a groupcheck scriptcard pretty similar to the script api, but that takes into consideration the immunities/resistances/vulnerabilities, and then have a button at the end of the first part of the scriptcard to applydamage... So here's where i'm at for my demand but I have a few issues that i'll lisst after the code (i've used the Burning hands from kurt as a base) !script {{ --/|Demande quel JP, quel DD, quels degats, quel effet sauvegarde, quel type dégats --=saveType|?{Quel JP?|Dexterité,dex|Constitution,con|Sagesse,wis} --=DC|?{DD ?|15} --=Damage|?{Dégats} --=DCeffect|?{Effet Sauvegarde ?|Annule,annule|Demi dégats,demi} --=damageType|?{Quel type de Dégats ?|Acide,acid|Contondant,bludgeoning|Feu,fire|Force,force|Foudre,lightning|Froid,cold|Nécrotique,necrotic|Perforant,piercing|Poison,poison|Psychique,psychic|Radiant,radiant|Tonnerre,thunder|Tranchant,slashing} --/|Get all of the tokens on the page so we can cache their positions --~|array;pagetokens;alltokens;@{selected|token_id} --#leftsub|DD [$DC] --#rightsub|Dégats: [$Damage] --#title|JP de Groupe --#titleCardBackground|#03038a --#oddRowBackground|#d8d8e6 --#evenRowBackground|#FFFFFF --#whisper|gm --/|Calculate damage --=HalfDamage|[$Damage.Total] \ 2 --=DoubleDamage|[$Damage.Total] * 2 --=QuarterDamage|[$Damage.Total] \ 4 --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the --/|top of the card. If all critters make their save, the half damage roll won't contain the details. --+|[c][b]Damage Roll: [/b][$Damage][/c] --+| --/|Create an array with the selected token --~tokenid|array;selectedtokens;Selected --/|The first item in the array will be a blank dummy item, so remove it. --~|array;removeat;selected;0 --/|Loop through the tokensHit tokens and roll saves for each one and apply damage --~tokenid|array;getfirst;Selected --?[&tokenid] -eq ArrayError|endOutput --:loopDisplay| --=SaveRoll|1d20 + [*[&tokenid]:npc_[&saveType]_save] --/|Compare the save roll to the save DC and either apply full or half damage --?"[*[&tokenid]:npc_immunities]" -inc "[&damageType]"|Immune --?"[*[&tokenid]:npc_resistances]" -inc "[&damageType]"|Resistant --?"[*[&tokenid]:npc_vulnerabilities]" -inc "[&damageType]"|Vulnerable --?[$SaveRoll.Total] -lt [&DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total] --?[$SaveRoll.Total] -ge [&DC]|madeSave --/|Here are various damage applications if the creature is immune, resistant, or vulnerable. In some cases, we will reuse output lines, --/|for example, a resistant creature that fails its save will jump to "madeSave", since that is the correct damage amount. (half), while --/|a vulnerable creature that makes its save will jump to "FailedSave" since that will be normal damage. --/|Output a line for a failed saving throw (we will also jump here for a vulnerable creature that MAKES its save) --:FailedSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$Damage] [&damageType][/r] --^afterSave| --:Immune| --+[*[&tokenid]:t-name]:|n'est pas affecté par le sort ! --^afterSave| --:Resistant| --?[$SaveRoll.Total] -lt [&DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$QuarterDamage.Total] --?[$SaveRoll.Total] -lt [&DC]|madeSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$QuarterDamage] [&damageType][/r] --^afterSave| --:Vulnerable| --?[$SaveRoll.Total] -lt [&DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$DoubleDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total] --?[$SaveRoll.Total] -ge [&DC]|FailedSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$DoubleDamage] [&damageType][/r] --^afterSave| --/|Output a line for a successful saving throw --:madeSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$HalfDamage] [&damageType][/r] --:afterSave| --~tokenid|array;getnext;Selected --?[&tokenid] -ne ArrayError|loopDisplay --:endOutput| --X| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| }} So here are the issues i see so far (there might be more but i haven't tried every option yet) Damage calculation is always a quarter even if the creature made the save The bonus isn't calculated (always undefined) immunities are not noted when applyable, and thus damage still a quarter. FYI, i'm using the 5e OGL sheet According to my script, when i prompt to dc effect, there's a possibilty to have none damage (so basically same as immune) if i select "annule" but i don't know how to get that in the loop. I'm also using a prompted DC because the selected token are the victims, not the caster... Also, i'd like to add a button at the bottom of the card, so i can click on it to THEN apply damages and not automatically. For the moment, the dmages are applied automatically, but i really don't know where and how in the script i can create this button or clickable line. I already know that my array for selected tokens is probably wrong, but i ca,'t find where it's wrong or what is the correct syntax. That array problem is probably why the bonus calculation isn't correct too... Hope you can help me correct what 'im doing wrong (and i'm sure there are quite a few mistakes unfortunately...) Thx
daniel e. said: I have another fun question for you all! I'm stumped. I'm trying to add sneak attack query to a scriptcards attack roll that auto-applies damage. Here is how I handle sneak attack and bless. It check the 5E OGL sheet for the Sneak attack and bless check boxes then applies the info automatic.  Uses the dnd5elib in a handout. !scriptcard {{ +++dnd5elib+++ --#title|Dagger --#leftsub|Melee Attack, Thrown --#rightsub|Range: 5' :20/60, Finesse --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --/| >>>>> Formatting <<<<< --#titlecardbackgroundimage|linear-gradient(360deg, rgba(2,0,36,1) 0%, rgba(147,39,41,1) 100%); --#emoteBackground|#transparent --#titleCardBackground|#932729 --#titlefontsize|1.75em --#titlefontlineheight|1.75em --#titleFontColor|white --#titlefontface|Shadows Into Light --#subtitleFontSize|12px --#subtitleFontFace|Verdana --#evenRowBackground|#B6AB91 --#evenRowFontColor|#000000 --#oddRowBackground|#CEC7B6 --#oddRowFontColor|#000000 --:|What is the Base Weapons Damage express 1dx --&BaseWeaponDamage|1d4 --:|Magic change settings here --=Magic|0 --:|Damage Type Slashing, Bludgeoning, Piercing --=DamageType|Piercing --:| Check for attack mods like Bless and Damage mods like Sneak Attack -->Lib5E_Active_Global_Attack_Modifiers|@{selected|character_id};Bless -->Lib5E_Active_Global_Damage_Modifiers|@{selected|character_id};Sneak;CritDam --:|Get Targets AC --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --?[*S:strength_mod] -gt [*S:dexterity_mod]|>SetMod;strength|>SetMod;dexterity --:|Advantage, Disadvantage, Normal --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --=AttackRoll|[&RollType] [BASE] + [&FinesseMod] [MOD] + [*S:pb] [PROF] + [$Magic] [Magic] [&Bless] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --+Base roll:| [b] [$AttackRoll.Base] [/b] --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --=Damage| [&BaseWeaponDamage] + [&FinesseMod] [MOD] + [$Magic] [Magic] [&Sneak] --+Hit!|The attack hit @{target|token_name} for [$Damage] [$DamageType.RollText]. --+Rolled:|[b][$Damage.Text] [/b] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --^Healthcheck| --:Crit| --=Damage|[&BaseWeaponDamage]+ [&FinesseMod] [MOD] + [&BaseWeaponDamage] [CRIT] [&Sneak] [&CritDam] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] [$DamageType.RollText]. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --:Healthcheck| --=targethp|@{target|Bar1}-[$Damage] --?[$targethp] -lt 1|Dead --^Final| --:Dead| --+Status:|[b]@{target|token_name} is Dead and worth @{target|npc_XP}[/b] --@token-mod|_ids @{Target|token_id} _set statusmarkers|path-dead --:Final| --:SetMod|which mod to use --&FinesseMod|[*S:[%1%]_mod] --<| --:Final| --X| }}
@Kurt - pretty please with sugar on top, could you add emote text color option to your next update?  ( i.e. --#emoteFontColor|# ) Thankee!
Related to my previous post, could anyone help me with the correct syntax for a multiple selection array so my group check script attempt could work?  It seems like it doesn't work properly and I have the feeling that my array syntax isn't correct.  Merci 
@Lionel - just a passing glance.  DC is being assigned as a numerical value (--=DC) but called as a string (&DC).  This may be part of your problem. I also note several construction issues. I have PMed you an attack based macro (Weapon Attack) [twice by accident, sorry] and a save based spell macro (Chain Lightning) which should help you with your questions.
So I'm working on this script for a barbarian. I've got it so it queries rage and adds the appropriate bonus, but I am also trying to get it to query if he is using Reckless Attack. It will ask, but it doesn't seem to be rolling the attack roll properly (with advantage) and if it is, it doesn't show me that it did.  !scriptcard  {{   --#title|Blackout   --#leftsub|Melee Attack   --#rightsub|One Handed   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|@{selected|token_name} attacks @{target|token_name}        --=RageTest|?{Raging? |No,1|Yes,2}      --?[$RageTest] -eq 2|=RageBonus;[$Rage]|=RageBonus;0      --:Rage|       --=Level|[*S:base_level]       --?[$Level] -lt 9|=RageCount;2       --?[$Level] -gt 8 -and -lt 16|=RageCount;3       --?[$Level] -gt 15|=RageCount;4      --=TargetAC|@{target|npc_ac}   --?[$TargetAC.Total] -gt 0|DoneWithAC   --=TargetAC|@{target|ac}   --:DoneWithAC|        --=RATest|?{Reckless Attack? |No,1|Yes,2}       --?[$RATest] -eq 2|=Reck;2d20kh1|=Reck;1d20      --=AttackRoll|[$Reck] + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] + 3 [MagicBonus]   --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC].   --?[$AttackRoll.Base] -eq 20|Crit   --?[$AttackRoll.Base] -eq 1|Fumble   --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit      --+Miss|The attack missed.   --X|   --:Fumble|   --+Fumble!|The attack went horribly wrong.   --X|   --:Hit|   --=Damage|1d8 + @{selected|strength_mod} [STR] + 3 [MagicBonus] + [$RageCount.Total] [RAGE]   --=TotalDamage|[$Damage]   --+Hit!|The attack hit @{target|token_name} for [$Damage] bludgeoning damage.   -->ApplyDamage|_target|@{target|token_id} _bar|3 _amount|-[$TotalDamage]   -->PlayEffects|none;glow-blood;none   --X|   --:Crit|   --=Damage|2d6 + @{selected|strength_mod} [STR] + 3 [MagicBonus] +1d8 [CRIT] + [$RageBonus] [RAGE]   --=TotalDamage|[$Damage]    --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] bludgeoning damage.   -->ApplyDamage|_target|@{target|token_id} _bar|3 _amount|-[$TotalDamage]    -->PlayEffects|none;bomb-blood;none   --X|      --:PlayEffects|Parameters are : source effect; target effect; line effect   --vtoken|@{selected|token_id}    --vtoken|@{target|token_id}    --vbetweentokens|@{selected|token_id} @{target|token_id}    --<|      --:ApplyDamage|   --@alter|_target|@{target|token_id} _bar|3 _amount|-[$TotalDamage] }}
Hi,  With Michael's help, I've been able to correct some mistakes I made.  I actually corrected all the $ and & mistakes and it seems to work pretty well now.  !script {{ --/|Demande quel JP, quel DD, quels degats, quel effet sauvegarde, quel type dégats --&saveType|?{Quel JP?|Dexterité,dex|Constitution,con|Sagesse,wis} --=DC|?{DD ?|15} --=Damage|?{Dégats} --&DCeffect|?{Effet Sauvegarde ?|Annule,annule|Demi dégats,demi} --&damageType|?{Quel type de Dégats ?|Acide,acid|Contondant,bludgeoning|Feu,fire|Force,force|Foudre,lightning|Froid,cold|Nécrotique,necrotic|Perforant,piercing|Poison,poison|Psychique,psychic|Radiant,radiant|Tonnerre,thunder|Tranchant,slashing} --/|Get all of the tokens on the page so we can cache their positions --~|array;pagetokens;alltokens;@{selected|token_id} --#leftsub|DD [$DC] --#rightsub|Dégats: [$Damage] --#title|JP de Groupe --#titleCardBackground|#03038a --#oddRowBackground|#d8d8e6 --#evenRowBackground|#FFFFFF --#whisper|gm --/|Calculate damage --=HalfDamage|[$Damage.Total] \ 2 --=DoubleDamage|[$Damage.Total] * 2 --=QuarterDamage|[$Damage.Total] \ 4 --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the --/|top of the card. If all critters make their save, the half damage roll won't contain the details. --+|[c][b]Damage Roll: [/b][$Damage][/c] --+| --/|Create an array with the selected token --~tokenid|array;selectedtokens;Selected --/|The first item in the array will be a blank dummy item, so remove it. --~|array;removeat;selected;0 --/|Loop through the tokensHit tokens and roll saves for each one and apply damage --~tokenid|array;getfirst;Selected --?[&tokenid] -eq ArrayError|endOutput --:loopDisplay| --=SaveRoll|1d20 + [*[&tokenid]:npc_[&saveType]_save] --/|Compare the save roll to the save DC and either apply full or half damage --?"[*[&tokenid]:npc_immunities]" -inc "[&damageType]"|Immune --?"[*[&tokenid]:npc_resistances]" -inc "[&damageType]"|Resistant --?"[*[&tokenid]:npc_vulnerabilities]" -inc "[&damageType]"|Vulnerable --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total] --?[$SaveRoll.Total] -ge [$DC]|madeSave --/|Here are various damage applications if the creature is immune, resistant, or vulnerable. In some cases, we will reuse output lines, --/|for example, a resistant creature that fails its save will jump to "madeSave", since that is the correct damage amount. (half), while --/|a vulnerable creature that makes its save will jump to "FailedSave" since that will be normal damage. --/|Output a line for a failed saving throw (we will also jump here for a vulnerable creature that MAKES its save) --:FailedSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$Damage] [&damageType][/r] --^afterSave| --:Immune| --+[*[&tokenid]:t-name]:|n'est pas affecté par le sort ! --^afterSave| --:Resistant| --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$QuarterDamage.Total] --?[$SaveRoll.Total] -lt [$DC]|madeSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$QuarterDamage] [&damageType][/r] --^afterSave| --:Vulnerable| --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$DoubleDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total] --?[$SaveRoll.Total] -ge [$DC]|FailedSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$DoubleDamage] [&damageType][/r] --^afterSave| --/|Output a line for a successful saving throw --:madeSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$HalfDamage] [&damageType][/r] --:afterSave| --~tokenid|array;getnext;Selected --?[&tokenid] -ne ArrayError|loopDisplay --:endOutput| --X| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| }} Now i have 2-3 last issues in what i try to achieve. First  : For DCeffect, when i choose "annule" i'd like to have the script jump to the immune save test part. For example, some cantrips can affect several creatures, but there are no effect if they make the save. I should put a conditional : maybe something like --?"[*[&DCeffect]] -inc "annule" -and [$SaveRoll.Total] -ge [$DC]|Immune Would that be correct ? And should i put this in the list of rolls comparisons ? or somewhere else ? Second  : I'd like to put a button so the damages are rolled only if i press this button, and not automatically as it is for the moment. How to write this button command ?and do i have to put it instead of every >applydamagetokenmod commands ? or only once just before the tokenmod command ? Third (but that's just a little cherry on the big cake) :  I have a little tokenmod macro that puts the deadmarker and switch the token to the maplayer when one of my monsters dies (that is helpful when i have a lot of monsters, because it puts them "toback" and prevents me to select them by mistake. How easy would it be to say that : --?"[*[&tokenid]:bar1] -lt 1|>applytokenmarkerandmoveitonmaplayer Would that work ? There's no "or else" in that line...don't know if it needs one or not, and i think i should probably put some parameters in that subroutine call Where would that subroutine be placed in the script ? Would the script remember whose token we're talking about ? It seems pretty easy but maybe it's not that easy at all.... Thanks for your help. 
1630597207
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt - pretty please with sugar on top, could you add emote text color option to your next update?  ( i.e. --#emoteFontColor|# ) Thankee! Will do, and I'll make the emotefont actually work (/hide) :)
Just wanted to let you guys know that on this page... <a href="https://wiki.roll20.net/Script:ScriptCards" rel="nofollow">https://wiki.roll20.net/Script:ScriptCards</a> ... the link that is labelled "API Working and Sharing" is no longer working. It worked for me as soon as I removed the text at the end of the URL, though. I dunno... maybe this is an error that only I am experiencing. But still, I wanted to let you guys know, just in case other people might be getting shut out of the (awesome) "API Working and Sharing" thread. Lastly, you guys are awesome! Keep it up! :-D
1630686868
Kurt J.
Pro
API Scripter
Ronnie McDurgen said: Just wanted to let you guys know that on this page... <a href="https://wiki.roll20.net/Script:ScriptCards" rel="nofollow">https://wiki.roll20.net/Script:ScriptCards</a> ... the link that is labelled "API Working and Sharing" is no longer working. It worked for me as soon as I removed the text at the end of the URL, though. I dunno... maybe this is an error that only I am experiencing. But still, I wanted to let you guys know, just in case other people might be getting shut out of the (awesome) "API Working and Sharing" thread. Lastly, you guys are awesome! Keep it up! :-D Thanks Ronnie. I fixed the Wiki page... there was a missing space :)
Hello Everyone! I had a questiong about roll query prompts. I would like to have unused conditional roll querys not pop up to be prompted. for instance: !script {{ --&amp;answer|?{this is the question|1|2|3} --:1| --&amp;color|?{whats your favorite color?|Red|Blue} --^end| --:2| --=biscuits|?{How many biscuits do you have?|four|five} --^end| --:3| --?[&amp;answer] -eq 3|Branch --^end| --:Branch| --&amp;butter|?{Do you like butter?|Yes|No} --:end| }} Im wondering if there is a way to write this where the unused branches/conditional querys aren't prompted. The practical use of this is a "level-up" script, where the API will ask "is this character at a level of receiving an Ability increase? if yes, prompt user to select which stat to increase. Else, level as normal."
1630706856

Edited 1630706900
Try the --I (Input) command.&nbsp; I've also used the [rbutton] syntax to create a series of multiple choice options.&nbsp;&nbsp;
1630711964

Edited 1630712459
Kurt J.
Pro
API Scripter
ScriptCards 1.4.0d - and a new distribution method I've moved exclusively to GitHub for distributing new versions of ScriptCards (Before they go to OneClick). This means that I won't be updating the old GIST any longer. The home for ScriptCards going forward will be&nbsp; <a href="https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_API" rel="nofollow">https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_API</a> . This location now contains 1.4.0d of ScriptCards, which has the following updates: Cleans HTML out of button captions to prevent some instances of non-working buttons. New settings to support emote fonts. If you used the #emotefont setting before, everything should still work as before, but it was inconsistent with the way other fonts are handled. There are now new settings: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; emotefont &nbsp;: will be passed to to font-family in the inline style, so essentially the font name. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; emotefontweight : Default is "bold". &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; emotefontsize &nbsp;: Default is "14px". &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; emotefontcolor : Hex or color name specifier
1630715777
Andrew R.
Pro
Sheet Author
Coming from PowerCards, I've been using the " PowerCard Formats" handout and the&nbsp; --format tag like Air: --bgcolor|#FFA500 to colour the monster's cards to match the monster's token borders. (Orange is the colour of the Air Rune in Glorantha) I'm curious what the recommended way to do this in ScriptCards is now? So far I have created Macros in my Macro Mule like&nbsp; !scriptcard {{ &nbsp; &nbsp; --#titlecardbackground|#FFA500 &nbsp; &nbsp; --Ssettings|RuneAir }} and started my monster macros like !scriptcard&nbsp; {{ --Lsettings|RuneAir This is working fine, but is there a more Transmogrifier friendly method than this?
@Daniel e. - sorry friend but the problem with the --? command is that Roll20 will request input for any and all that it sees. It's a problem.&nbsp; (You must be working with a game that doesn't have a charactermancer that automates leveling.)&nbsp; You can try work arounds using a combination of the --i command which will stop processing of the macro while it receives input and/or --c commands for decision-making.
@Kurt J. - My hero!
1630800367
Kurt J.
Pro
API Scripter
Andrew R. said: Coming from PowerCards, I've been using the " PowerCard Formats" handout and the&nbsp; --format tag like Air: --bgcolor|#FFA500 to colour the monster's cards to match the monster's token borders. (Orange is the colour of the Air Rune in Glorantha) I'm curious what the recommended way to do this in ScriptCards is now? So far I have created Macros in my Macro Mule like&nbsp; !scriptcard {{ &nbsp; &nbsp; --#titlecardbackground|#FFA500 &nbsp; &nbsp; --Ssettings|RuneAir }} and started my monster macros like !scriptcard&nbsp; {{ --Lsettings|RuneAir This is working fine, but is there a more Transmogrifier friendly method than this? There isn't anything directly corresponding to the handout-based formats because of the headaches of the in-game editor... however, if you have a macro mule character you can set up one macro that creates all of your saved settings for you and transport that between games. When the --S runs, it saves the settings as they are at that moment, so you could do something like: !scriptcard {{ &nbsp; &nbsp; --#titlecardbackground|#FFA500 &nbsp; &nbsp; --Ssettings|RuneAir --#titlecardbackground|#00FF55 --Ssettings|Forest --#titlecardbackground|#FF00FF --Ssettings|PinkTown }}
1630800963

Edited 1630822258
Andrew R.
Pro
Sheet Author
Thank you! I shall take your advice and merge my testing macros into one in my macro mule character. Edit: it’s working fine.&nbsp;
Total noob question here, but in the scripts what fonts can be used? Is there a list somewhere, or is it the typical fonts found in Word?
I've tried tweaking the lightning bolt script to use as a breath weapon. It keeps breaking the sandbox. Here is the error. Any ideas? Error: Firebase.update failed: First argument contains NaN in property 'bar3_value' Error: Firebase.update failed: First argument contains NaN in property 'bar3_value' at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186) at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at J.update (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave (/home/node/d20-api-server/api.js:901:27) at Timeout.later [as _onTimeout] (/home/node/d20-api-server/node_modules/underscore/underscore-node-f.cjs:1146:37) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)
1630981719

Edited 1630981856
Kurt J.
Pro
API Scripter
ScriptCards 1.4.0e and a new Sample Script I've uploaded a new version (1.4.0e) of ScriptCards on the&nbsp; GitHub Repository &nbsp;that contains a couple of bug fixes that could cause sandbox crashes in the ReplaceVariableContent and RemoveBRs functions. This version should be coming to OneClick as well. The D&amp;D 5E Script Examples folder on the GitHub now contains a new example for a Dragonborn Breath macro: If your character was created via the Charactermancer, nothing else needs to be done. The script will check your repeating_traits to determine what kind of dragon you are. If your character was created manually, you'll need to add a "draconicheritage" attribute to the character, set to the dragon type (red, black, green, etc.) If it can't figure anything else out, it will default to a black dragon. Scales damage by character level Implements either 30' line or 15' cone based on dragon type Supports token-mod, alterbars, or none for applying damage (see the first few lines of the script to select one. Default is token-mod) You can set the bar number you use to track hit points at the beginning of the script as well. Let me know if you run into bugs!