Using Variables?

This might seem like a newbie question, but guess what... 😛    

Lettuce say I'm using a variable to count a number of Items in the characters possession.

Is it bad practice to use the variable for multiple events, If all the variable does is a possession count?

For instance I have a few cooking events and some of the events use the same foods to make different courses.

Can I use the same variable in multiple events to count that certain food Item in each recipe? 

Being so new to this, I don't know much about limitations in the program.  Is having to many events on one map going to slow my game down/longer loading times/ect.? Is there a limit to switches or variables and does having to many of these effect the game.  Is reusing variables like above a good practice or am I just over thinking again?
I always designate two variables as 'random' variables. These variables I use in the entire game for different purposes, but they all have one thing in common; it is temporary. It doesn't hold permanent data, it's data that gets erased or re-used in the same event. This variable is only important in the event that runs it, so it never gets cross referenced.


So if you use those variables for the same reason as I do, then sure, go right ahead and continue this practice. But if you want to use it for permanent data, then you should use a different variable.


As to your questions, yes having too many events on one map can make your game lag (I'd say upwards of 60+). I think there is a limit on switches/variables, but you're never going to reach that limit since it's like 9999 I think.
Yes, there are limits - but they're rather high, so that if you get problems it's usually an indication that you did something wrong.


The most critical part is parallel process events - don't use parallel process unless you really need it.


You can use a variable several times as long as it doesn't have two uses at the same time.


But why do you "count" a number of items in possession? You can usually load the current inventory numbers directly from game data.
Thanks for your time answering this... but... OMG!  My brain is about to explode from making this game.   D:<

I haven't the foggiest idea what I'm doing.  For the most part my game is the development of a trial and error process.

Witch I've been doing to learn the basics of the program.  Anyway, this is what I'm up to.

[IMG]http://i1168.photobucket.com/albums/r496/Nathan_Scheil/Untitled_zpscm6nxxsv.png[/IMG]

Okay, so I made some wine.

As for the "Grape Count" variable usage goes.  It doesn't hurt to reuse this same variable in a different event, as long as it's preforming the same function it is in this one.

Andar - The control variable command is the only way I know how to count items in a player's/party's possession.  If you could show me an easier way of doing this, that would be appreciated. 

Celianna - When you say "60+ Events on a Map"  this confuses me a little.  I'm sure I already have 100+ events on my town map as it stands, with no issues on run time performance,  but I also have multiples of the same events that only run a common event.  Will this make a difference in the amount of events I can use?  Should I be paying more attention to the size of the events used rather then the amount of events I use?  

Edit: If anyone has a link to a "Spoiler how to" that would be great.
Andar - The control variable command is the only way I know how to count items in a player's/party's possession.  If you could show me an easier way of doing this, that would be appreciated.
no, that is the normal way - there are other ways sometimes used by new users that are more difficult, and I didn't know which way you used.
When you say "60+ Events on a Map"  this confuses me a little.  I'm sure I already have 100+ events on my town map as it stands,
It depends on what kind of events and the power of your computer.
Decorative events have only limited impact - I know of cases where you need several hundred decorative events before any lag becomes detectable.


On the other hand, one single badly written parallel process event can lag the map to death even on the most powerfull of all computers.

Edit: If anyone has a link to a "Spoiler how to" that would be great.
You can start by following the link to the "starting point" in my signature

Original thread: https://forums.rpgmakerweb.com/threads/using-variables.54381/