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] Spawn Default Token Thread 2

1614224767

Edited 1614224867
David M.
Pro
API Scripter
Abazigal, I must admit I have never used CM, nor am I familiar with the syntax. If the issue is that you need the selected token to "carry through" to Spawn, though, then you may want to try something with timmaugh's SelectManager Script.  It is a meta-script of sorts, that among other things stores selected ids in the global State object, allowing other scripts to "remember" which tokens are selected.  If you install SelectManager, then the syntax would normally be something like: !forselected Spawn --name|Spirit Guardians --size|7,7 --order |toBack --expand|10,8 If I am interpreting the CM api-calling syntax correctly, then maybe this would work? (Untested, and obviously assuming you installed SelectManager first).  {{!forselected {{Spawn}} {{--name|Spirit Guardians}} {{--size|7,7}} {{--order |toBack}} {{--expand|10,8}} }}
Yes David M. that works! Wowzers. Love it man thank you
1614739106
David M.
Pro
API Scripter
Great! Yeah, timmaugh's script is pretty handy!
1614772179

Edited 1614772544
David M.
Pro
API Scripter
One-Click version temporarily broken Arg!! Looks like my Pull Request finally went through yesterday for v0.13, but I was missing a file extension in the new version folder which means one-click is currently broken. Sigh. It's unfortunate that something like that can still pass the review/merge process. I just updated the filename and created a new pull request, but the soonest this will be live will after next Tuesday's publishing roundup. A manual install will be required for one more week. Sorry, guys.
1614959527

Edited 1615038091
David M.
Pro
API Scripter
EDIT - Not sure why my "normal" font is so huge, but the post was too long to change it :) Version Update - 0.14 ( manual install  only for now) Mook Correction! Corrected --mook behavior. The script was previously removing the "represents" property of the spawned token for mooks, which is obviously incorrect. This update corrects the behavior to remove the bar links to the spawned token's character sheet. Animated Resizing or Deletion of Selected and/or Target token(s) This one was pretty fun. It arose from a discussion with Brandon B regarding a shapechanger application he was working on where he wanted to automatically delete the selected token. I was thinking it could potentially create some neat polymorphing or teleporting effects if resizing animations were added   New commands: --deleteSource|  < yes/true/1/no/false/0 >     //DEFAULT = false. Deletes the selected token(s) upon spawn --deleteTarget|  < yes/true/1/no/false/0 >     //DEFAULT = false. Deletes the target token(s) upon spawn --resizeSource|  < #,# <optional #frames, #delay> >    //DEFAULT = n/a. Animates the selected token(s) during spawn.                                                          //#,#: the new size of the selected token(s). If any dimension is set to 0, it will delete the token after animation                                                         //#frames: DEFAULT = 20. how many frames the animation will use.                                                         //delay: DEFAULT = 50. how many milliseconds between triggering each frame? Anything less than 30 may appear instant --resizeTarget|  < #,# <optional #frames, #delay> >     //DEFAULT = n/a. Animates the target token(s) during spawn.                                                          //#,#: the new size of the target token(s). If any dimension is set to 0, it will delete the token after animation                                                         //#frames: DEFAULT = 20. how many frames the animation will use.                                                         //delay: DEFAULT = 50. how many milliseconds between triggering each frame? Anything less than 30 may appear instant Note that the resize iterations and frame delays are optional, as they will default to 20,50 if omitted. Also, if either of the --delete commands are used, the script will ignore any --resize commands. Some examples - Click to play animated gifs A treasure chest turns into a Mimic! !Spawn {{ --name|Mimic --offset|0,0 --expand|20,50 --size|1,1 --resizeSource|0,0,20,50 }} A Black Pudding is hit with slashing weapons, so splits into two smaller puddings. One is spawned while the original is resized. Also overrides bar value to half hp and also uses token-mod to change the hp of the selected token to match, per 5e rules. !Spawn {{ --name|Black Pudding --offset|0,0 --expand|20,50 --size|1,1 --force|true --resizeSource|1,1 --bar1| [[floor(@{selected|bar1}/2)]] / [[floor(@{selected|bar1}/2)]] }} !token-mod --set bar1|[[floor(@{selected|bar1}/2)]] A chaos-infused imp randomly teleports around the map. (uses a rollable table called Offsets which stores potential offset parameters from -2,-2 to 2,2) !Spawn {{ --name|imp --offset|[[1t[Offsets]]] --expand|20,50 --resizeSource|0,0 }} Here's the same chaos-imp random teleport, but with no animations. Note the token is not moving (sliding from a to b). It is being destroyed and respawned simultaneously. Not as much wow factor, but shows the --deleteSource in action. !Spawn {{ --name|imp --offset|[[1t[Offsets]]] --deleteSource|true }} Hope you have fun with it, and let me know if you run into any issues!
1614977445

