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] Extended Expressions

1432687204

Edited 1433052447
There's been a decent amount of clamor for more involved math/dice expressions around here. In response, I offer Extended Expressions , a script which adds an extended expression syntax and support for many more mathematical and logical operators. The script introduces two new commands: * !exroll, which acts like /roll (with support for extended expressions). * !extend, which replaces any expressions enclosed in backticks (`) with inline rolls using the extended expression syntax. Some examples: !exroll 1d6**2 quadraticritical damage (or "it's crit to be squared") !extend `((1d6[roll] % 2) ? "odd" : "even")` (`${roll}`) !extend Kobold attacks (`(1d20[attackroll] + 3)[attacktotal]`), `((${attacktotal}>=15) || (${attackroll}=20) ? (${attackroll}=20 ? "critically hitting for [[2d6+2]]" : "hitting for [[1d6+1]]") : "missing" + (${attackroll}=1 ? " pathetically" : ""))`
1432687758
The Aaron
Pro
API Scripter
Cute!
1432768793

Edited 1432769195
So I had some ideas to get this to work... however even the simple examples crash for me. Here is the error: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Object #<Object> has no method 'handleCronMessage' at ExExp.handleChatMessage (evalmachine.<anonymous>:775:15) at eval ( Is there a dependency missing? EDIT: definitely not the cron script...
1432770109

Edited 1432770319
Grr... bad copypasta. If you have Command Shell installed, it uses that for output marshalling, which bypasses this codepath, so the missed change didn't show up in my testing. The fix is in my fork, and is included in the pull request outstanding for v0.3, so it should get merged into trunk soon.
Thanks, think I just figured that out, but glad that you can confirm it :)