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 HELP] Conjure Animal using Summon Monster script and rollable tables or Recursive Table

My dearest Scriptomancers!  I have another quandary.  I just had a druid join my game (DnD5e by Roll20), and I have set up all her spells and wildshape using API macros. The last one I am working on is Conjure Animal, and I am trying to automate the summons using the Summon Monster script and rollable tables or Recursive Tables. To do this, I set up a roll query for the player to specify the CR of creature to summon, the results of which I want to roll off of a corresponding roll table. I have set up my roll tables by challenge rating, but every time I execute they macro, the output is not recognized by Summon Monster. Either it drops a roll, which does not work, or it drops a roll tag (!rt). Is there any way to get either a rollable table or Recursive Table to output text only? This should solve my problem. Here are the macros I have tried: !summon ?{Creature DC?|1/4,!rt [[1t[1/4cr]]] 8|1/2,!rt [[1t[1/2cr]]] 4|1,!rt [[1t[cr1]]] 2|2,!rt [[1t[2cr]]]} !summon ?{Creature DC?|1/4,[[ 1t[1/4cr] ]] 8|1/2,[[ 1t[1/2cr] ]] 4|1,[[ 1t[cr1] ]] 2|2,[[ 1t[2cr] ]]} Any thoughts?
1622825598
timmaugh
Pro
API Scripter
Couple of things going on there... first, there is no native way to start a new API call in the middle of another API call, so what you're trying to do nesting RecursiveTable in a Summon script won't work that way. There are a few scripts that will launch an API call from within another API call (ScriptCards is one, Plugger, from the Meta Toolbox is another). Second, the thing about rollable table results in the inline roll object is that they don't float to the "value" the same way as simple die rolls do. If your script doesn't handle that natively, ZeroFrame offers the ability to return the value of a roll (getting the table result if it is a roll against a table). You can use the .value tag after an inline roll to flatten it to that value: [[1t[1/4cr]]].value So if all you need to do is unpack the value, this would work. Also, ZeroFrame loops over the message, so if you really needed the recursion of a table result calling another roll or another table result, it would keep going (until there weren't any more inline rolls or until it detected a potential infinite loop).
1622828572
David M.
Pro
API Scripter
To keep your options open,  here's a link (see "Option 2" in the link) to a 5e Conjure Animals spell solution using the  Spawn ,  Scriptcards , and  SelectManager  api scripts, along with a rollable table that I populated with the Scriptcards version of the Spawn commands. The user Spawns a single target token for initial creature placement, then runs a scriptcard macro that queries for what CR of creature is conjured. The corresponding table is rolled and the appropriate number of a random type of that creature is spawned in the appropriate size. A bit of setup, but if you use the table-export script to generate the tables it's not too bad. I give the table-export macros to use in the link.   
Thank you both for your quick responses. I should have realized I can't nest API calls. Silly noob. I installed ZeroFrame and tried to use .value as you mentioned, and it crashed my sandbox, giving this error: For reference, the error message generated was: ReferenceError: libInline is not defined ReferenceError: libInline is not defined at runLoop (apiscript.js:53896:87) at handleInput (apiscript.js:54091:13) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1713:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
1622831235
timmaugh
Pro
API Scripter
Sorry, libInline is a dependency for ZeroFrame. If you get ZF from the one click, the dependency will come, too.