31
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: March 23, 2021, 01:17:45 PM »
whether it is possible to perform a comparison test without going through a macro as it
{.if|{.8000 > 7500.}|{: busy :}|{: archive :}.}
it is strongly preferable to place the equivalent macro as a precautionary measure
{.if|{.>|8000|7500.}|{: busy :}|{: archive :}.}
this allows you to acquire good habits and write functional code, HFS does not support direct literal numerical calculations as javascript
{.%number-addresses-downloading%*%speed-out% > 7500.} is bad
{.>|{.calc|%number-addresses-downloading%*%speed-out%.}|7500.} is correct
{.256*3 < 10 .} is similar to "256*3" < "10" as strings comparaison
you can test this in menu>>debug>run script
{.if|{. 25.6*2 < 100.}|true|false.} ->> "25.6*2" > "100"
{.if|{. {.calc|25.6*2.} < 100.}|true|false.} ->> 56.2 < 100
{.if|{.8000 > 7500.}|{: busy :}|{: archive :}.}
it is strongly preferable to place the equivalent macro as a precautionary measure
{.if|{.>|8000|7500.}|{: busy :}|{: archive :}.}
this allows you to acquire good habits and write functional code, HFS does not support direct literal numerical calculations as javascript
{.%number-addresses-downloading%*%speed-out% > 7500.} is bad
{.>|{.calc|%number-addresses-downloading%*%speed-out%.}|7500.} is correct
{.256*3 < 10 .} is similar to "256*3" < "10" as strings comparaison
you can test this in menu>>debug>run script
{.if|{. 25.6*2 < 100.}|true|false.} ->> "25.6*2" > "100"
{.if|{. {.calc|25.6*2.} < 100.}|true|false.} ->> 56.2 < 100