max is a function, (and so is min) so you will need to send it some parameters and it will return a value. You need to do something with the value returned. The way you have it set is more like a command, which is why it's not working. It doesn't need it's own handler, the error message is telling you you can't use the max function
like a handler.
You
Code: Select all
put (gsubSpeedX - 0.1) into gsubSpeedX
but then you need to fix the max (and min) value with
Code: Select all
put max(-0.1,min(gsubSpeedX,-0.3)) into gsubSpeedX
Although... I think you want to fix the range from -0.3 up to -0.1 right? Let's say gsubSpeedX was originally -0.3 and your first adjustment subtracted 0.1 giving -0.4, then your max/min will take it and return "the maximum of two values, either -0.1 or -0.4 (which is the minimum of another pair of values, either -0.4 or -0.3)"
As -0.1 is higher than -0.4 then you will get -0.1 returned by the max function (which nests a min function inside it).
So swap the min and max to
Code: Select all
put min(-0.1,max(gsubSpeedX,-0.3)) into gsubSpeedX
which returns "the minimum of two values, either -0.1 or -0.3 (which is the maximum of another pair of values, either -0.4 or -0.3)"
As -0.3 is higher than -0.4 it will return -0.3 from the nested max part, and as -0.3 is less than -0.1 it will return -0.3 from the min comparison too. So you have subtracted 0.1 from the speed but limited it so that it can't become less than -0.3
Where you are limiting values to a range, it's not that intuitive to see where the min and max apply - you might naturally think that you choose max when you want that to indicate the max value and min to choose the min value, but in fact you want the opposite - if the value is higher than the minimum limit - you're comparing the value against the minimum it can be so you want to pick the max of the choices. Make sense?
HTH