Split 3 or 4 digit number.

Hy,
needed to show HP and MP for a event in my demo project but it needed to be so the character can move, so show text ect.. was out of the question since you cant move and i dont want to use any scripts / plugins...
So the only way i could have managed that is with "show pictures" but there was no way i will make 999 different images or beware even 9999 if you got 4 digits... so i thought of another way, to break the digits down and show them individually, i searched around but found really nothing and after a little bit of playing around with numbers ect.. i actually found a way to break the digits down into their number so lets say from 5432 you break them down in 4 different variable 5,4,3,2 and can show pictures individually, wich is still some work but by far not nearly as much as making 9999 different pictures and branches ect.. 😀
Here is the event:
1641087541651.png


In my case, digit 1 is saved on variable 135, digit 2 on 134. digit 3 on 133 and digit 4 on 132.
All there is left to do is put the 0-9 pictures in branches, copy + paste them and just change the variable + finetune the x / y positions.
With this you can show HP-MP, stepcounter in real time or any other moredigit number you want to show without the use of plugins.
If you need to break only 3 digits down, then just cut at the -----1st digi-(1k)----- comment. (the first event actually was 3digits only but i added then the 4th one as well)

Since i could not find anything else like this, i thought why not share, maybe someone can use it.
that is one possible way - and actually exactly what the modulo operation is about.
however it gets tedious if the number has a lot more digits.

for higher-digit numbers there are simpler ways that require some scripting knowledge:
1) you turn the number into a textstring (the function for that exists in all programming languages but is different between javascript (MV/MZ) and Ruby (XP/VX/VXA)
2) a string is usually stored as an array, which means that each element of the array is another letter of a number, and there are commands to split arrays as well
3) turn each letter back into a single number
that is one possible way - and actually exactly what the modulo operation is about.
however it gets tedious if the number has a lot more digits.

for higher-digit numbers there are simpler ways that require some scripting knowledge:
1) you turn the number into a textstring (the function for that exists in all programming languages but is different between javascript (MV/MZ) and Ruby (XP/VX/VXA)
2) a string is usually stored as an array, which means that each element of the array is another letter of a number, and there are commands to split arrays as well
3) turn each letter back into a single number
Hmm, may be but i want to do as much as possible with the maker, so no scripts / plugins and 2nd i have no clue how to do that. 😀

Il know tomorow for sure when i finish this and actually make HP-MP in real time showing but i asume its not that much of a difference if you got 3,4 or 5 digits... i think its just a matter of copy paste then and changing the variable... dunno, tomorow il see.
i asume its not that much of a difference if you got 3,4 or 5 digits
Of course not - that is why I wrote of "a lot more digits" and not "one more digit".
Try to use that process for a 15-digit-number and you'll see the difference.
Of course not - that is why I wrote of "a lot more digits" and not "one more digit".
Try to use that process for a 15-digit-number and you'll see the difference.
Where would you use or get 15 digit numbers in the maker?
HP and MP got 4, the other atributes even only 3. 😀
Moved to: Non Maker Specific Tutorials

Where would you use or get 15 digit numbers in the maker?
A password
Where would you use or get 15 digit numbers in the maker?
there are quite a number of cases where you need higher numbers for story-based numbers instead of engine-based numbers.
The most common one is already mentioned above: Passwords.
another one would be coded gimmicks where you get a code (either ingame or purchased) to enter to get free items, or parts where the game is not medieval but SF-based and more.
there are quite a number of cases where you need higher numbers for story-based numbers instead of engine-based numbers.
The most common one is already mentioned above: Passwords.
another one would be coded gimmicks where you get a code (either ingame or purchased) to enter to get free items, or parts where the game is not medieval but SF-based and more.
Why would you want to split the digits for a password when you already have a perfectly fine password function? You can use the built in "input number" or "name input".
Also this is purely meant to show things like HP onscreen without the use of plugins and passwords wont be shown onscreen so i think to make a 15 digit nr. split would not be that bad, youd need ofc 15 variable and the event would be much longer, you know what... il try it later, challenge accepted.

So, did it, 15 number digit split and tbh it was alot easier then expected, mostly copy+paste.
1641138573343.png


The number is generated from the first page variable exp and then put into reids actually exp.
From there it will be used later to change exp variable to pull the numbers.
Anyway, there is no need to use the ingame exp counter but i thought why not, he is one of the few ingame things wich actually go to such high numbers but every variable will work.
Also i did not screenshot everything because im gonna put it anyway in my project, so anyone who wants to use it or watch it can just download the project.

Original thread: https://forums.rpgmakerweb.com/threads/split-3-or-4-digit-number.143522/