Really strange bug - Added values being appended to number

Status
Not open for further replies.

MysteryMan23

Veteran
Veteran
Joined
Apr 2, 2012
Messages
121
Reaction score
34
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,713
Reaction score
2,830
First Language
English
Primarily Uses
RMMZ
Seems to be working fine for me...what version of VNM are you using?
 

MysteryMan23

Veteran
Veteran
Joined
Apr 2, 2012
Messages
121
Reaction score
34
First Language
English
Primarily Uses
RMMV
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.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
833
Reaction score
671
First Language
English
Primarily Uses
RMMV
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.
 

MysteryMan23

Veteran
Veteran
Joined
Apr 2, 2012
Messages
121
Reaction score
34
First Language
English
Primarily Uses
RMMV
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.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,747
Reaction score
5,767
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

After so long, my random sprites set is complete! I wonder who could guess them all? :kaothx:
2COlHup.png

And yes, I'm doing more.
I'm thinking of devouring some tutorials for RPG Maker MV. Just all kinds: mapping, spriting, programming, ect. the whole works! :)

Maybe videos, my brother and I can sit down and watch them during one of our weekly business meetings.
Ami
trying to make a Dialogue Script in Indonesian,first. then translate into English.

this is the reason why i'm terrible at this section beside making the enemies :stare:
Made a Mapping Tutorial on Adding Lighting/Shadows using Tileset

Forum statistics

Threads
113,928
Messages
1,078,445
Members
148,033
Latest member
AnGieA
Top