Edited 1614977747
Works like a charm, thank you for this, as well as other future applications, this has removed my need to !bump the current changeling form when a new one arrives and then delete them from the gm layer later. For anyone that may be wondering about the changeling macro, I made their default character token a roll table token with the different sides/items icons being the different token forms, then I gave each form an ability that reads like this- !Spawn {{ --name|Nix --side|1 --order|toFront --mook|false --bar1|Era --expand|20,50 --resizeSource|0,0 }} so side note, for my players the hp link is on bar3 and bar1 is kind of a misc. so I have it load in the name associated with each form for reference with the --name section being the actual character name to link the sheet per the commands on the original  !Spawn page   If you're wanting even more lol, here again is the menu that I created to pop up in chat by inserting it in a separate character ability for quick access to change the form, a little cleaner than in the previous  thread- /w gm &{template:default} {{title=Nix's Forms}} {{Choose From= **Nix's Forms** [Nix](~Change-Form-3) | [Era](~Change-Form-1) | [Neserie](~Change-Form-2) }} keep in mind the Change-Form-3 is the name of my character's ability that I put the !Spawn command in so yours may vary, Change-Form-# isn't some universal command, and the text put inside the [] will be how the button on the menu appears, and within the ()  if you are calling a character ability you must put ~ before the name of the ability I know I'm over explaining a lot to some of you but I'm hoping to make things as seamless as possible for anyone that is a beginner such as myself and would like an easy template 
1615063047
David M.
Pro
API Scripter
Minor update v0.14a - corrected error handling I had inadvertently introduced a bug in the last version that caused the error handling for syntax errors / data validation to remain silent. Changed one line and now you should be receiving error messages again when you use the wrong commands, etc.
Is this currently available? I keep getting a "no such file or directory" error when trying to install, regardless of browser.
1615149517
David M.
Pro
API Scripter
Hmm, yes it should be working. I just manually copied v0.14a from my github repo (linked above) and re-installed it and got no errors. That particular "no such file or directory" error was popping up for many people a few days ago for any scripts (not necessarily Spawn). Hopefully that is not becoming a widespread issue again :(
1615150318

Edited 1615150524
Yeah, just tried it again in two different browsers and I get "No such file or directory @ rb_sysopen - /home/symbly/www/d20-app/apiscripts/Spawn Default Token/0.13/SpawnDefaultToken.js" Copying it manually works. This looks to be a very helpful script and I cannot wait to make use of it.
1615151128

Edited 1615151151
David M.
Pro
API Scripter
Ah yes, sorry. Didn't realize you were trying it from the one-click. You probably didn't see the post above that the one-click was temporarily broken due to me leaving off a file extension in the v0.13 folder. It was a long week, and I had forgotten about that issue :) I had fixed it immediately and made a pull request, but it won't go into effect until Tuesday when the weekly publishing of one-click updates hits. 
Lol, I thought your last update was that one-click was working!
1615153337
David M.
Pro
API Scripter
Haha, yeah it's confusing sometimes with the once/week delay for one-click. It would be a lot easier if we could publish as soon as our pull requests are approved!
1615418795
David M.
Pro
API Scripter
More Scriptcard/SelectManager/Spawn synergy lark86 was looking for a way to spawn random sides of rollable tokens in a random placement around a given token. Until --placement|random is a thing, I came up with a quick scriptcard  that queries for the default token name, qty, and range around the selected token. It loops through, randomly determines the --offset coords, and calls !Spawn directly from the scriptcard multiple times. Also requires the SelectManager script, btw. Here's a gif of it in action. Note that unique coords are not supported, so some tokens may spawn on top of each other (as in the first of the two times I ran it in this example). I just used a graphical d6 rollable table token for the example.  Here's the scriptcard: !scriptcards {{ --:SETTINGS| --#whisper|gm --#title|Random Spawn --:USER INPUT| --&name|?{Spawn name?|AlienD6} --=qty|?{Qty?|5} --=rad|?{Spawn range in squares?|2} --:INITIAL CALCS| --=span|2*[$rad]+1 --=min|-1*[$rad] --=max|[$rad] --=squaresAvailable|[$span]*[$span] --?[$qty] -gt [$squaresAvailable]|>QtyHighError --:LOOP THRU AND SPAWN IN RANDOM LOCATIONS| --=i|0 --:Loop| --=i|[$i]+1 -->GetOffsetXY| --@forselected|Spawn _name|[&name] _offset|[&offset] _side|random _order|toFront --?[$i] -lt [$qty]|Loop --:OUTPUT CONFIRMATION MESSAGE| --+|Spawned [$qty] copies of token "[&name]" in random locations within [$rad] squares of selected token --X| End macro --PROCEDURES| --:GetOffsetXY| -->RollXYBetweenMinMax| --=dX|[$rollX] --=dY|[$rollY] --&offset|[$dX.Total],[$dY.Total] --<| --:RollXYBetweenMinMax| --=rollX|1d[$span] --=rollY|1d[$span] --=rollX|[$rollX]-[$rad]-1 --=rollY|[$rollY]-[$rad]-1 --<| }}
1615422936
David M.
Pro
API Scripter
FYI One-click is now working again! (one version behind development) Note: the current one-click is v0.13a, which is one iteration back from the one in the development gist. If you are using functionality from v0.14, you should continue to use the manual install until v0.14 goes live on one-click, likely next Tuesday.
1615468448
David M.
Pro
API Scripter
Case Study: Animated Transitions for Theater-of-the-Mind Scene Changes (requires v0.14+) Using rollable table tokens with various thematic scene graphics is an established technique in Theater of the Mind gameplay. With v0.14 or later of Spawn, you can create an animated transition between scenes for that extra little something! Click below for animated gif Very simple to set up: Create a rollable table token with your scene graphics Create a new character sheet (e.g. "Scenes") and set the default token to your new rollable table token Add a token ability "Set Scene" with some variation of the macro code given below Bask in the accolades as your players ooh and ahh at your obvious mastery of Roll20 !Spawn {{ --name|Scenes --expand|20,50 --size|20,12 --side|?{Which Scene?|Jungle,1|Temple,2|Village,3} --resizeSource|0,0,20,50 }}
1615476049
timmaugh
Pro
API Scripter
David M. said: More Scriptcard/SelectManager/Spawn synergy Now, you just need to use APILogic to Mule in a variable or perform an inline math operation, and you'll have 4 scripts playing together. =D Seriously, though, cool stuff.
1615478784
David M.
Pro
API Scripter
Haha, what could go wrong?
1615559599
David M.
Pro
API Scripter
Version Update: v0.15 (random placement, delete after expand options, remove qty limit) - Development gist Apparently my goal is to never have the one-click catch up to development gist ;) Three updates here: Added a  --placement|random # option. "rand" or "random" are accepted. Will spawn tokens in random squares within a square grid of size #.  Added an optional third parameter to the expand command to delete the spawned token after expand animation. e.g. --expand|20,50,true.  If the third parameter is set to false or omitted, the spawned token will remain after animation as normal. Removed the limit to the max number of tokens spawned (previously qty<=20).  Examples. Click to play gifs Random location example !Spawn {{ --name|AlienD6 --qty|10 --side|rand --offset|1,1 --placement|rand 5 }} Delete after expand animation example . Create crazy explosions or other temporary effects. Can spam this multiple times to get really crazy (animations will happen concurrently), although there will likely be some "stuttering" at the tail end of the animation as the largest tokens are deleted. For use when you find/create a cool graphic that you want as a special effect, without being limited by the custom fx tool. !Spawn {{ --name|RingOfFire --expand|50,50, true --size|60,60 --order|toBack }}
1615657734

Edited 1615657756
I had a question. I used your macro and Spawntoken to make a scene token and it worked great when I used the following: !Spawn {{ --name|Scenes --expand|20,50 --size|20,12 --side|?{Which Scene?|Sunblight,1|Vellyn,2|FlyingDragon,3|DragonFight,4|Xardorok,5|XardorokFight,6} --resizeSource|0,0,20,50 }} Then, I added another entry to my rollable table and then updated the macro to the following: !Spawn {{ --name|Scenes --expand|20,50 --size|20,12 --side|?{Which Scene?|Sunblight,1|Vellyn,2|FlyingDragon,3|DragonFight,4|Xardorok,5|XardorokFight,6|MindFlay,7} --resizeSource|0,0,20,50 }} On that example, 1-6 still works great, but when I select MindFlay, the token shrinks to nothingness and the following is displayed in chat: (From SpawnAPI): Unhandled exception: Cannot read property 'match' of undefined What am I doing wrong?
Is there any chance of this awesome script being updated to include the ability to set the rotation of the token at spawn?
1615662669

Edited 1615663848
David M.
Pro
API Scripter
DM Goss, not sure exactly, but I'm only using .match in three different spots: when using the --placement command, when the spawned token is using TheAaron's TokenNameNumber, and when getting the imgsrc of the spawned object. Since the first two don't apply to you (assuming, based on your description), it's probably the imgsrc. Is it possible that the MindFlay image is from a marketplace purchase and is not in your personal art library? I should probably handle that case explicitly, since it is a likely point of error. If this is not the case, let me know and we'll see what we can come up with. EDIT - I was able to produce that error when attempting to set the side to a number greater than the number of sides of my rollable table token. Can you double-check your default token to ensure you have at least 7 sides? It's possible that you added another side and perhaps didn't save it as the new default token?
1615662745
David M.
Pro
API Scripter
Jeff, that's a good idea. I'll put it in the queue!
David M. said: DM Goss, not sure exactly, but I'm only using .match in three different spots: when using the --placement command, when the spawned token is using TheAaron's TokenNameNumber, and when getting the imgsrc of the spawned object. Since the first two don't apply to you (assuming, based on your description), it's probably the imgsrc. Is it possible that the MindFlay image is from a marketplace purchase and is not in your personal art library? I should probably handle that case explicitly, since it is a likely point of error. If this is not the case, let me know and we'll see what we can come up with. No, I've changed out the picture to several pictures I have in my person art library. I even changed it to the picture that I used for the #6 position (XardorokFight). It will work at the #6 position, but won't work at the #7 position. 
1615663891
David M.
Pro
API Scripter
DM Goss, se my edited comment above to see if it pertains. We cross-posted.
David M. said: DM Goss, not sure exactly, but I'm only using .match in three different spots: when using the --placement command, when the spawned token is using TheAaron's TokenNameNumber, and when getting the imgsrc of the spawned object. Since the first two don't apply to you (assuming, based on your description), it's probably the imgsrc. Is it possible that the MindFlay image is from a marketplace purchase and is not in your personal art library? I should probably handle that case explicitly, since it is a likely point of error. If this is not the case, let me know and we'll see what we can come up with. EDIT - I was able to produce that error when attempting to set the side to a number greater than the number of sides of my rollable table token. Can you double-check your default token to ensure you have at least 7 sides? It's possible that you added another side and perhaps didn't save it as the new default token? Yep, that was it. Once I unlinked the token and then relinked it, it all worked like a charm. Can't believe I didn't think about that. Thanks, Dave. I appreciate the help.
1615664351
David M.
Pro
API Scripter
Great! I've done the same on several occasions. It's too bad there isn't a "Save and update default token" button.
1615671984
David M.
Pro
API Scripter
Version Update: v0.16 (added --rotation command) -  Development gist Quick update: New command allows the rotation of the spawned token to be defined at runtime. Rotation is not an animated property at this time. Only numeric values or "rand", "random" are valid parameters for this command. Syntax examples: --rotation|0 --rotation|-58 --rotation|rand --rotation|random
David M. said: Version Update: v0.16 (added --rotation command) -  Development gist Quick update: New command allows the rotation of the spawned token to be defined at runtime. Rotation is not an animated property at this time. Only numeric values or "rand", "random" are valid parameters for this command. Syntax examples: --rotation|0 --rotation|-58 --rotation|rand --rotation|random That was fast;  thanks!  If I hurry I might be able to get it implemented for tonight's game! :)
Greetings @David M.  Firstly, LOVE the API! 100+one thank yous. It's very fun and useful. Currently, I'm tying to have a character (on the object layer) summon a creature to the GM layer. Looking through documentation, I saw this update:  --v0.10  bug fix for certain cases where the default token does not have layer information. Now explicitly sets the spawn layer to that of the origin token(s). Side benefit: can now spawn on non-object layers (e.g. GM layer). Is there any way to either set the layer as desired (separate from the token that does the summoning) or a way to generate the newly summoned token's ID (for purposes of using !token-mod to send it to the GM layer? I'm wondering if something like this is possible: !Spawn{{ --name|Telekinetic Mage Hand --offset|1,0 --layer|gmlayer }} Thank you for any/all help you can offer!
1615826572

Edited 1615826933
David M.
Pro
API Scripter
Version Update: v0.17 (added --layer command) -  Development gist User may now specify the layer to spawn token(s). If this command is omitted, the default behavior is for the token(s) to spawn on the same layer as selected token(s). Syntax: --layer| < object/token/map/gm > E.g. --layer|gm --layer|object --layer|token --layer|map Actually, the script is just matching the text strings "gm", "obj", "tok", or "map" (case insensitive), so this actually will still work: --layer|gM1234ABCD
All set. Now I understand. Two things: 1) I was using the wrong syntax for the gm layer and 2) I had an old version of the script (as he slowly face palms himself). Many thanks for the swift reply! 
1615829843
David M.
Pro
API Scripter
Haha well, there was no working syntax until today as the --layer command didn't exist until you asked for it! I just released v0.17 :) Note --layer|gmlayer will still work, as the script just looks for case-insensitive matches to the text string "gm". As long as "gm" appears somewhere in the parameter, it will get picked up. Things might get weird if you had multiple matched text strings, though.
Well, hot diggity HA! It's a really useful script now with even more use to it. Thank you, my good sir coding wizard!
1616449963

Edited 1616450415
@David, hoping you can help me out with this: I recently decided to try renaming creatures summoned by PCs to 'Summoned <Creature>' so the Spawn script doesn't mix them up with the normal versions of those creatures that I have. But I'm getting this error when trying to run the command with 'summoned' added before the name query Here's the original macro, which works when the creatures don't have 'Summoned' in their name (eg 'Mitflit') !Spawn {{ --name| ?{Creature to summon (sorted by level)| –1 ———————| mitflit| sprite| 0 ————————| pugwampi| ...| 3 ————————| dryad| twigjack| unicorn,unicorn --size| 2,2} --placement| surround --order| toFront --fx| nova-charm }} Changing it to this doesn't work after adding 'Summoned' to the creatures' names (eg 'Summoned Sprite') !Spawn {{ --name| summoned ?{Creature to summon (sorted by level)| –1 ———————| mitflit| sprite| 0 ————————| pugwampi| ...| 3 ————————| dryad| twigjack| unicorn,unicorn --size| 2,2} --placement| surround --order| toFront --fx| nova-charm }} For some reason it works with the unicorn in both cases. EDIT: changing the query to '<name>,<name>' for each entry seems to make the new macro work. Any idea why that's not needed for the original macro?
1616456613
David M.
Pro
API Scripter
Interesting. When I log the spawnName using your query: --name|summoned ?{Creature to summon (sorted by level)|...etc it seems to be putting an extra space between "summoned" and the creature name. If I run just the query part in a test macro (e.g. "summoned ?{Creature...}, it outputs with a line break between "summoned" and the creature name. When the script sees double brackets, it replaces line breaks with a space, so I think that's what is happening. "summoned"<space><br> becomes "summoned"<space><space>, which causes your name to be incorrect. TL;DR - try removing the space between "summoned" and "?", like this: --name|summoned?{Creature to summon (sorted by level)|...etc
Oh that did the trick! I guess it's because I have the query itself broken up into separate lines as well, so thank you for pointing that out.
Great Api and since i run a group of 6 player and mount this save me a lot of time thank you! I was just woundering if you could help me on one point. When i use the summon, all the token bar option are now above and my default is bottom. Also my players mounts does not appear when i add (--size|2) after offset. They are large Axe Beck with their own caracter sheet and they spawn medium size. Thank you.
1617102907

Edited 1617103013
David M.
Pro
API Scripter
Max, the token bar indicator line being on top is unfortunately a limitation of the api. The bar location & style properties have not been exposed to the api, so we can't change them except through the manual user interface. Irritating, I know. Regarding resizing, you need to specify an X and Y size (to accomodate non-square tokens - walls of fire, systems using 1x2 mounts, etc), so try using  --size|2,2 for your Axe Beak. I should probably update the code to set the size to a square of the dimension if only one is supplied. That will be in the next update. 
Just started playing around with !Spawn and am really liking it.  Great work. Question:   I'd like the token created to default to a drawing ( IsDrawing=True ), but don't see an option for that.  I could use !token-mod to change the IsDrawing settign to True if I had the Token_ID of the newly spawned token, but I'm not sure how to get the Token_Id for the spawned token without it somehow being selected. I'm sure there's got to be a way, and I'm just missing it.   Thanks
1617420281

Edited 1617422663
David M.
Pro
API Scripter
Will, that is currently not possible, but it could be added to the script. However, we should keep this thread limited to Scriptcard-related topics. Scriptcards+Spawn is fine here, but Spawn-only questions should be posted here in the future so Kurt's thread doesn't get hijacked :)  EDIT - I'm an idiot, lol
1617421745

Edited 1617422616
I'm sorry, I thought this was the new !Spawn related thread [click on your here link and you'll see ;)].  I'm thinking that you are like me and code rather than sleep.  I'm also a fan of Scriptcards. Since I'm here, another feature request:  Option to allow the player creating the spawned token, control the spawned token.  I have to manually set it after the fact as a DM through the Token Dialog.   Figured it out, you have to save the token to the named character sheet with permissions already established, just like all other tokens.  I am tired. That said, it would be nice if you could assign it on the fly with an option like --ControlledBy|Self, All, GM, or named player.
1617422623
David M.
Pro
API Scripter
[Facepalm] Haha, so sorry, the scriptcards thread has been so active in the last few days and I was working on a card when I saw the notification. Derp.  I'll see what I can do for the two requests.
1617551720
David M.
Pro
API Scripter
Version Update: v0.18 (added --size shorthand & --isDrawing command) -  Development gist Pretty self-explanatory. "isdrawing" (not case sensitive) will set the isdrawing property. Size will now accept a single number to set X=Y=number. --isDrawing|  < yes/true/1/no/false/0 >    //DEFAULT = false. Sets the is drawing property of spawned token --size|  < #,# > or < # >       //DEFAULT = 1,1 (X,Y) - How many SQUARES wide and tall are the spawned tokens? If only one number is given, X & Y are set to equal size Examples: --isDrawing|true --isdrawing|0 --IsDrawing|yes --size|2    //will set token size to a 2x2 square --size|1,3    //previous syntax is still valid (1x3 rectangle) I decided to hold off on the controlledby property, as this would change or set the character sheet property for all subsequent instances of the default token, whether dragged out or Spawned, which could lead to some unintended consequences. If you want to easily change it with a script, token-mod can do it with  !token-mod --set controlledby|+  or  !token-mod --set controlledby|-  followed by the player name. For more info on that, see here .
Thank you David.  I’ve been enjoying the heck out of the Spawn script.  I’ve been using it for AoE templates, Spell objects like Spiritual Weapon, animal companions, and more.  My next project is to see how you might split up a creature (like black pudding) or having a creature spawn other creatures as a NPC/form based macro.  I believe I saw an example in this thread.  Also thinking about how I might use it to randomly create environmental effects like lightning bolts for a battle taking place during a storm or to even to create a quick forest map, randomly placing different tree and rocks in different cells for an entire page, based on a sparseness indicator.  Could be used to create a random hex/grid crawl as well.  So many uses.  
1617651238
David M.
Pro
API Scripter
Awesome, great ideas! The black pudding example is here , FYI :)
Hey David,  I am having some trouble with the ScriptCards/SelectManager/Spawn shenanigans.  I'm trying to spawn a spell effect on a target token in a Card. I'm using the forselected command in front of the Spawn call in the Card, but I keep getting: (From API):  No selected tokens to use for that command. Please select some tokens then try again. Oddly though, any card that used multiple targets, the call works great, generating a button for each target selected. Here are the cards involved: Single Target: !scriptcard {{     +++PF2+++  --Lsettings|Cazador  --#targetToken|@{target|token_id}  --#emoteState|Hidden  --#Title|Cazador - Flaming Sphere  --#leftsub|2 actions  --#rightsub|Verbal, Somatic    --=LevelCast|?{Level|3|4|5|6|7|8|9}  --=FieryForm|?{Fiery Form|No, 0|Yes,1d6}  --=CritSave|10 + @{Cazador|spell_dc}  --=NumberDice|[$LevelCast] + 1  --=DamageRoll|[$NumberDice]d6 + [$FieryForm]  --=HalfDamage|[$DamageRoll] \ 2  --=CritDamage|[$DamageRoll] * 2  --=ReflexSave|1d20 + @{target|saving_throws_Reflex}   -->DeductSpellSlot|@{Cazador|character_id};[$LevelCast]    --+Casting|Cazador rolls his Flaming Sphere at [*T:t-name]. --@forselected|Spawn _name|SpellEffects _targets|1 _side|1 _order|toFront  }}   Multiple Targets: !scriptcard {{     +++PF2+++  --Lsettings|Belladonna  --~Victim|getselected  --#emoteState|Hidden  --#Title|Belladonna - Black Tentacles  --#leftsub|3 actions  --#rightsub|Verbal, Somatic, Material     -->TargetVerification|[$VictimCount]   --=LevelCast|5  --=DamageRoll|3d6   -->DeductSpellSlot|@{Belladonna|character_id};[$LevelCast]    --+Surprise! |Belladonna casts Black Tentacles in a 20' burst. --@forselected|Spawn _name|SpellEffects _targets|1 _side|3 _size|4,4 _layer|map  --=i|0      --:SaveDetermination|       --=i|[$i] + 1 --#targetToken|[&Victim[$i.Total]]    --=SpellAttack|1d20 [Base] + @{Belladonna|spell_attack} --=FortDC|10 + [*T:saving_throws_fortitude] --?[$SpellAttack] -ge @{Belladonna|spell_dc}|>Saved|>Failure --X|   --:Saved| --+Hit!|[i][*T:t-name] is grabbed by a tentacle and takes [b][$DamageRoll] bludeoning damage[/b].[/i] --@alter|_target|[*T:t-id] _bar|1 _amount|-[$DamageRoll]  _show|none --@token-mod|_ignore-selected _ids [*T:t-id] _set statusmarkers|fishing-net --?[$i] -eq [$VictimCount]|>Done|>SaveDetermination --X|   --:Failure| --+MIss!|[i][*T:t-name] [b]avoids getting grabbed[/b] by a tentacle.[/i] --?[$i] -eq [$VictimCount]|>Done|>SaveDetermination --X|   --:Done|    --X| }} 
1617966754
David M.
Pro
API Scripter
Erik, it looks like the following line in your single target card is causing the problem. When I run a stripped down card with just this line and the --@forselected call, I get the error you mentioned. When I remove the line below, it works.  --#targetToken|@{target|token_id} For some reason, this appears to interfere with whatever voodoo SelectManager & Scriptcards uses to communicate with each other regarding the selected token. I don't have a solution for you right now, unfortunately. I'll ping the Scriptcard thread and see if Kurt and/or Tim have any ideas.
Interesting. It seems that any target call in the card creates the same issue as well.  This card causes the error: !scriptcard {{  --#Title|Cazador - Flaming Sphere  --+|@{target|token_name} --@forselected|Spawn _name|SpellEffects _targets|1 _side|1 _order|toFront  }}  But taking the target call out works fine.  Also, moving the Spawn command outside of the card fails as well  !Spawn {{ --name|SpellEffects  --targets|1  --side|1  --order|toFront }} !scriptcard {{  --#Title|Cazador - Flaming Sphere --+|@{target|token_name}   }} Is there a way to pass the ID directly into Spawn, without having to process a button maybe?
1617980480

Edited 1617980544
David M.
Pro
API Scripter
I'm not at a computer to test right now. Does your 2nd example (two independent api calls) work if the scriptcard is called first? The @{target} gets processed before any scripts start to run, and it may be "losing" the targetid after the first script (Spawn)