\V[] working weird

Well, I'd just like to know if anybody else experienced this... \V[] sometimes displays wrong data for me...

sample code:

p $var.to_s$game_variables[1] = $varp $game_variables[1].to_sthen call Text Message with something like "You have \V[1]"let's say $var is 1

both p calls print out 1, but the game message shows 3

And it only happens when I use Variable number 1, if I use any other variable, it works completely fine...

example: this works completely fine

sample code:

p $var.to_s$game_variables[3] = $varp $game_variables[3].to_sthen call Text Message with something like "You have \V[3]"So it's weird, really... and I don't even have any other script or whatsoever that modifies game variable 1
Are you using my Linked Variables script? If you are,

Code:
$game_variables[3] = x
would have no effect, if you've set up @links[3].
Nope... as I said, no scripts are modifying the variables aside from the posted one (AFAIK)... Plus the p calls print out correctly and it only happens for variable 1... of course I can always just avoid using variable 1, but I wonder if anybody experienced that...
You don't have a parallel process event or something that's changing its value? Put a


p sprintf('var %d is now %d', variable_id, value)


into the Game_Variables []= method to see if something is changing it back (and it should also register when you change it in the first place).


If I follow your directions, the text box shows the same value that's printed to the console.
well, $var might be changing... but if that's the problem, then it should also bug with the other game variables... but apparently, it only does for variable 1... I'm gonna try printing out from the variable operator when I get home...
What's $var, and where does it get set up? You could do another p $var (not sure why you have the .to_s as it's not needed) just after printing $game_variables[1] and see if it's changed.
I have to_s because it's an integer and sometimes directly sending out non-strings to p gives me an error so I put it always... It's a counter variable of sorts...


gotta try that...
I've only ever had an error if I've been trying to add it to a string:

p 'actor 1 hp is ' + $game_actors[1].hpbecause it's NOT a string and doesn't have a default conversion, I need to use .to_s
But if you're JUST printing that, p doesn't care if it's an integer, a string, an array, or anything else, so you don't have to convert it.
100% guarantee that if you do that in a new project it won't happen.
I think your best bet is to make a demo.

Original thread: https://forums.rpgmakerweb.com/threads/v-working-weird.20837/