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

Macros. Probably quite simple

But I'm dumber than a bag of spanners. I'm running a newish system that uses 3d6 (plus stat/skill) added together for all rolls. The quirk is that one of the d6 is a 'mayhem' dice - if it's higher than the other two, a special thing happens. My brain is telling me there should be a way to roll 1d6 then 2d6 as seperate macros, add them together whilst comparing a to be and shouting "Mayhem" if the trigger is reached. Now perhaps it's more complex than I'm thinking, but am I missing the inevitable and showing my rusty use of anything approaching programming? I'd appreciate any help or even pointers (again it's possible my brain is on vacation, I can't even get two macros to 'add' atm...)
1464193410
The Aaron
Pro
API Scripter
Yeah, there isn't a way I know of to do that with simple macros other than some math trickery.  Something like: [[ (1d6*1.01) + (2d6 * 1.00001) ]] Would give you something like: 16.06010 for a roll of 6,4,6.  Or something like: [[ 1d6*1.1 + 1d6*1.01+1d6*1.001 ]] If you needed to do comparisons on individual dice. For the example above: 16.646 Not ideal, but an option.
1464201561

Edited 1464202565
Ziechael
Forum Champion
Sheet Author
API Scripter
Inspired by Aaron's mathemancy I'll suggest a slightly cleaner output: [[ 1d6 + 1d6*0.1+1d6*0.01 ]] Would give you outputs like: 6.45 or 3.56 etc with your Mayhem die always being the one before the decimal point. As with all mathemancy of this nature you may get some results that throw weird results like 6.459999999999999995 or 3.560000000000001 (I'm sure Aaron could explain why) but in those cases the numbers of interest will always be the first 3 and again the Mayhem die will still be the whole number. To enhance it further you could add an API button which could be tied to your Mayhem macro (which rolls on a rollable table i would presume (which in the example below would be titled 'mayhem')?), then if the first number is higher than the others you click the button in chat to launch your Mayhem macro: Ziechael does something: [[ 1d6 + 1d6*0.1 + 1d6*0.01 ]] [Mayhem?](!& #13;#mayhem) <--- take the space out after the & to make it work ;)
1464203745
The Aaron
Pro
API Scripter
(*cough* IEEE754 Floating point representation of a decimal number...)
Thanks folks - that gives me a start at least. Sadly don't have the pro access so unable to API I think. But I now have one method at least. Thanks again.
Paul D. said: Sadly don't have the pro access so unable to API I think. Actually, using  API Command Buttons in the clever way that Z demonstrated does not require access to the API.
1464213907
Ziechael
Forum Champion
Sheet Author
API Scripter
Silvyre said: Paul D. said: Sadly don't have the pro access so unable to API I think. Actually, using  API Command Buttons in the clever way that Z demonstrated does not require access to the API. Sorry yes, I should've mentioned that... while very useful for API triggers they can be used to create a button for triggering standard macros :) Now if only we could get rid of the *enters monotone robot voice* IEEE754 Floating point representation of a decimal number *back to normal voice* on some of the rolls you'd have a pretty robust, and free, way to implement your system mechanics :)
1464216512
The Aaron
Pro
API Scripter
You can play the same game with integers. (This is the basis for how the MMX instruction set worked in the Pentium processors.) [[ 1d6 * 1001 + ... ]]
Thanks again people. It's given me a lot to look at, and thanks for the heads up on the ability to use some API Commands - I'll have to look into that. I think getting it to do just what I want is a little more research intensive than I thought, probably possible, but I need to delve deeper into roll20 scripting to see if I can do what I now have in my head :) Thanks for being so helpful and eager though. I really hadn't expected it (this community rocks, did I mention that?)