Can't use number in variables

Orifiael

Warper
Member
Joined
Nov 23, 2019
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMVXA
I make websites and applications for a living... Therefor I have a certain logic in coding, which I understand myself.
Now my issue is this:

I first declare a variable in a COMMON EVENT.
Make sure it is set to zero.
Then I add +1 .. which would make it an integer with 1.

I run it, the game bugs out, shows an empty text box.
Whatever I try, I am unable to use a variable to return a number, and my logical brain is absolutely baffled.

upload_2019-11-23_14-50-8.png

So here is how I reproduce, after picking up an amethyst, I can break it down into its core elements with a common event as shown above. I use the item:
upload_2019-11-23_14-47-13.png

And it crashes.. it shows some weird jumping black bar, or sometimes a empty textbar
upload_2019-11-23_14-47-29.png
Now if I remove the variables from the event, I do get this (as expected):"
upload_2019-11-23_14-50-22.png
upload_2019-11-23_14-49-0.png

Help me understand, I beg you.

So this works:
upload_2019-11-23_15-7-4.png
upload_2019-11-23_15-6-40.png

But adding this crashes it:
upload_2019-11-23_15-8-20.png
upload_2019-11-23_15-7-59.png
 

Attachments

Last edited by a moderator:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
5,889
Reaction score
4,217
First Language
Dutch
Primarily Uses
RMXP

I've moved this thread to VXAce Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
107
Reaction score
24
First Language
German
Primarily Uses
RMVXA
Do you have any custom scripts installed? It's possible your var22 is assigned to something that influences your GUI.

Also, if you want a variable as a specific value, you don't need to make it 0 first and then add whatever needed, you can set it as that value right off the bat and reduce the CPU cycle. With enough calls you'd otherwise slowly but surely bog the system down.
 

Orifiael

Warper
Member
Joined
Nov 23, 2019
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMVXA
Thanks You are a hero.. .21 was corrupted, 22 actually stretched my textbox.. I cannot find where it assigned .. but .. those both were broken.
 

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
107
Reaction score
24
First Language
German
Primarily Uses
RMVXA
Some things you should always keep in mind:
When you add new scripts, make a search with CTRL+Shift+F (global search) or CTRL+F (search in that slot) and then type in $game_switches or $game_variables to see if there are any references in the new scripts. Most scripters also make it so that adjustable switches and variables are in a block section near the top for easy changing.
DO NOT just paste a script in and expect it to work, always check the settings and asign new switches/variables to the script as needed because it's always possible they will by default refer to a switch/variable that you already use.
And make sure that script-asigned variables are named properly so you don't accidentally use them later wrongly.

In your case, I assume you used YEA - Ace Message System without doing that, hence why var22 bugs it out.
 

Orifiael

Warper
Member
Joined
Nov 23, 2019
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMVXA
Haha, thanks.. I normally name all my vars and switches... I first used a loop, but thought that was causing the bug.. so now I did it like this..

I assumed setting any variable to zero at script head would suffice.

This was a project I worked on a few years back and recently restarted it, so maybe that's why I lost some ins and outs
upload_2019-11-23_16-7-30.png
 

Attachments

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,028
Reaction score
323
First Language
Dutch
Primarily Uses
RMMV
@Orifiael just remember, you dont need to declair a variable = 0
because all variables start at 0 at all times.

in case of need, you can create a conditional branch to check IF the variable = 0 or > 0 (bigger)
than add + x to th variable. if it = 0 or >0 you can do somthing else, like less add or add nothing.

all variables start out on ZERO and switches always OFF. unless you declare it other wise.
either with + on the start up or in a conditional branch like the following example:

if Variable #0032 name >= 0
variable #0032 name = 0
end

so you know than avoid bugss as well =)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,000
Reaction score
6,678
First Language
German
Primarily Uses
RMMV
@Orifiael your problem is that you're not the only one using variables in your game - you have scripts that also use variables (and those scripts NEED to use the variables to work).
But the scripts can't name a variable, so you have to do that for them to keep yourself from using such variables.

Every script that uses variables has a configuration section where you tell it which variables it can use and where you learn what will happen if you place a number into that variable.
For example the message script has two variables telling it how wide and how high the text boxes should be. In your first screenshots the game did not crash - it did exactly what you told it to do. It reduced the text box width to zero letter width after you placed a zero into the variable assigned to hold the text bos width.

Because of this you need to check all your scripts to what other variable configurations you might have missed, name those variables in your project to prevent yourself fromd using it for something else and then get your event working with variables exclusive to itself instead of variables that are used two or three times for different things in your project.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

"Ugh, so tired of these rivers and lakes." *squints and looks off into the distance* "Oh cool! Is that a waterfall?"
Why is it so hard to accept existential stoicism? To insist stoics must be deterministic is like insisting God couldnt create evolving animals. Drop the dogmas and concider the compatible mechanics
I just had a duel at Duel Links, and started right away with a fusion monster... felt like an actual yugioh main character :3
Now listen closely... Here's a little lesson in trickery, This is going down in history...
So the four of my friends are singing a song and I'm like... ohoho I don't know this song. Better act like I do!

Forum statistics

Threads
93,517
Messages
913,136
Members
123,047
Latest member
RedReaper204
Top