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

1614022945
David M.
Pro
API Scripter
Well, technically if you had all of the token_ids I suppose you could loop through them and use one of the built-in distance functions, but how would you tell scriptcards which ids to check against without doing a "select all" beforehand? That would be a pretty expensive brute force operation, not to mention your player wouldn't be able to select any npc tokens. If you tried to use target, you'd have to know the number of targets ahead of time, which kind of defeats the purpose. What you are describing (full automation) sounds like it would best be handled by another api script that scriptcards could call. I would probably just spawn the AoE origin token with a defined radius aura first, then select the tokens in the aura and either use the GroupCheck script or a scriptcard with the selected tokens to make all the saves and display results. You could make the group save macro into a token ability on the AoE origin token's character sheet. Since Spawn can't set auras (yet, that's a good idea for thenext rev), you'd either have a different AoE token for each spell radius, or add a token-mod command to first set the radius based on a query.
Why does this not work? !script {{ --#whisper|gm --?”Text String” -inc “Text”|Works --+Fail| --X| --:Works| --+Success| --X| }}
@David M. Yeah, that sounds right. Darn.
1614028428

Edited 1614028855
Kurt J.
Pro
API Scripter
DM Goss said: David M. That's exactly what I was trying to do. Thanks. I thought this was pretty cool, so I started playing around with it to resolve an issues: If more than one of the same critter appears, they can spawn on top of each other. This version uses the almost-equivalent of an array to track spawn positions and summon the critters in a cluster around and the target character (those could be changed, of course). It also uses a subroutine to handle all of the spawning !scriptcard {{ --#titlecardbackground|#65D52A --#title|From The Bag Of Tricks --#sourceToken|@{selected|token_id} --~Animals|string;split;:;Weasel:Giant Rat:Badger:Boar:Panther:Giant Badger:Dire Wolf:Giant Elk --~Offsets|string;split;:;0,1:0,-1:1,0:1,1:1,-1:2,0:2,-1:2,1 --=AnimalCount|?{How many creatures do you want to pull from the bag?|1|2|3} --#emotetext|@{selected|character_name} pulls [$AnimalCount.Total] things out of a bag of tricks! --=Counter|0 --:AddAnAnimal| --=RollAnimal|1d8 --=Counter|[$Counter] + 1 -->Summon|[$RollAnimal.Total];[$Counter.Total] --?[$Counter.Total] -lt [$AnimalCount.Total]|AddAnAnimal --X| --:Summon|Animal number to summon;Counter into Offsets --@forselected+|Spawn _name|[&Animals[%1%]]|_offset|[&Offsets[%2%]]|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+|@{selected|token_name} pulls out a [&Animals[%1%]]! --<| }}
1614028834
Kurt J.
Pro
API Scripter
Colin C. said: Why does this not work? !script {{ --#whisper|gm --?”Text String” -inc “Text”|Works --+Fail| --X| --:Works| --+Success| --X| }} Your quotes are getting mangled by whatever editor you are using... it is replacing them with Word Processing style quotes that "point" in different directions. !script {{ --#whisper|gm --#debug|1 --?"Text String" -inc "Text"|Works --+Fail| --X| --:Works| --+Success| --X| }} That works for me...
1614034411

Edited 1614035661
David M.
Pro
API Scripter
Kurt J. said: I thought this was pretty cool, so I started playing around with it to resolve an issues: If more than one of the same critter appears, they can spawn on top of each other. This version uses the almost-equivalent of an array to track spawn positions and summon the critters in a cluster around and the target character (those could be changed, of course). It also uses a subroutine to handle all of the spawning That's pretty slick, Kurt! The Spawn script has several placement options for multiple quantities of the same token (or sides of a rollable table token), but it's cool to have an elegant scriptcard solution that can handle spawning different "characters" without stacking. Thanks for sharing! EDIT - I linked to your scriptcard in the main Spawn thread. Trying to spread the gospel, haha!
Kurt J. said: Your quotes are getting mangled by whatever editor you are using... it is replacing them with Word Processing style quotes that "point" in different directions. !script {{ --#whisper|gm --#debug|1 --?"Text String" -inc "Text"|Works --+Fail| --X| --:Works| --+Success| --X| }} That works for me... Wow. Ok. Hopefully what I was trying to do can be done, then, because this baffled me. Will explore later.
Colin C. said: Kurt J. said: Your quotes are getting mangled by whatever editor you are using... it is replacing them with Word Processing style quotes that "point" in different directions. !script {{ --#whisper|gm --#debug|1 --?"Text String" -inc "Text"|Works --+Fail| --X| --:Works| --+Success| --X| }} That works for me... Wow. Ok. Hopefully what I was trying to do can be done, then, because this baffled me. Will explore later. Just make sure you're not using smart quotes (that curl in or out) in whatever app you're using to write the Scriptcard. You want "dumb" quotes that are straight, up and down, just like the ones that appear in this post.
Kurt J. said: DM Goss said: David M. That's exactly what I was trying to do. Thanks. I thought this was pretty cool, so I started playing around with it to resolve an issues: If more than one of the same critter appears, they can spawn on top of each other. This version uses the almost-equivalent of an array to track spawn positions and summon the critters in a cluster around and the target character (those could be changed, of course). It also uses a subroutine to handle all of the spawning !scriptcard {{ --#titlecardbackground|#65D52A --#title|From The Bag Of Tricks --#sourceToken|@{selected|token_id} --~Animals|string;split;:;Weasel:Giant Rat:Badger:Boar:Panther:Giant Badger:Dire Wolf:Giant Elk --~Offsets|string;split;:;0,1:0,-1:1,0:1,1:1,-1:2,0:2,-1:2,1 --=AnimalCount|?{How many creatures do you want to pull from the bag?|1|2|3} --#emotetext|@{selected|character_name} pulls [$AnimalCount.Total] things out of a bag of tricks! --=Counter|0 --:AddAnAnimal| --=RollAnimal|1d8 --=Counter|[$Counter] + 1 -->Summon|[$RollAnimal.Total];[$Counter.Total] --?[$Counter.Total] -lt [$AnimalCount.Total]|AddAnAnimal --X| --:Summon|Animal number to summon;Counter into Offsets --@forselected+|Spawn _name|[&Animals[%1%]]|_offset|[&Offsets[%2%]]|_order|toFront|_fx|nova-magic|_expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+|@{selected|token_name} pulls out a [&Animals[%1%]]! --<| }} That works great. I was wondering if it were possible to change the token size. Most of the animals have a size of 1,1. However, the dire wolf has a size of 2,2 and the Giant Elk has a size of 3,3. I did it with the original using _size| 2,2 or _size| 3,3 attribute in Spawn.
1614054531

Edited 1614054611
David M.
Pro
API Scripter
You could add a "Sizes" string array underneath the Offset declaration --~Sizes|string;split;:;1,1:1,1:1,1:1,1:1,1:1,1:2,2:3,3 then add the _size command to the Spawn line  --@forselected+|Spawn _name|[&Animals[%1%]] _offset|[&Offsets[%2%]] _size|[&Sizes[%1%]] _order|toFront _fx|nova-magic _expand|15,30 Note: untested, but it's basically just handled the same as the Animal name. The Sizes array has 8 elements, each looking like the strings "1,1" "2,2" etc. [&Sizes[%1%]] returns the nth element in the array,         where n is [%1%], the first number that is already passed to the >Summon function (the d8 roll, aka [$RollAnimal.Total])
David M, I tried to do that myself and it didn't work, but I didn't have the spaces in it. The way you have it set up above works well. Thanks.  
I've encountered a bug: hyperlinked text in a ScriptCard output line that includes consecutive dashes in the destination address (i.e., something like <a href="http://journal.roll20.net/handout/-MPoOv2dDBAV--7ZUw9f" rel="nofollow">http://journal.roll20.net/handout/-MPoOv2dDBAV--7ZUw9f</a>) causes incomplete readout.
1614119269

Edited 1614119290
I wanted to thank David M and Kurt J on my Bag of Tricks macro. I made a few additional changes to it, so I wanted to share it with everyone who might be interested. I took David's advice and added sections to resize the tokens properly. Then I added a subroutine that check the attributes to see how many animals are left in the bag (bagoftrick_left). If there's not enough, it tells the user so and tells them how many animals are left in the bag. Then I added a&nbsp;ChatSetAttr command to deduct the appropriate number of animals. Below is the Bag Of Tricks Macro: !scriptcard {{ --#titlecardbackground|#65D52A --#title|From The Bag Of Tricks --#sourceToken|@{selected|token_id} --~Animals|string;split;:;Weasel:Giant Rat:Badger:Boar:Panther:Giant Badger:Dire Wolf:Giant Elk --~Offsets|string;split;:;0,1:0,-1:1,0:1,1:1,-1:2,0:3,-3:4,4 --~Sizes|string;split;:;1,1:1,1:1,1:1,1:1,1:1,1:2,2:3,3 --=AnimalCount|?{How many creatures do you want to pull from the bag?|1|2|3} --=BagSlots|[*S:bagoftrick_left] --?[$BagSlots.Total] -lt [$AnimalCount.Total]|NotEnough --@modbattr|_name @{selected|character_name} _bagoftrick_left|-[$AnimalCount.Total] _silent --#emotetext|@{selected|character_name} pulls [$AnimalCount.Total] things out of a bag of tricks! --=Counter|0 --:AddAnAnimal| --=RollAnimal|1d8 --=Counter|[$Counter] + 1 --&gt;Summon|[$RollAnimal.Total];[$Counter.Total] --?[$Counter.Total] -lt [$AnimalCount.Total]|AddAnAnimal --X| --:Summon|Animal number to summon;Counter into Offsets --@forselected+|Spawn _name|[&amp;Animals[%1%]] _offset|[&amp;Offsets[%2%]] _size|[&amp;Sizes[%1%]] _order|toFront _fx|nova-magic _expand|15,30 --@roll20AM| _audio,play,nomenu|Teleport Spell --+|@{selected|token_name} pulls out a [&amp;Animals[%1%]]! --&lt;| --:NotEnough| --#titlecardbackground|#F71805 --#emotetext|Bag Of Tricks Doesn't Have Enough Animals! --+|[$BagSlots.Total] Animals Left --X| }}
Does anyone know if there is there a way to check if a token ID has a status marker applied to it, and if so, what the name of the status marker is?
1614124802
Kurt J.
Pro
API Scripter
Phillip K. said: Does anyone know if there is there a way to check if a token ID has a status marker applied to it, and if so, what the name of the status marker is? Currently there isn't, because the attribute reference command try to find attributes on characters, and the status markers are stored on the token itself. There are a few values like this that would probably be useful to be able to grab from ScriptCards. I'll look at adding a way to reference them.
1614127374

Edited 1614127396
timmaugh
Pro
API Scripter
Getting information from the token is also in the works for APILogic... both testing and retrieval. The testing would be useful in an IF's condition set, but the retrieval could then plug that information into any other script's command line as a string (including ScriptCards). As long as the receiving script was good to accept the data in that position (from a formatting/parsing point of view), APILogic could go fetch the data and bring it back.
1614128589
David M.
Pro
API Scripter
timmaugh the meta-scriptomancer!
Anyone know where the "possible infinite loop" in this is? !script {{ --#title|Action Card Loops --#whisper|gm --#sourcetoken|@{selected|token_id} --&gt;FeatureLoop|class;base_level;subclass --X| --:FeatureLoop|base class v. multiclass; base level v. multiclass level; subclass --&gt;[*S:[%1%]]|[*S:[%2%]];[*S:[%3%]] --&lt;| --:Warlock|level; subclass --?[%1%] -ge 3|&gt;FindPact --&lt;| --:FindPact| --Rfirst|[*S:character_id];repeating_traits --:PactLoop| --?"[*R:name]" -inc "Pact of the "|SetPact --Rnext --?"[*R:name]" -ne NoRepeatingAttributeLoaded|PactLoop --&lt;| --:SetPact| --~Pact|string;replace;Pact of the ;;[*R:name] --+|[&amp;Pact] --&lt;| }}
1614221671
Kurt J.
Pro
API Scripter
Colin C. said: Anyone know where the "possible infinite loop" in this is? --?"[*R:name]" -inc "Pact of the "|SetPact I believe this line is the issue. The jump to SetPact should be procedural (&gt;SetPact). Otherwise it will return back to the previous procedure call when it ends.
Kurt J. said: --?"[*R:name]" -inc "Pact of the "|SetPact I believe this line is the issue. The jump to SetPact should be procedural (&gt;SetPact). Otherwise it will return back to the previous procedure call when it ends. That's what I want it to do: each Warlock should only have one "Pact of the &lt;thing I'm looking for&gt;" in their traits. Adding the &gt; causes the same error. I've truncated out a ton of other stuff from the overall card (other classes, subclass calls, spells, etc.), and this is the only series of calls that produces this error. The idea is essentially this: select a PC token, run the Card, get output that will display race, class, subclass, level, any multiclass info, and then display all their various race/class features that impact action economy (e.g. Cunning Action, Channel Divinity, Sentinel, etc.).&nbsp; So, for a given warlock, once the script identifies their Pact, I want it to go back to the last procedure call, which was &gt;FindPact--as I understand it (I'm not a programmer, so I very well might be doing something wrong!), any branching that occurs between the &gt; call and the return &lt; makes the return go back to whatever was the most recent &gt; call, right? So, once the Pact is identified, the FindPact procedure is done, and the script should go to the next line. In the full script, the next line is another procedure call for other stuff, which works just fine (here, it's just another return &lt;, back to FeatureLoop, and then a return to the top of the card, which then ends). I've got almost &nbsp;everything else working how I want it! Still working on getting spells to show up right, but at least that doesn't break the sandbox!
Now I'm well and truly stumped: I started over again, piece by piece, wound up with the *exact same* code, and it works. Go figure. Maybe I had a hard-return instead of a soft-return somewhere?
1614295241
Kurt J.
Pro
API Scripter
We're on OneClick The 1.0.0 release of ScriptCards is now available for installation via OneClick. Now that the OneClick install has gone through, I'll work on wrapping up 1.0.5 for release here over the weekend and updating OneClick with that version as well. Version 1.0.5 will include some tweaks to the regex used to replace underscores in API commands to accommodate the (rare) situation where a tokenid has sequential dashes in it, and to tweak the splitting of card lines to allow for the same. Also included will be the ability to reference token properties.
Kurt J. said: &nbsp;Also included will be the ability to reference token properties. Yes!!
Colin C. said: Kurt J. said: &nbsp;Also included will be the ability to reference token properties. Yes!! Agreed, that's great news!!
Ok, new problem: For some of my monsters, I've edited the action description so that when the description is displayed in chat, it includes an ability button. E.g.: Multiattack The guardian makes two [fist](~Shield Guardian|Fist) attacks. So far so good. In my big macro that I'm using in conjunction with CombatMaster2.0 to run at the start of every token's turn, I want to populate a card with the various abilities the character has. I'm using a repeating section display loop to look for all the actions the NPC has. That part works fine. The problem is that when I run this line: --+[*R:name]|[*R:description] What I get on the card for that line is: Multiattack &nbsp;The guardian makes two [fist](~Shield Guardian The description is truncated at "|" And yet: --+[*R:name]|The guardian makes two [fist](~Shield Guardian|Fist) attacks. I get: Multiattack &nbsp;The guardian makes two&nbsp; fist &nbsp;attacks. Which is exactly what I want to display. So, somewhere there's a delimiter operation happening when the repeating section description is pulled, so it cuts off the | and everything after it.
1614372233
GiGs
Pro
Sheet Author
API Scripter
Is the shield guardian|fist attack in a repeating section? If so you'll need to supply the repeating section name as well (and maybe its row index). When you click a button from inside a repeating section, roll20 fills in the necessary data automatically to make it work. When you are printing a button to chat, it doesnt, and you have to supply the missing information to make it work.
GiGs said: Is the shield guardian|fist attack in a repeating section? If so you'll need to supply the repeating section name as well (and maybe its row index). When you click a button from inside a repeating section, roll20 fills in the necessary data automatically to make it work. When you are printing a button to chat, it doesnt, and you have to supply the missing information to make it work. "Fist" is an ability the Shield Guardian has. So, if I just type into chat [Fist](~Shield Guardian|Fist), I get the button I want. I use the same syntax on the character sheet as well. Reference . If I put the entire syntax into the Content of a direct output line, that works too. The problem is, I can't hard-code every action, trait, legendary action, etc., that way--the whole point is for ScriptCards to look through all of the possible Actions/Traits/whatever and show those and only those, to include the button. The issue is definitely with a delimiter. When ScriptCards is processing [*R:description], if the content string includes a |, it splits the content into two pieces, and leaves only whatever came before |. I tried giving the Shield Guardian a trait called "Test Trait" and description "This has a | in it." When I run [*R:description] for that line, the output is "This has a" and that's it. I tried filtering out descriptions that -inc a |, but that doesn't work because [*R:description] has already removed the |, so the filter doesn't catch anything--and the rest of the description is already gone.
1614392279
GiGs
Pro
Sheet Author
API Scripter
Your previous comment said this: &nbsp;I'm using a repeating section display loop to look for all the actions the NPC has.&nbsp; Thats why I wondered if the issue was a repeating section.
Colin C. said: Ok, new problem: For some of my monsters, I've edited the action description so that when the description is displayed in chat, it includes an ability button. E.g.: Multiattack The guardian makes two [fist](~Shield Guardian|Fist) attacks. So far so good. In my big macro that I'm using in conjunction with CombatMaster2.0 to run at the start of every token's turn, I want to populate a card with the various abilities the character has. I'm using a repeating section display loop to look for all the actions the NPC has. That part works fine. The problem is that when I run this line: --+[*R:name]|[*R:description] What I get on the card for that line is: Multiattack &nbsp;The guardian makes two [fist](~Shield Guardian The description is truncated at "|" And yet: --+[*R:name]|The guardian makes two [fist](~Shield Guardian|Fist) attacks. I get: Multiattack &nbsp;The guardian makes two&nbsp; fist &nbsp;attacks. Which is exactly what I want to display. So, somewhere there's a delimiter operation happening when the repeating section description is pulled, so it cuts off the | and everything after it. Could u post the script?
1614427302

Edited 1614427573
Kurt J.
Pro
API Scripter
Colin C. said: GiGs said: Is the shield guardian|fist attack in a repeating section? If so you'll need to supply the repeating section name as well (and maybe its row index). When you click a button from inside a repeating section, roll20 fills in the necessary data automatically to make it work. When you are printing a button to chat, it doesnt, and you have to supply the missing information to make it work. "Fist" is an ability the Shield Guardian has. So, if I just type into chat [Fist](~Shield Guardian|Fist), I get the button I want. I use the same syntax on the character sheet as well. Reference . If I put the entire syntax into the Content of a direct output line, that works too. The problem is, I can't hard-code every action, trait, legendary action, etc., that way--the whole point is for ScriptCards to look through all of the possible Actions/Traits/whatever and show those and only those, to include the button. The issue is definitely with a delimiter. When ScriptCards is processing [*R:description], if the content string includes a |, it splits the content into two pieces, and leaves only whatever came before |. I tried giving the Shield Guardian a trait called "Test Trait" and description "This has a | in it." When I run [*R:description] for that line, the output is "This has a" and that's it. I tried filtering out descriptions that -inc a |, but that doesn't work because [*R:description] has already removed the |, so the filter doesn't catch anything--and the rest of the description is already gone. You are correct that internally the | character is used as a delimiter in the retrieval of replacement information. I'll see what I can do to remedy this in the version that will come out this weekend. If you want to try updating manually in the mean time, replace line 1559 (in 1.0.2) with: attribute = repeatingSection[i].split("|").slice(1,999).join("|"); and let me know your results.
Slightly weird issue, I'm trying to call scriptcards and tokenmod and there is one specific instance where this is failing to work. For instance: /fx bomb-fire !scriptcard {{ --#title|Blinding Spark Distraction --#leftsub|Reflexive Charm --#rightsub|2 Motes --#titleCardBackground|#e3751b --+|Harkon raises a shower of blinding sparks. --+|(On Parry or metal on metal hit, -2 Dice to foes next turn, Wits+Dodge for 1/2) }} !token-mod --set bar2_value|-2 Works and subtracts from bar 2 like it should. However the following does not: !scriptcard {{ --#title|Dragon Graced Weapon --#leftsub|Reflexive Charm --#rightsub|1 Mote --#titleCardBackground|#e3751b --+|Harkon sets his weapon ablaze --=JBDice|?{Bonus dice (Stunts, charms, etc)|0}+@{selected|Dexterity}+@{selected|Melee2} --=JBHits|[$JBDice.Total]d10&gt;6+[$JBDice.Total]d10&gt;9+?{Bonus Successes(Charms, etc)|0}-@{target|DV} --?[$JBHits.Total] -gt 0|strikecall --+|...but the attack missed --^Final| --:strikecall| --+Hits|[$JBHits] --=JBDamageDice|@{selected|Strength}+[$JBHits.Total]+4-@{target|soak} --=Damage|[$JBDamageDice.Total]d10&gt;6+4 --+Damage|[$Damage] lethal --^Final| --:Final| }} !token-mod --set bar2_value|-1 I am absolutely not a coder so apologies if I am doing something wrong. I thought it may have been the branching code messing with things but it seems to fail even if I take out the branch. It's weird because tokenmod works fine with my other scriptcards.
1614430606
David M.
Pro
API Scripter
Brockie, I would suggest moving your token-mod call into the scriptcard itself. I sometime see strange behavior like this when trying to string multiple !api's in the same macro, where sometimes one or more of the ! calls don't fire. Check out the scriptcards wiki for more information on how to make api calls from your card. But basically, it would look something like this: ...all your previous scriptcard code... &nbsp; --:Final| &nbsp; --@token-mod|_set bar2_value|-1 }} Plus, this would allow you to use your scriptcard variables to adjust bar values by a variable amount, for example. &nbsp; --@token-mod|_set bar2_value|-[$Damage]
1614434537
Kurt J.
Pro
API Scripter
David M. said: Brockie, I would suggest moving your token-mod call into the scriptcard itself. I sometime see strange behavior like this when trying to string multiple !api's in the same macro, where sometimes one or more of the ! calls don't fire. Check out the scriptcards wiki for more information on how to make api calls from your card. But basically, it would look something like this: ...all your previous scriptcard code... &nbsp; --:Final| &nbsp; --@token-mod|_set bar2_value|-1 }} Plus, this would allow you to use your scriptcard variables to adjust bar values by a variable amount, for example. &nbsp; --@token-mod|_set bar2_value|-[$Damage] One caveat is that you will either need to use the --ids option for Token-Mod or use SelectManager to pass the selected token(s) to token-mod. This is likely why the original is failing as well. The currently selected token is being lost somewhere along the line (the Roll20 UI is odd about this).
Hi David, Thanks for the help, the solution you posted pointed me in the right direction! From what I can see TokenMod isn't compatible with scriptcard - the error persisted even when moved into scriptcard. However, you got me thinking about it and trying alternatives and AlterBars seems to work just fine. The code that worked is below, once JBCharmCost is defined this has, so far, worked every time. --@alter|_target|@{selected|token_id} _bar|2 _amount|-[$JBCharmCost]
Brockie said: Hi David, Thanks for the help, the solution you posted pointed me in the right direction! From what I can see TokenMod isn't compatible with scriptcard - the error persisted even when moved into scriptcard. However, you got me thinking about it and trying alternatives and AlterBars seems to work just fine. The code that worked is below, once JBCharmCost is defined this has, so far, worked every time. --@alter|_target|@{selected|token_id} _bar|2 _amount|-[$JBCharmCost] I use tokenmod inside scriptcards all the time and haven't had an issue. But as mentioned above, you have to use the id command or tokenmod won't work. This syntax works for me: &nbsp; --@token-mod|_ids @{target|token_id} _set bar1_value|+[$HealingAmount]!
1614451540
David M.
Pro
API Scripter
Ah right, guys, I forgot about selected id and token mod! _ids works, or with SelectManager it would be&nbsp; &nbsp;--@forselected+|token-mod _set bar2_value|-1
1614461792

Edited 1614462010
I am experiencing a somewhat strange error.&nbsp; I had the Github manual version installed. When the one-click version came out I deleted the github manual, and then installed the one-click version.&nbsp; For some reason it does not work and sends me this error. When I went back to the manual version everything worked again.&nbsp;
Rober M. said: I am experiencing a somewhat strange error.&nbsp; I had the Github manual version installed. When the one-click version came out I deleted the github manual, and then installed the one-click version.&nbsp; For some reason it does not work and sends me this error. When I went back to the manual version everything worked again.&nbsp; Same
I am getting same error as Bicio and Rober M. above Rober M. said: I am experiencing a somewhat strange error.&nbsp; I had the Github manual version installed. When the one-click version came out I deleted the github manual, and then installed the one-click version.&nbsp; For some reason it does not work and sends me this error. When I went back to the manual version everything worked again.&nbsp;
1614533956

Edited 1614534227
Kurt J.
Pro
API Scripter
Very strange... using the "Import" button from the OneClick page works fine, but adding the script via OneClick produces the indicated error. I've submitted a support request to see if it can be resolved.
1614543560
Duncan R.
Pro
Sheet Author
Kurt J. said: Very strange... using the "Import" button from the OneClick page works fine, but adding the script via OneClick produces the indicated error. I've submitted a support request to see if it can be resolved. Not just your script I notice this happening for anything I tried to add yesterday. Not got around to following it up.
Can someone please tell me why I'm getting the error:&nbsp; No attribute was found for @{TARGET:hp|max} for this line? --?@{target|hp} -eq @{target|hp|max}|DoneWithDamage I'm trying to compare the target's current HP against their Max HP to determine if they are damaged at all. Thanks.
@Kurt: That worked! Thanks! For reference, the problematic line (pre-fix), is under NPCActions. For those who've been asking for my script, either to help or to poach for their own nefarious purposes, here is the current monstrosity: !script {{ --#sourcetoken|@{selected|token_id} --#title|[*S:character_name]'s Combat Options --&gt;SpeedFix|[*S:speed] --&amp;CR| --&amp;AC|[*S:ac] --&gt;HP| --#whisper|gm --?[*S:npc] -eq 1|NPC --#leftsub|[&amp;Speed] [&amp;HP] --#rightsub|[*S:npc_type] --&amp;Actions|You have no actions from your race or class. --&amp;Bonus|You have no bonus actions from your abilities/spells. --&amp;Reactions|You have no reactions from your abilities/spells. --&amp;Special|You have no special combat features from your race or class. --&amp;FullCast|no --&gt;AttributeDisplay| --/|&gt;Lib5E_RaceBackgroundClass| --&gt;RCDisplayLoop|Race --?[*S:subrace]1 -ne 1|&gt;RCDisplayLoop;Subrace --+Background|[*S:background] --&gt;RCDisplayLoop|Level --&gt;RCDisplayLoop|Class --&gt;RCDisplayLoop|Subclass --?[*S:level] -eq [*S:base_level]|Features|&gt;RCDisplayLoop;Base_level --:Features| --&gt;RaceFeatureLoop|[*S:race];[*S:subrace];[*S:level] --&gt;BackgroundFeatureLoop|[*S:background] --&gt;ClassFeatureLoop|class;base_level;subclass --:BeginFeatureDisplay| --&gt;PCTraits| --=Lvl|0 --&gt;SpellChecking|[*S:character_id] --&gt;FeatureDisplayLoop|Actions --:EndActionsDisplay| --?"[*S:retainers]" -ne undefined|&gt;Retainers --X| --:RCDisplayLoop|R/C Attribute --~Name|string;split;_;[%1%] --?[&amp;Name1] -inc Base|&gt;BaseFix --?[&amp;Name2] -inc l|&gt;MultiFix;[&amp;Name1]|&gt;FixName;[%1%] --&amp;Name|[&amp;Name1] [&amp;Name2] --~Name|string;replace;lvl;Level;[&amp;Name] --~Name|string;replace;subclass;Sub.;[&amp;Name] --?[&amp;Name] -inc Multi|&gt;MultiCut;[&amp;Name] --+[&amp;Name]|[*S:[%1%]] --&lt;| --:MultiFix| --&amp;Name1|[*S:[%1%]] --&lt;| --:MultiCut| --~Name|string;left;10;[&amp;Name] --&lt;| --:BaseFix| --&amp;Name1|[*S:class] Level --&amp;Name2| --&lt;| --:FeatureAddLoop|Which what action economy;feature to append --&amp;[%1%]|+^^[%2%] --&lt;| --:FeatureDisplayLoop|Which action economy --&amp;ActionType|[%1%] --?[%1%] -eq Bonus|&gt;FixActionName --?[%1%] -eq Special|&gt;FixActionName --+[c][&amp;ActionType][/c]| --=Num|2 --~[%1%]|string;split;^^;[&amp;[%1%]] --?[$[%1%]Count] -eq 1|&gt;NoExtras;[%1%] --:ActionsDisplayLoop| --?[$Num.Total] -gt [$[%1%]Count]|EndActionsLoop --~Display|string;split;!!;[&amp;[%1%][$Num.Total]] --~ButtonCheck|string;split;.;[&amp;Display2] --?[$ButtonCheckCount] -ge 4|&gt;Buttonize;[&amp;Display2] --+[&amp;Display1]|[&amp;Display2] --=Num|[$Num] + 1 --&gt;ActionsDisplayLoop|[%1%] --:EndActionsLoop| --C[%1%]|Actions:&gt;FeatureDisplayLoop;Bonus|Bonus:&gt;FeatureDisplayLoop;Reactions|Reactions:&gt;FeatureDisplayLoop;Special|Special:EndActionsDisplay --:NoExtras| --+|[&amp;[%1%]] --&lt;| --:Buttonize|Content of display line --&amp;Display2|[button]Description::!&amp;#13;/w [*S:character_name] [&amp;Display2][/button] --:FixActionName| --~ActionType|string;replace;Bonus;Bonus Actions;[&amp;ActionType] --~ActionType|string;replace;Special;Abilities Requiring No Action;[&amp;ActionType] --&lt;| --:ClassFeatureLoop|base class v. multiclass; base level v. multiclass level; subclass --:ExtraAttackChecks|Sorting out fighter vs. other martial class extra attacks --?[*S:[%1%]] -eq Fighter -and [*S:[%2%]] -ge 5|&gt;FighterEA;[*S:[%2%]] --?[$HasEAtt] -eq 1|AfterExtraAttack --?[*S:[%1%]] -eq Barbarian -or [*S:[%1%]] -eq Monk -or [*S:[%1%]] -eq Paladin -or [*S:[%1%]] -eq Ranger -and [*S:[%2%]] -ge 5|&gt;HasEAtt --:AfterExtraAttack| --:FullCaster|Sorting out where character has a lot of spells --?[&amp;FullCast] -eq Yes|AfterFullCast --?[*S:[%1%] -eq Bard -or [*S:[%1%] -eq Cleric -or [*S:[%1%] -eq Druid -or [*S:[%1%] -eq Sorcerer -or [*S:[%1%] -eq Wizard -and [*S:[%2%]] -ge 5|&gt;FullCaster --?[*S:[%1%] -eq Paladin -or [*S:[%1%] -eq Artificer -or [*S:[%1%] -eq Ranger -or [*S:[%1%] -eq Warlock -and [*S:[%2%]] -ge 9|&gt;FullCaster --:AfterFullCast| --&lt;| --:PCTraits| --Rfirst|[*S:character_id];repeating_traits --:TraitLoop| --?"[*R:description]" -inc "bonus action"|&gt;FeatureAddLoop;Bonus;[*R:name]!![*R:description] --?"[*R:description]" -inc reaction|&gt;FeatureAddLoop;Reactions;[*R:name]!![*R:description] --?"[*R:description]" -inc action -or "[*R:description]" -inc "at will" -and "[*R:description]" -ninc reaction -and "[*R:description]" -ninc "bonus action"|&gt;FeatureAddLoop;Actions;[*R:name]!![*R:description] --?"[*R:description]" -inc "rest"|&gt;FeatureAddLoop;Special;[*R:name]!![*R:description] --Rnext| --?"[*R:name]" -ne NoRepeatingAttributeLoaded|TraitLoop --&lt;| --:HP| --=HPPerc|[*S:hp] / [*S:hp^] * 100 \ 1 --&amp;HP|[*S:hp]/[*S:hp^]hp ([$HPPerc.Total]%) --&lt;| --:SpeedFix|character speed and appends “ft.” if necessary --~Speed|string;replace; ft.;;[%1%] --&amp;Speed|+ ft. --&lt;|return to leftsub --:AttributeDisplay| --+|[b]Str[/b] [*S:strength]([*S:strength_mod])[r][b]Int[/b] [*S:intelligence]([*S:intelligence_mod])[/r] --+|[b]Dex[/b] [*S:dexterity]([*S:dexterity_mod]) [r][b]Wis[/b] [*S:wisdom]([*S:wisdom_mod])[/r] --+|[b]Con[/b] [*S:constitution]([*S:constitution_mod])[r][b]Cha[/b] [*S:charisma]([*S:charisma_mod])[/r] --+|[b]AC[/b] [&amp;AC] [r][&amp;CR][/r] --&lt;| --:NPC| --&amp;AC|[*S:npc_ac] --&amp;CR|[b]Challenge Rating[/b] [*S:npc_challenge] --&amp;HP| --#leftsub|[&amp;Speed] [&amp;HP] --#rightsub|[*S:npc_type] --#whisper|gm, [*S:character_name] --&gt;AttributeDisplay| --:NPCTraits| --Rfirst|[*S:character_id];repeating_npctrait --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCActions --=Index|0 --+[c]Traits[/c]| &nbsp;--:NPCTraitsDisplayLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCActions --+[*R:name]|[button]Details::!&amp;#13;/w [*S:character_name] &amp;#37;{[*S:character_id]|[*R:name]}[/button] --Rnext| --=Index|[$Index] + 1 --&gt;NPCTraitsDisplayLoop| --:NPCActions| --+[c]Actions[/c]| --Rfirst|[*S:character_id];repeating_npcaction --=Index|0 &nbsp;--:NPCActionsDisplayLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCReactions --/|?"[*R:description]" -inc ~|&gt;FixDesc;[&amp;Desc] &nbsp;--+[*R:name]|[*R:description][*R:attack_damage] [*R:attack_damagetype] [button]Details::!&amp;#13;/w [*S:character_name] &amp;#37;{[*S:character_id]|repeating_npcaction_$[$Index.Total]_npc_action}[/button] &nbsp;--?[*R:attack_damage2]1 -eq 1 -or "[*R:attack_damage2]" -inc *|NoSecondaryDamage --+ |[*R:attack_damage2] [*R:attack_damagetype2] &nbsp;--:NoSecondaryDamage| &nbsp;--Rnext| --=Index|[$Index] + 1 --&gt;NPCActionsDisplayLoop| --:NPCReactions| --Rfirst|[*S:character_id];repeating_npcreaction --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCLegendary --+[c]Reactions[/c]| &nbsp;--:NPCReactionsDisplayLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCLegendary --+[*R:name]|[*R:description] --Rnext| --&gt;NPCReactionsDisplayLoop| --:NPCLegendary| --Rfirst|[*S:character_id];repeating_npcaction-l --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCSpells --+[c]Legendary Actions[/c]|[*S:npc_legendary_actions]/round &nbsp;--:NPCLegendaryDisplayLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCSpells --+[*R:name]|[*R:description] --Rnext| --&gt;NPCLegendaryDisplayLoop| --:NPCSpells| --?[*S:npcspellcastingflag] -ne 1|NPCDone --+[button]Spells::!&amp;#13;/w [*S:character_name] Does Nothing Yet[/button]| --:NPCDone| --X| --:FixDesc| --~Button|string;split;|;[*R:description] --+|[&amp;Button1] --+|[&amp;Button2] --&lt;| --:Retainers| --+[c]Retainers[/c]| --~Retainers|string;split;|;[*S:retainers] --=Num|1 --:RetainerDisplayLoop| --+[&amp;Retainers[$Num.Total]]|[button]Show Card::!&amp;#13;&amp;#37;{[&amp;Retainers[$Num.Total]]|Show-Card}[/button] --=Num|[$Num] + 1 --?[$Num.Total] -le [$RetainersCount]|RetainersDisplayLoop --&lt;| }} I realized recently that I was hardcoding *way* too much--typing out all the various class abilities and doing a conditional procedure call based on class and level to add the content to the respective action economy. But as I was working on Eldritch Invocations, I discovered it was much easier to just search the repeating traits section descriptions for keywords (e.g., reaction, bonus action, etc.) and sort them that way. I cut out a section on checking casting times for spells because the display got really cluttered for full casters, and I'm working on a replacement but it's not ready yet. This script is otherwise reasonably close to done, at least as a version 1.0. I need to add back in the multiclass display calls and the section for spells, and a little more base content (e.g., everyone has certain basic actions they perform, like Dash and Disengage, and Opportunity Attacks). After that, I'll work on making it look better and some other cosmetic changes, I think. Once I figure out how to do that.
1614615915

Edited 1614623037
Roll20's Target calls are a little wonky when looking for attribute maximums. These calls work: @{target|hp} @{target|The Target of the Call for Which I'm looking for information|hp} @{target|The Target of the Call for Which I'm looking for information|hp|max} Yours does not work because, when you have 3 parameters, Roll20 thinks the second parameter is the pseudonym of the the target. In your case, it thinks you're looking for a target, which you are calling "hp," and looking for an attribute named "max," which does not exist. I think the purpose behind what I'm calling the pseudonym parameter is that, particularly because you might have multiple target calls, you may need to differentiate between them someway, which requires a pseudonym. Something like: @{target|Monster|token_name} does mean, evil, nasty things to @{target|Hero|token_name}. Hero is reduced to @{target|Hero|hp}/@{target|Hero|hp|max}! When you run that line through the chat server, you'll get two targeting prompts, one for the Monster and one for the Hero. So, what you need is a pseudonym parameter, and you need to include in every instance of that target call. --?@{target|Pseduonym|hp} -eq @{target|Pseudonym|hp|max}|DoneWithDamage Or, if you're only going to have one target, you can use --#targettoken|@{target|character_id} more script, maybe --?[*T:hp] -eq [*T:hp^]|DoneWithDamage Phillip K. said: Can someone please tell me why I'm getting the error:&nbsp; No attribute was found for @{TARGET:hp|max} for this line? --?@{target|hp} -eq @{target|hp|max}|DoneWithDamage I'm trying to compare the target's current HP against their Max HP to determine if they are damaged at all. Thanks.
1614622378

Edited 1614657075
David M.
Pro
API Scripter
EDIT 3 - Figured it out! Will create new post to avoid confusion. OK, so here's a brain teaser. I'm trying to workout a way to sort a series of die rolls, using a classic bubble sort algorithm. VB equivalent (0-based array) For i = LBound(MyArray) To UBound(MyArray) - 1 For j = i + 1 To UBound(MyArray) If MyArray(i) &gt; MyArray(j) Then Temp = MyArray(j) MyArray(j) = MyArray(i) MyArray(i) = Temp End If Next j Next i I've got this hardcoded example for 4 die rolls. They start out as Rolls(1 thru 4) = 4,3,2,1 and I want them to end up Rolls(1 thru 4) = 1,2,3,4. !scriptcards {{ --=NumDice|4 --=Roll1|4 --=Roll2|3 --=Roll3|2 --=Roll4|1 --+Unsorted Rolls| --+roll1|[$Roll1] --+roll2|[$Roll2] --+roll3|[$Roll3] --+roll4|[$Roll4] --:PERFORM A BUBBLE SORT| --=i|0 --=max_i|[$NumDice]-1 --:OuterLoop| --=i|[$i]+1 --=j|1 --:InnerLoop| --=j|[$j]+1 --?[$Roll[$i.Total]] -gt [$Roll[$j.Total]] |&gt;BubbleUp;[$i.Total];[$j.Total] --?[$j.Total] -lt [$NumDice.Total]|InnerLoop --?[$i.Total] -lt [$max_i.Total]|OuterLoop --+Rolls sorted ascending| --+roll1|[$Roll1] --+roll2|[$Roll2] --+roll3|[$Roll3] --+roll4|[$Roll4] --X| --:FUNCTIONS| --:BubbleUp| accepts i, j as parameters. Swaps the rolls at i &amp; j --+debug_i, j = | [%1%] [%2%] --+debug_Original Roll_i|[$Roll[%1%]] --+debug_Original Roll_j|[$Roll[%2%]] --:Swap i and j values| --=Temp|[$Roll[%2%]] --=[$Roll[%2%]|[$Roll[%1%]] --=[$Roll[%1%]]|[$Temp] --+debug_New Roll_i|[$Roll[%2%]] --+debug_New Roll_j|[$Roll[%1%]] --+debug_roll1|[$Roll1] --+debug_roll2|[$Roll2] --+debug_roll3|[$Roll3] --+debug_roll4|[$Roll4] --&lt;| }} If you run this, you can see from the debug output lines that it appears to swap the Roll[i] and Roll[j], but the explicitly named Roll1, Roll2, etc. are unaffected. Am I doing something wrong with my nested roll identifiers, or is there something weird going on with timing?&nbsp; EDIT - Is there an easier approach than what I am trying to do to sort die rolls? EDIT 2 - I see now that I have an extra leading bracket and $ in two places in the BubbleUp function. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.g.&nbsp; --=[$Roll[%2%]|[$Roll[%1%]]&nbsp; should be&nbsp; --=Roll[%2%]|[$Roll[%1%]] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Still Working on it, though! Perhaps related, I've noticed that the following simple example works when i &amp; j are declared before the rolls, but not if declared after the rolls. So, this works: !scriptcard {{ --=i|1 --=j|2 --=Roll1|1 --=Roll2|2 --+Roll1|[$Roll1] --+Roll2|[$Roll2] --+roll at index i | [$Roll[$i.Total]] --+roll at index j | [$Roll[$j.Total]] }} but this doesn't: !scriptcards {{ --=Roll1|1 --=Roll2|2 --+Roll1=|[$Roll1] --+Roll2=|[$Roll2] --=i|1 --=j|2 --+roll at index i =|[$Roll[$i.Total]] --+roll at index j =|[$Roll[$j.Total]] }}
Is there any interest from those with API programming skills to post macros they build (maybe by game) for general use?
Does anyone have an idea why the same macro would display with different text style and bolding on two different systems? The first has no italic for the word Insult and no bold in Hello World. The second one does.&nbsp; These are generated by the same macro in the same game.
More than likely there is a browser extension/plugin interfering with Roll20. Have your player try launching Roll20 in an Incognito browser session. If it still looks the same in Incognito, then I would look at things like operating system, maybe.
1614657614

Edited 1614695436
David M.
Pro
API Scripter
FYI - A working Bubble Sort Algorithm: to sort a series of die rolls. Currently hardcoded to 4 rolls, but could be generalized with loops for any number of rolls. !scriptcards {{ --=NumDice|4 --=Roll1|1d6 --=Roll2|1d6 --=Roll3|1d6 --=Roll4|1d6 --+Unsorted Rolls| --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4] --:PERFORM A BUBBLE SORT| --=i|0 --=max_i|[$NumDice]-1 --:OuterLoop| --=i|[$i]+1 --=j|[$i] --:InnerLoop| --=j|[$j]+1 --?[$Roll[$i.Total]] -gt [$Roll[$j.Total]] |&gt;BubbleUp;[$i.Total];[$j.Total] --?[$j.Total] -lt [$NumDice.Total]|InnerLoop --?[$i.Total] -lt [$max_i.Total]|OuterLoop --+Rolls sorted ascending| --+Rolls|[$Roll1] [$Roll2] [$Roll3] [$Roll4] --X| --:FUNCTIONS| --:BubbleUp| accepts i, j as parameters. Swaps Roll[i] &amp; Roll[j] --=Temp|[$Roll[%2%]] --=Roll[%2%]|[$Roll[%1%]] --=Roll[%1%]|[$Temp] --&lt;| }} Observation: the HiLow formatting is lost if a particular roll changes position. If you sort rolls, it might be best to remove HiLow formatting in your scriptcard to avoid potential confusion