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

Iterative Inline calculation and abs() problem with macro?

October 20 (10 years ago)
I seem to be having trouble with inline calculations when it comes to abs().

I can get the following to work:
/r [[abs(-5)]]d10
But trying to use the variable fetch coupled with an abs()/multiple steps, it no longer seems to work:
[[[[abs(?{Degrees of Failure})]]d10]]
Where I'm trying to get the final result to be inline, but I also want there to be calculation of how much d10s are to be rolled before the final roll of the d10s are shown inline.

Any ideas on what I'm doing wrong?
October 20 (10 years ago)
Gauss
Forum Champion
You cannot nest inline rolls inside each other.
November 23 (10 years ago)

Gauss said:

You cannot nest inline rolls inside each other.

Ah. So. How do I go about doing this then? Or is it, as of yet, still not possible to show the have the final result displayed as completely inline?

Clarification to above question:
Ideally, I'd like to get the "[[[[abs(?{Degrees of Failure})]]d10]]" to work. Breakdown shown below:
[[
[[
(abs(?{Degrees of Failure}))
]]
d10
]]

where the absolute value of the input "Degrees of Failure" is crunched, and utilized as the number of d10s to roll. The final result of the roll being displayed as an inline value.

Removing inline in the middle "[[(abs(?{Degrees of Failure}))d10]]" gives no result.
Which makes sense, because "(abs(?{Degrees of Failure}))" is not crunched as a number. The result (abs(3)), where 3 is the value of the input "Degrees of Failure".

And we can't roll "(abs(3))d10s"...

So. Yeah. Is it not possible to display the final d10s roll as inline while also using the modification of number of d10s to roll?



November 23 (10 years ago)

Edited November 23 (10 years ago)
Gauss
Forum Champion
Since you are using a query could you just leave off the negative value?

And, correct, it is not possible to display the final d10s as inline while modifying the number of d10s to roll.
Note: basic math will be resolved before the dice are rolled. Example: /roll (5*4)d10 would roll 20d10
November 23 (10 years ago)

Gauss said:

Since you are using a query could you just leave off the negative value?
Yeah. That's the current workaround; breaking down one macro into multiple smaller ones.

Still, it would still be preferable if possible to leave the absolute function in as that would allow the multiple small ones to be fully incorporated and chained into one, which was the original intention anyway.

I guess this is just something that should be submitted under "feature request"?
November 23 (10 years ago)
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Evynd, does this solve your issue?

/r ([[abs(?{Degrees of Failure})]])d10
November 24 (10 years ago)

Steve K. said:

Evynd, does this solve your issue?

/r ([[abs(?{Degrees of Failure})]])d10


Not really. That's just a type of one of the workarounds I've looked at.
This only works if you're looking at two levels of iteration. If you want at least 3, you have to start separating the macros out.
eg if half of "[[abs(?{DoF})]]d10" determines the amount d6s need to be rolled:
The ideal all inline calcuation:
Character takes [[([[[[abs(?{DoF})]]d10s]]*0.5)d6]] damage!
Current breakdown with current limitations:
/r [[abs(?{DoF})]]d10s
Character takes [[({Result from previous line}*0.5)d6]] damage!
And since I don't think roll20 allows (temporary) variable storage, it's not as if the calculation of the first line can be stored as a variable to be fetched and automatically inputted into the second line to allow one seamless macro.
November 24 (10 years ago)
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
You can do temporary variables and more complex calculations using the API.