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

variables are not calculated

1623581961
Tealk
Pro
Sheet Author
Hello all, when i create the following cube button the variables for "levels" are not calculated but just passed, why? Roll button: value="@{abilityroll} &{template:butterfly} {{name=@{spellname}}} {{rolling=[[@{spellskill}d10!k@{in}]]}} {{widerstand=[[@{spellwiderstand} + (?{Gegnerische Intelligenz?|0} + ?{Aufrechterhaltene Zauber?|0}) * 2]]}} {{stufen=[[floor(($[[0]] - $[[1]]) / 5)]]}} {{desc=@{spelleffekt}}} {{dauer=@{dauer}}} {{randomplayer=@{randomplayer}}}" Roll Template: <div><span>Stufen:</span>{{stufen}}</div> Result:
1623587342

Edited 1623587399
GiGs
Pro
Sheet Author
API Scripter
These entities $[[0] and $[[1]] are not numbers. You cannot perform calculations with them. If you want to do that, you have to perform all calculations at one time, and then call the calculations. So you can probably do it like this: value="@{abilityroll} &{template:butterfly} {{name=@{spellname}}} [[ floor([[@{spellskill}d10!k@{in}]] - [[@{spellwiderstand} + (?{Gegnerische Intelligenz?|0} + ?{Aufrechterhaltene Zauber?|0}) * 2]])/5  ]] {{rolling=$[[0]]}} {{widerstand=$[[1]]}} {{stufen=$[[2]]}} {{desc=@{spelleffekt}}} {{dauer=@{dauer}}} {{randomplayer=@{randomplayer}}}" Untested - but that's the basic format you need to use. Get all the calculations done at one go, and pick out the specific rules using $[[0]], $[[1]], $[[2]] Note that the calculation is not inside {{ }} brackets - that's because it isn't sent to the roll template directly. But the values you extract from it with $[[0]] etc are.
1623588045

Edited 1623588197
Tealk
Pro
Sheet Author
Thanks @GiGs works great this way. value="floor((@{spellbefehligen} + @{spellbewegung} + @{spellelement} + @{spellentfernung} + @{spellgestalt} + @{spellglueck} + @{spellreinigung} + @{spellwissen} + @{spellziehlbereich} + @{zeit}) * 2)" I was not aware that I can execute something outside of the template and then only retrieve it via the variables.
1623590288
GiGs
Pro
Sheet Author
API Scripter
You're welcome :)