February 6, 20251 yr Hello, I am trying to work with a cockpit dial that has values of 0, 1, 2, 3, and 4. I would like to map two buttons on my HOTAS to either increment the variable by 1, or decrease it by one for each press. So far, I have this code that works to increment the variable correctly with each press, though it does not stop when reaching 4. 0 1 2 3 4 (L:RIO_RADAR_RANGE, Number) 5 seq (>L:RIO_RADAR_RANGE, Number) I have not found a way to decrease the variable after setting it this way. I have tried these also to increase and decrease the variable, but wasn't able to get either to work. (L:RIO_RADAR_RANGE:0, Number) 1 + (>L:RIO_RADAR_RANGE) (L:RIO_RADAR_RANGE:0, Number) 1 - (>L:RIO_RADAR_RANGE) I must be missing something but can't figure out out, any suggestions as to what I am missing?
February 6, 20251 yr Commercial Member 5 hours ago, MikeWest said: I must be missing something 1. Your variable assignments are missing the unit. The way your scripts are written now, you are reading from a different variable than writing to. 2. I would add min and max operators to limit the range 3. Are you sure about the ":0" index? It is not present in your first script, which you say is working? (L:RIO_RADAR_RANGE, Number) ++ 4 min (>L:RIO_RADAR_RANGE, Number) (L:RIO_RADAR_RANGE, Number) -- 0 max (>L:RIO_RADAR_RANGE, Number) Edited February 6, 20251 yr by Lorby_SI LORBY-SI
February 7, 20251 yr Author 19 hours ago, Lorby_SI said: 3. Are you sure about the ":0" index? It is not present in your first script, which you say is working? You are correct, that was from an earlier attempt that didn't work, without that index the script did work. But The suggestion and code including the min and max worked perfectly, thank you very much! Knowing the correct syntax has helped me add a few more scripts and is greatly appreciated.
Create an account or sign in to comment