At times we all have to do our math. How does it work? Let's imagine the human orders two cups of latte at a price of
$3.75 each. How to calculate the total price? It is obvious for human intelligence that
2*$3.75=$7.5, however your bot is not able to do the math on its own.
So, what do we do? This is when we need the calculator, which is, by the way, pretty easy to use.
Let`s assume the bot knows the price of one cup
%cupPrice=3.75 and also memorized how many cups were ordered
%Total is used as the variable to calculate the final price.
🐫 All calculations are run by addressing to an external calculator
https://api.pipe.bot/calc. Take it as Paradigm.
Write down the following in the node:
%Total=/get https://api.pipe.bot/calc expr=%cupPrice*%cupAmount
Obviously, the calculator accomplishes not only multiplication operations, but also addition, division, approximation, rooting and so on. Refer to Fabrikant's Accounting Book to find the list of available functions.