Hi Spiceant. Welcome to DB.
how can I expect math to occur here? I dont suppose div and mult go before add or sub, considdering the code nature of bots in DB.
Math in DB is similar to assembly language. It uses a stack system with 20 compartments. Whenever the program encounters a "sysvar" such as .up or a number like 26, it "pushes" the value onto the stack so that it fills up like a pile of pancakes.
Mathematical operators normally only act on the top two values in the stack so there is no hierarchy of math commands like you get in a calculator or in Excel.
Let's say the top of your stack looks like this..
Stack position...Value
You can only access the top two values. here are a few ways that the code will use them.
storethis will totally remove the top two values, then store the value in position 2 into the memory location stored in position 1. In this case it will store 56 into .up (memory position 1) and make your bot accelerete forward.
addThis will remove the top two values, then add them together and finally return them to the top of the stack. Top value will now be 57.
add multThis will first do the same as add did but then it will again remove the top two values (now 57 and 0) and multiply them together, placing the result back on top of the stack. The stack will now only have two values, 0 and 2. Mult is very useful command to remove unwanted junk from the stack.
Does that make any more sense now or am I just digging a deeper hole?