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

[Help] Extended Expressions Script can't parse success rolls for variables

1472143231

Edited 1472143266
Hello! I've been using the Extended Expressions script found here: <a href="https://wiki.roll20.net/Script:Extended_Expressio" rel="nofollow">https://wiki.roll20.net/Script:Extended_Expressio</a>... (I don't believe the author visits roll20 anymore -- I've contacted them about a prior issue I had with it before) Mainly, I've been using it for a custom game system I've been running.&nbsp; The primary issue I have (which I have been using the script for) is with the script's ability to store variables. It seems that the script will successfully calculate success rolls (such as 10d20s&gt;10) and give a result when using it's own in-line conversion, but if you save any of the results from a success check, the script will break. !extend `10d20s&gt;10` The above gives a result. However, storing this in a variable will cause the script to crash if it is pulled in a later expression. !extend `(10d20s&gt;10)[success]` `${success}` Simply pulling the variable causes a crash. The error I get is this: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: ReferenceError: astToInline is not defined ReferenceError: astToInline is not defined at Object.ExExp.sendCommand (apiscript.js:1014:29) at Object.ExExp.handleExExpMessage [as callback] (apiscript.js:1123:8) at Object.Shell.handleApiMessage (apiscript.js:318:28) at Shell.handleChatMessage (apiscript.js:324:8) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:105:34), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:105:34), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1200: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) It's worth noting that the expression still works if you don't use it as a variable, and can be used for arithmetic and other functions for the most part, but the moment the data is stored in a variable and pulled to display, it crashes. Any fixes or tips to work around this would be appreciated! I really would like this to work for my custom game.
1472163296
The Aaron
Pro
API Scripter
Try changing line 672 from this: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var cmd = evalReqs.map( astToInline ).join(" "); to this: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var cmd = evalReqs.map( _.partial(astToCmd,_,true) ).join(" "); I've never used this script, but it looks like astToInline was intended to be a function that converted an AST to an inline expression. &nbsp;That function doesn't exist anywhere, but there is an astToCmd function with an argument that appears to do the same thing. &nbsp;Hopefully the above will solve the issue for you.
Thanks for the response! I've have tried the have tried the above fix and used the same command as before to see if it works, but I now receive this error instead: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at Object.process (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:108:39), &lt;anonymous&gt;:1150:7) at _processRoll (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:1043:30) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:983:10) at _findInlineRolls (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:998:11) at processInlineRolls (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:1117:5) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:885:7) at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9) at processMultiOps (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:805:7) at Object.d20.textchat.doChatInput (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:109:36), &lt;anonymous&gt;:1129:4) at sendChat (/home/node/d20-api-server/api.js:1254:16) Occasionally, I receive an Unexpected Identifier error from the script as well (a pre-existing problem which I've been unable to reproduce) which requires me to disable and re-enable the script to stop it from repeatedly throwing the error too (just had to deal with that too). But aside from that, it just refuses to work with the success rolls.
1472167020
The Aaron
Pro
API Scripter
ok. &nbsp;If you want to PM me an invite and gm me, I'll try and debug it in situ. &nbsp;=D
Went ahead and sent an invite. ^^
1472178986
chris b.
Pro
Sheet Author
API Scripter
Sometimes with that script if you use a negative it enters an infinite loop. I am not sure why, part of it was the regex was not escaping minus signs properly. But also if nothing was on the "left" side of the minus it didnt know what to do. I adapted it for the pathfinder sheet. Magic and I fixed it up to stop doing that. But ... it doesn't interact with the API or chat. But if you look at our pathfinder HTML sheet, scroll down to TAS, the rewritten code is right under TAS. And some of that maybe should be written back to the extended expression API script.
1472185312
The Aaron
Pro
API Scripter
Yeah, I was actually thinking about asking you as I remembered you'd done that. =D