Really strange bug - Added values being appended to number

So, I have a command set up to add one to a number and use that to modify things whenever a certain button is clicked. But for some reason, instead of adding one to the number, it appends a one's digit like the number's a text! I have no clue what's going on here, and I don't know if this is a known issue or not.

Here's a sample of the code:


The third local number variable is the one that I know is affected. Other variables may be affected as well; I don't know. What's really weird is, if I set the "variable 3 is equal to" check to "greater than or equal to", the variable resets after a couple clicks and works just right afterwards. Even stranger, when a different bug sharing the same code is clicked, the variable just gets stuck at a certain point. This happens even if I set the "variable 3 is equal to" check to "greater than or equal to".

Can anyone give any insight into this? I'd really, really appreciate it.
Seems to be working fine for me...what version of VNM are you using?
My current version is 1.0.1101. I'm using Steam.

Also, I managed to refactor the code to avoid using conditional branches, and the problems have mostly cleared up. There's still an issue with some values not being updated at times, but I think I can handle it.

Still, this is a weird bug. I think the developers might want to know about it, if they don't already.
in javascript, if you add a number to a string it converts the number to a string and appends it
'apple' + 1
will return
'apple1'

I'm guessing one (or both) of the things you're adding are being handled as strings when they shouldn't be.
Okay, so, it turns out that the cause of the bug is me using Text to List to fill an array with numbers earlier. Apparently, when you do that, the elements of the resulting list will all be texts which just so happen to look like numbers. That's why the numbers were being appended.

This also explains why the variable eventually resets; the numeric value of the text becomes greater than the value being checked, and the variable was reassigned to an actual number. As for the values sometimes not updating, that was a different bug resulting from me forgetting to set a switch properly.

Okay, all problems here are solved, and it's time to close the thread! Thank you all for your help.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/really-strange-bug-added-values-being-appended-to-number.137090/