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

Possible conflict between RecursiveTable and ZeroFrame

As I was working on my game I had the API get locked up repeatedly. Since it would happen when I ran a RecursiveTable macro I was pretty sure that was one of the culprits. By disabling Mods one at a time I found the conflict to be with ZeroFrame. If I enable ZeroFrame and run a macro with an RT call in it, the API crashes. Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read property 'map' of undefined TypeError: Cannot read property 'map' of undefined at collectRollData (apiscript.js:2680:55) at Array.map (<anonymous>) at apiscript.js:2779:44 at Array.map (<anonymous>) at parseInlineRolls (apiscript.js:2758:28) at Object.getRollData (apiscript.js:2825:19) at runLoop (apiscript.js:3286:87) at handleInput (apiscript.js:3499:13) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8)
1662961151

Edited 1662961500
Oosh
Sheet Author
API Scripter
It looks like the error is coming from libInline (a library used throughout Metaland). Although I'm pretty sure I can see where the error is coming from, working out why it's happening and how to fix it properly is definitely Metamancer territory. I'll see if I can wave down a passing Timmaugh. It looks like the error is being thrown from inside a block which deals with roll tables (as you've said, RT/ZF seems to be the problem combo), it's somehow getting a data object with the table info in it, but no roll result object. Gut feeling is that somehow the roll data is not ready in the correct meta-frame. Just to aid Tim when he makes his way in here, is the crash happening with pure Recursive Tables API calls, or are your commands using any of the meta-toolbox, like ApiLogic, ZeroFrame etc.?
1662993867
timmaugh
Forum Champion
API Scripter
Is there an example macro you can share? Or your table contents? I have ZeroFrame and Recursive tables in a game, and I'm not seeing that error.
I have tried two versions of the macro, one with APILogic and one without and they both seem to throw the error. Macro with APILogic: /w gm $ [[2d6 + 2d6*?{Raises|0}]] trade goods !rt[Delimiter:BR|showicons] /w gm {& if ?{Raises}>0 } &{template:info} {{name=Scrounging Table}} {{[[[[?{Raises}]]t[ScroungingCopy]]]}}{& end} Macro without APILogic: /w gm $ [[2d6]] trade goods !rt[Delimiter:BR|showicons] /w gm &{template:info} {{name=Scrounging Table}} {{[[[[?{Raises|0}]]t[ScroungingCopy]]]}} First Table: Second Table: Note that before posting this I checked both versions again to make sure and while testing the macro without APILogic, the roll20 sandbox hung up while reloading the API after I re-enabled ZeroFrame. Here are the Mods I currently have loaded:
1663007973
timmaugh
Forum Champion
API Scripter
Hmm... So I have replicated your basic setup (using the official Savage Worlds character sheet by Pinnacle -- hopefully that's the one you're using, too). I created the same tables and used your macros, and I'm not running into that error... But, you mention that you get the error when your sandbox boots up, not just when you send a RecursiveTable macro. For ZeroFrame to use libInline (and crash the sandbox), something has to be sending a message when the sandbox is ready... and if we can zero-in on what that is it might help me figure out what is happening. My setup, as much as I have mimicked what you have, has nothing that is sending a message when the sandbox spins up. Can you disable ZeroFrame and tell me what sends a message on startup? Or just invite/promote me to GM and I can take a look to see what it might be.
Yes, that is the character sheet. It doesn't crash when the sand box starts up, sorry if that was miscommunicated. On that last time I disabled ZeroFrame the sandbox was hung up when reloading and I had to reload the browser. That only happened the one time normally it crashes the API and locks out all the Mods the first time I execute that macro with ZeroFrame and RecursiveTable active. I will send a PM with invite and then promote as soon as I can. That may be the more expedient way. Here is the Output Console when I have all of the above mentioned Mods loaded: "%cSkill names:%c Make sure Skill Names have been set" Restarting sandbox by user request... No existing sandbox found.  Preparing sandbox to start on game activity. Spinning up new sandbox... "Loading character sheet data..." "Starting webworker script..." "Loading 1047 translation strings to worker..." "-=> ChatSetAttr v1.10 <=-" "*** Initialized Welcome Package v1.3.2 ***" "-=> RecursiveTable v0.2.5 <=-  [Fri Oct 18 2019 01:08:14 GMT+0000 (Coordinated Universal Time)]" "ŦŦ APILogic v2.0.6, 2021/8/4 ŦŦ -- offset 1770" "   _____________________________________________       )_________________________________________(          )_____________________________________(                  ___| |_______________| |___                       |___   _______________   ___|                          | |               | |                              | |               | |                              | |               | |                              | |               | |                              | |               | |                ______________|_|_______________|_|_______________                                                    " "ŦŦ libInline v1.0.5, 2022/5/20 ŦŦ -- offset 2535" "ŦŦ ZeroFrame v1.0.10, 2021/11/12 ŦŦ -- offset 2871" "[ModifyTokenImage:2022-09-13 02:19:51] v1.0.4 Starting Up..." "[ModifyTokenImage:2022-09-13 02:19:51] Event Handlers registered." "[ModifyTokenImage:2022-09-13 02:19:51] Started up and running properly." "--- Initialized Carry Tokens ---" "-=> DealInit v1.9 <=- [Last Update: Apr 27, 2022, 5pm Pacific]" "%cSkill names:%c Make sure Skill Names have been set"
1663040270
timmaugh
Forum Champion
API Scripter
Thanks to Robert for inviting me into his game, and to Oosh giving me a heads up to the probable issue, earlier, I was able to find the source of this problem and put a patch in place. The issue was in 0-return table rolls not having an actual "results" property. I've pushed an update into the merge process, but I the merge has already happened for this week, so it will be a week before the fix will be widely available.
1663042135
Oosh
Sheet Author
API Scripter
Dr. Tim's special fix.
1663042467
timmaugh
Forum Champion
API Scripter
Yasssssssssss.
timmaugh said: Thanks to Robert for inviting me into his game, and to Oosh giving me a heads up to the probable issue, earlier, I was able to find the source of this problem and put a patch in place. The issue was in 0-return table rolls not having an actual "results" property. I've pushed an update into the merge process, but I the merge has already happened for this week, so it will be a week before the fix will be widely available. If it's possible to hijack this thread a little bit, I'm wondering if what you discovered is related to this output that happens with RecursiveTables sometimes where the output is just a '0'?
The macro/tables I am using also produce a solitary 0 when I input a 0 for the number of times to roll. If I enter any other value, it does not end with the solitary 0. I am going to find a way to eliminate it through a macro command somehow. Jarren said: timmaugh said: Thanks to Robert for inviting me into his game, and to Oosh giving me a heads up to the probable issue, earlier, I was able to find the source of this problem and put a patch in place. The issue was in 0-return table rolls not having an actual "results" property. I've pushed an update into the merge process, but I the merge has already happened for this week, so it will be a week before the fix will be widely available. If it's possible to hijack this thread a little bit, I'm wondering if what you discovered is related to this output that happens with RecursiveTables sometimes where the output is just a '0'?
1663074125

Edited 1663075624
timmaugh
Forum Champion
API Scripter
Jarren said: timmaugh said: Thanks to Robert for inviting me into his game, and to Oosh giving me a heads up to the probable issue, earlier, I was able to find the source of this problem and put a patch in place. The issue was in 0-return table rolls not having an actual "results" property. I've pushed an update into the merge process, but I the merge has already happened for this week, so it will be a week before the fix will be widely available. If it's possible to hijack this thread a little bit, I'm wondering if what you discovered is related to this output that happens with RecursiveTables sometimes where the output is just a '0'? While '0' is a default value in libInline (if there is no value, or no roll, 0 gets used), I don't think that's what is going on here, because RecursiveTables doesn't use libInline. I think I see where the 0 is getting used in RT, but I'll leave it to The Aar cane On e to see if there might be a way to offer a configuration option that if there are no table returns, you can output something else (an empty string, a custom message, an insult, etc.). I'll see if I can poke him  speak the invocations. ... And also poke him.