First, I’ll admit I’m not a programmer in any way, shape or form so what I’m asking might scream “noob”.
I’m trying to figure out a way to round numbers in steps of 5 in Zscript. For example: If a variable is 31 or 32 - it’s rounded down to 30. If it’s 33 or 34, it’s rounded up to 35.
My goal is to use it in a modified version of marcus_civis’s excellent “Brush-Up-Down” code. I’ve a changed it to handle brush size, z intensity, and focal shift (almost, the focal shift isn’t quite working yet) so I can map them to my Wacom touch wheel. Since I always want the changes in increments of 5, I put that in and removed the code that let you change it. But I’d also like to add in the rounding so the increases/decreases always start on a number that ends 5 or 0.
I asked one of the programmers where I work how rounding might be done in the simplest programming terms so I could figure out a ZScript equivalent. They suggested looking for some functionality that let me find the last number in the variable and run that through If/Then statements to decide if it should be 0 or 5.
Although figuring all that out will be a good learning experience with Zscript, I thought I’d put the problem to the forum and see if there is better solution in Zscript.
Any suggestions are appreciated!