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

Spawn Macro

I would like to create a macro where I can roll a rollable monster table then have it put the result on the map.  I have found the spawn script and I can get it to work !Spawn{{ --name|Zombie}} With this however I need to make a macro for each monster.  Any thought on how to combine the rollable monster table with the spawn script?  How can I get the rolled result in the place of the "zombie" text? This would need to produce the monster and the quantity on the map. Is this even possible?
One possible way I think you could do this is with ScriptCards. ScriptCards can be used as a way to perform the rolls on a table and could then either call Spawn or ScriptCards even has the ability to create tokens as well. Can you give some examples of your rollable table and its contents? Even a screenshot would be ok here. I'm curious as to how you are wanting this to work as in the steps you would take if you were doing this manually. For example: 1. Pick from a series of random encounter tables 2. Roll and get the results which may be something like 6 skeletons and 2 ghouls 3. Find the matching characters in the journal and spawn those characters' default tokens around the selected token This all sounds quite doable and ScriptCards would not be the only option for this, it's just the option that I know but I suspect Spawn and a combination of MetaScripts  could also work. 
I made this and it work for me  !rt /w gm&{template:default}{{name=Eldermire Random Encounter}}{{The Party Faces=[[1t[Eldermire-Random-Encounters]]][Spawn Monsters](!
#Eldermire-Random-Encounter-Spawn)}} It rolls if I have an encounter then I puts clickable box in the chat that brings up a pulldown menu for the monster then the quantity and then spawns to the map.  
1762789783
timmaugh
Forum Champion
API Scripter
I answered in your other thread about why you're not getting a token to spawn, however, I'll add here that you can use the Metascript Toolbox to rename your tokens after you spawn them, too. Using the text of your macro from the other thread, if you update it to be something like: !{{ !Spawn --name|?{Which Monster|Acolytes of the Unholy Brotherhood|Cultist|Cursed Villager|Skeleton|Swarm of Bats|Swarm of Ravens|Guard|Zombie} --qty|?{How Many} --placement|row (^)!forselected token-mod --set name|"?{Which Monster} - {^&i+?{Start numbering at} }" {^&select /?{Which Monster}$/} {^&delay .1} }} ...that will automatically number any instances of the spawned tokens to have a counter tacked on to their name. The basic process is that we're using the same query for the monster type to supply the tokens we want to select. Putting that name in forward slashes tells the script to use the name as if it were a regular expression, and the inclusion of the dollar sign just inside the second slash references the end of the string ... in other words, "select anything named [this] followed by the end of the name". If a token already has a number appended, it will be skipped. The numbering is handled in this part: {&i+?{Start numbering at} } The "i" is a 0-based counter to which you're adding an offset. {&i} would be a 0-based set, {&i+1} would be a 1-based set, etc. So if you already have 10 acolytes already on the board and you want to bring in 5 more, you want them to start their numbering at  11. That would mean entering "10" as the answer to the query "Start numbering at".  The other thing to understand (if you want to understand what is happening), is that this: (^)) ...is really this: (^) ...but rendered in such a way that it won't foul the button syntax from your command line. The (^) at the start of the line, then, establishes the caret character as a "deferral" character... meaning that it can be used to obfuscate the command line syntax until the embedded command is dispatched. And, by "embedded," I mean that this formation: !{{ ... }} ... is a "batch" operation for the Toolbox where individual lines will be dispatched in order (first Spawn, then forselected). When the batch sends the forselected command line, it will remove every instance of the caret character from the command it is about to send.