Texture SubUvs

I’m currently working on a material that uses a texture sheet with different colors as a color palette. I want to be able to select an index of the sheet to use that specific color (so “0” would be the first and “1” the second tile). So far I’ve created a material function based on the flipbook function, using only what is necessary and replacing the time nodes with a scalar input. However, the flipbook function uses a scalar value from 0 to 0.9 (after rounding it down) to determine the tiles, which looks like a percentage. What I want is to use whole numbers to select a specific tile.

Can this be done with a material function in the editor or does it have to be done in C++? In any case, how can I set up the function to use whole numbers, based on the number of columns and rows?

use a scalar node, then divide with 10.
that way a scalar of 1 becomes 0.1

Stupid me. It’s just plain math. I multiply the number of columns with the number of rows to get the total number of tiles, then divide 1 by that number and multiply it with the index input parameter. Done. Next time, I’ll just have to think about it a little longer. I can do math, it just doesn’t occur to me how to approach it when working with anything graphics related.