I have a global variable with a range from 0-359, I increment by 6 or subtract by 6 as a unit turns since it is turning 6 degrees. Once the number reaches 360 it does not roll over to 0 again for some reason.
I display the value in chat and it does not wrap around!
I also have the wrap flag checked on the Global Key Command in the unit trait
If for some reason you’re set on using Set Value Directly, then you can take the modulus of 360 (add % 360 to the end of your calculation). For the subtraction command, you would need to add 360 first, then take the modulus (it won’t work correctly on a negative number). Keep in mind that % has higher priority than +, so you’ll also need parentheses for the latter.