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

Ceiling and kh1 problem

1484139014
Matthew C
Pro
Sheet Author
"ceil((({@{Tactical_Command_total},0}kh1))/20)" Trying to get this to work. Due to the fact tht Tactical command can go below 0 I need it to kh1 at 0, but I cannot seem to getit to function, I have tried writing it in various ways.
[[ceil({@{Tactical_Command_total, 0}kh1/20)]] Too many parentheses probably. Unless the taccomtotal is a die roll. Then you need to replace 0 with 0d0 instead.
1484141147
Matthew C
Pro
Sheet Author
That worked, however for the full thing is does not: <td>Morale</td> <td><input style="width: 30px" type="text" name="attr_Morale_Base" value="[[ceil({@{Tactical_Command_total, 0}kh1/20)]]" disabled/></td> <td><input style="width: 30px" type="text" name="attr_Morale_Change" value="0"></td> <td><input style="width: 30px" type="text" name="attr_Morale_Total" value="@{Morale_Base}+@{Moral_Change}" disabled/></td></tr> In the section for Morale_Total, it is not calculating it, it is giving me what I filled in s base... "[[{(@{Movement_Base}+@{Movement_Change}-@{hp2}-@{hp7}-@{hp14}),0}kh1]]" And this one is killing me, I need it to add all the values up, and then compare it to the 0
Most of the time, you need to have a die roll in the comparison for kh1 to work. Try putting 0d0 on one or both sides of the comparison
1484142015
Matthew C
Pro
Sheet Author
Thanks, but cannot figure out what you mean, I replaced the 0 with a 0d0 and it still works for the base, but not the calc
[[{(@{Movement_Base}+@{Movement_Change}-@{hp2}-@{hp7}-@{hp14}+0d0),0d0}kh1]]
Also, I'm noticing that SkyCaptainXIII said the same thing earlier, so maybe the error is in @{Moral_Base} looking at the formula, Looking at his suggestion, I believe he may have missed a "}" after the @{Tactical_Command_total in the command. I would also suggest that you add a 0d0 to this formula as well resulting in [[ceil({@{Tactical_Command_total}+0d0, 0d0}kh1/20)]]
I did. Oops.
1484143948
Matthew C
Pro
Sheet Author
hmm, neither one is working, strange :(
1484147441

Edited 1484148534
Jakob
Sheet Author
API Scripter
If I remember correctly, kh1 doesn't work in autocalc fields:  link might help, where other solutions are discussed.
Jakob said: If I remember correctly, kh1 doesn't work in autoalc fields:  link might help, where other solutions are discussed. That would make a lot of sense seeing as the [[]] and kh1 are roll20 specific inside the chat log and math functions such as max(a,b) are JS functions usable in HTML
1484149275
Matthew C
Pro
Sheet Author
ceil((((@{Tactical_Command_total} + (0)) + abs(@{Tactical_Command_total} - (0))) / 2)/20) This works, it calculates the base, but for some reason the total still shows the formula
1484149368

Edited 1484149392
Matthew C
Pro
Sheet Author
NVM, I had a spelling mistake in the total :p Thanks for the link, it is a shame kh1 and kl1 do not work, much simpler