Getting the value of a certain digit inside a variable (for Bitmap-Counter)

I'm trying to make a counter with bitmaps.
I have done it in the past with the Event Editor.

Something like this:
ex.png

This worked well until I needed a counter that shows larger numbers. (1k+)

I thought, since I'm using different bitmaps for each digit anyway, I only need to check the value of each digit rather than creating thousand of conditional branches.

How can this be done? Maybe splitting the value of the variable into several other variables? Or is there a way to simply check the value of a certain digit inside the conditional branch?

Thank you!
You'd need to use JS, and at that point you're better off using PIXI to render the number.
It can be done with pure eventing by splitting up the variable.
And the easiest way to do that is to use the modulo operation of the control variable command to first remove the top numbers, because that way it doesn't matter how high the numbers get.
Oh yeah, you are right. I never thought of dividing the variable. I never used the modulus operation but it works perfectly for that! Thanks Andar!
Oh I just realized... JS lets you use a string like an array (sort of... you can read but not write since strings are immutable).

So say you have numberVar as 9123...

Code:
var numberVar=9123;
var stringVar= numberVar.toString();
for(var i=0; i < stringVar.length; i++)
  {
  switch(stringVar) {
      case '0':
          // draw a 0
          break;
      case '1':
          // draw a 1
          break;
      case '2':
          // draw a 2
          break;
         // etc...
  }
}

Original thread: https://forums.rpgmakerweb.com/threads/getting-the-value-of-a-certain-digit-inside-a-variable-for-bitmap-counter.88018/