min/max function needs its own handler?
Posted: Thu Nov 21, 2013 7:42 pm
I am trying to limit speed. Not finding anything that discusses this I decided to follow dictionary example as best as I could. There is no indiaction at all that this min/max function needs a handler all by itself, considering that the whole script is actually in a handler and therefore the min/max function, being within that handler theoretically should work. This error message: card id 1002: execution error at line 10 (Handler: can't find handler) near "max", char 1 tells me otherwise. However I have no clue how to interpret this other than the max/min needs its own handler - but I do not understand then what to do.
EDIT: Ok stupid I discovered that you use 'Put' and so that returns ok, But, still the speed just gets faster and faster. So I am back to the same query, I can't get the speed set to a maximum despite fiddling.
chris
EDIT: Ok stupid I discovered that you use 'Put' and so that returns ok, But, still the speed just gets faster and faster. So I am back to the same query, I can't get the speed set to a maximum despite fiddling.
chris
Code: Select all
on arrowKey theRudder
if theRudder is "left" then
put (gsubSpeedX - 0.1) into gsubSpeedX
max(-0.1,min(gSubSpeedX,-0.3))
end if
if theRudder is "right" then
put (gsubSpeedX + 0.1) into gsubSpeedX
end if