I think at least part of your problem is that you’re trying to use procedures (wikitext, not wikified or otherwise evaluated before substitution) as numeric values in a filter when you should really be using functions (filters that do get fully evaluated, designed to be used as variables). Try this instead and let us know if you’re still having issues:
\function calc.basicspeed.from.cp() [<currentTiddler>get[basic-speed-cp]divide[5]trunc[]multiply[0.25]] [<DX>add<HT>divide[4]] +[sum[]]
\function calc.basicmove.from.cp() [<currentTiddler>get[basic-move-cp]divide[5]trunc[]] [<calc.basicspeed.from.cp>trunc[]] +[sum[]]
Here I’ve just moved the values from your $let definitions into the primary filter and replaced add
with +[sum[]]
. Note that we can also eliminate the $text widgets, since functions display their first result as plain text by default.
Edit: Since multiply[0.25]
and divide[4]
are equivalent, you should be able to simplify calc.basicspeed.from.cp
a bit by moving divide[4]
into the final filter run, as follows, so each input value will get divided before they’re both summed:
\function calc.basicspeed.from.cp() [<currentTiddler>get[basic-speed-cp]divide[5]trunc[]] [<DX>add<HT>] +[divide[4]sum[]]
Similarly, we can simplify calc.basicmove.from.cp
by moving the shared trunc[]
into the final run:
\function calc.basicmove.from.cp() [<currentTiddler>get[basic-move-cp]divide[5]] [<calc.basicspeed.from.cp>] +[trunc[]sum[]]