[RMMV] MASTER! WE ARE OUT OF VARIABLES!

Posts

Pages: 1
RMMV gives you 5000. I need 19,500. I have lots of questions...

1) Saving variables as strings. Strings typically begin set to a game variable or a game parameter, and in the end it usually becomes a case of $gameVariables.setValue(string, string). I'm still eating up game variables. See I've fallen into the custom of using the text command \V in a message to check their values. Is there a smarter approach here? I'm still new at this!

2) The Custom Variables plugin by SoulPour777. If anyone has gotten a variable value to work in the index argument AT ALL, please let me know how you did it! This is frustrating because a variable value in the value argument works just fine (for both script AND plugin command). I already messaged the developer and hadn't received a reply yet, so I'm posting about it here. If I use a constant value in the index argument, it works. If I try to access a variable one, it does nothing. If you attempt it via plugin command instead, it throws the reference error "val is not defined". I've tried phrasing it several different ways.
Despite this, I have found it to be a useful tool... I can access custom variable values for any event command that needs one, all while not using a single game variable. Nice!

3) Access arrays. Do save game files remember an array's values? One single array could potentially provide more than enough variables... for the purpose of checking their values for events etc.. But how do you edit them and check their values?

4) Is this as simple as just going into rpg_objects.js and upping the cap amount of max variables? In other words... if you try to access a variable with an ID of 5001 (or more) will it throw you an error and crash?

Advanced members never have the problem of running out of variables, so I wanted to hear their thoughts on this.
W-Why do you need that many? What kind of systems are you making with them? You know that if you don't use a variable any more you can re-use it right? I usually have one variable for rolling anything random I need, so that anything tied to random numbers refers to that reusable variable. Same with checking co-ordinates - two variables per event necessary on that map that needs checking, as I can re-use them in every other map.

I'm just wondering why you think you need almost 20,000 variables. It's boggling my mind more than a little. o.O
Vaccaria
You'd think MZ would use a dictionary for switches/variables by now?
4936
Considering that this is JS, I guess you could have that functionality.

Even so, either the system already set them into numbers and just needs to be a string. OR the messages that are strings can be changed into numbers (yes, you can do that because Number() and String()). But considering that, you still have to change these strings into numbers then into strings again, so that could possibly mean why you need that a lot of variables just to change a variable's type and have another variable paired to it so that the type-change wouldn't be that much of a hassle?

As far as I remember, save files includes a variable's state (ON or OFF) and the variable's value and other stuff that will not fuck up the saved game entirely. Possibly, you could have an array ready if you made one. It is still considered a variable. Though you would need another variable to have the array accessible for editing or have to write the arrays independently to make it work. Remember this is JavaScript, not RGSSx something idk blah blah blah.

And one of the reasons why that cap is only 5000 because anything beyond that is not accepted (this is just a hypothesis of mine). As if the processes that are involved enough is tiring for computer, processing those 20,000 variables could put a dent already. The possibiliy of 20,000 variables is likely, but you have to save one variable and replace it with another by the use of an external text that would have the variables without having said new variable to destroy some settings in the game.
Edit: forum code hates brackets, brackets converted to string "brackets"
Holy cow. Er, like Libby said, is there any variables that you can make temporary or re-useable? In Sunset Sheriff I have some variables set aside for constant re-use, like 2 variables for random number generation. Other variables, such as for mining, have the main variables modified on the event 'node' and then it runs through a common event for all the math and loot. (Common events are amaze.)

You can do arrays without a plugin, but it gets pretty darn complex/messy if you don't have ways to easily return the info.(or have a list externally from the game so you don't forget whats what) In VX its supposed to be like $game_variablesbracketxbracketbracketybracket for a basic one. Seita has a neat tutorial https://forums.rpgmakerweb.com/index.php?threads/intermediate-advanced-game-variables.16541/ also Trihan spotted! For MV is a bit different http://www.rpgmakercentral.com/topic/38631-how-to-do-arrays/ ,but still seems doable. (Example, var z1 = $gameVariables.value(114)bracket2bracket; gets you the third variable in that array.) https://www.w3schools.com/js/js_arrays.asp

Now, you prolly already know this already (I knew how to do this in Python, but its a bit different here...ergo had to spend hour and a half looking up stuff before figuring the proper syntax.) so it might not be of much help. But for any newbies, or people who want to brush up on their JS skills, basic things can be really helpful.

Variables as strings, not sure if there is an easier way to do it, although you 'could' set multiple strings into an array. I think I did some of that in a Renpy game I made. Can't remember it exactly, but like (var) MC = bracketmc_name_1, mc_name_2, , mc_gender, mc_age, mc_hobby, mc_tarot_cardbracket. It being Python makes it different, but I know you can store multiple strings fairly easily in JS.

Oh, if you want to have more control, or it may be the only way not sure, to show a variable from an array in text you will need 2 things. First you need the main array variable number, like $gameVariables.value(114), then you will need a second variable to work as an index number. The index starts at 0 and will return the appropriate variable in sequence. The index number could be a temporary variable, like x, or could be a gameVariable. As long as its a (whole/integer) number it technically 'should' work. Remember when refering to $gameVariables you must use .value before the variable number or it pitches a fit. Not sure why though, built-in protection from being altered by the devs? The index number fits neatly behind the variable number. Then to put it into practice use say, $gameVariables.value(114)bracket2bracket; , this will get you the THIRD variable in the array at the 114th variable. Now add this to the standard message script gameMessage.add() and remember to use .toString() after the variable/index number. Like so $gameMessage.add($gameVariables.value(114)bracket1bracket.toString()); .

Thats about it. >.> Its a bit of a mess, but hopefully there is something in there of value to someone. (value = 1) I'll include a picture of what the scripting looks like for reference. Also totally expecting Trihan to roll in here and amaze everyone with his awesome Javascript brewing.

Also be careful, if you use the Event Command: Control Variable on an array it WILL OVERWRITE your array. Luckily I read about this behavior in a VXA topic and just tested for it in MV so it hasn't screwed me over.

>.> Prnscreen has failed me and cut off the first space of every line.

Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
I'm fairly certain that not even professional software uses 19,500 variables; what on earth are you trying to do?

But yes, the elements of $gameVariables are just Javascript array elements, and arrays in Javascript can contain any kind of object, including functions and other arrays. If you set an in-game variable to an array, the array will persist through save games.
Once you have an array/variable setup using the .setValue, you can add a variable or change an existing variable inside an array using .value =. For example $gameVariables.value(114)bracket2bracket = "Varn"; . Or +=, -=, etc for numbers. I spent way too long trying to figure this out for something so simple. >.>

Forgot the lack of bracket format again.
(rpg2k3) KazString allows you to create an array of 20 x 1000 variables, I think by default. The code is easy enough to change if you need more than that. You can transfer that array into a single variable to make a reusable variable. It also allows storing of strings in hero names.

If you can translate the code into MV scripting, you should be able to make use of a similar code.
I just happened to read this about a month ago, seems like exactly what you need. Not sure if someone already said this, I didn't read all the replies here.

https://rpgmaker.net/tutorials/1133/
Wow! I'm relieved (and surprised) that 2 or more other members thought the 19k variable goal was OVERKILL! After reading tutorial 1133 that Link just posted, it blew my mind. Can't wait to try it on RMMV!
unity
You're magical to me.
12540
I'm still curious about what you're making that requires such a large amount of variables XD
pianotm
The TM is for Totally Magical.
32367
unity
I'm still curious about what you're making that requires such a large amount of variables XD


Yeah, I'm like, wow!
Also Delsin7, to figure out how to type [brackets], quote this post.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
You don't actually have to resort to that kind of data manipulation in MV, M-M, as variables can hold arrays of values anyway and you can set them to anything you want.
author=pianotm
unity
I'm still curious about what you're making that requires such a large amount of variables XD
Yeah, I'm like, wow!
Also Delsin7, to figure out how to type [brackets], quote this post.

...That is weird way to do it. Brackets inside of brackets inside of brackets! More brackets than a hardware store.

I wonder if anyone has made an in-game test screen plugin so you could see every array in the game. Would be handy for testing super complex games.
Oh yeah!! I was asked to explain stuff! There's 4 things. Enjoy. (I learned accessing array values are the way to go, that's the route I'm taking.)

1) The 50th game by Tecmo (or Taito?). It's called Bakugan: the Forbidden City. A highly underrated gem, the opening sequence is filming an opening movie of your character sprite's moves, unbeknownst to the player! The first time you experience this it's unforgettable: "Whoa! I look like a fool!"
When you know it's coming, you try to make an opening movie so flashy you will want to brag about it and show others, too smiley to speak.
In rpg maker, this can be very easy or very hard.
Very easy if you make a plugin that records a movie file of the players' actual lucid gameplay (or a LOT of screenshots for a slideshow).
Very hard with eventing. Turn based combat and tile-by-tile movement can be recorded (and easily recreated) every 4 frames or so. Eating up 5000 variables, one every 4 frames, (Ed. my math was WAY off) you get just under 6 minutes. What if you had a real time rpg with combat like Seiken Densetsu or Golden Axe? The character sprites have more varied positions now, and recording your movements would step UP, perhaps every frame.

2) I attempted to make a fantasy card game like Yugi-Oh, Pokemon, MTG etc. The bare mechanics of these games are all based on zone changes, the cards moving to other zones. The interpretation of these zone changes make up victory, defeat, and everything else. Suppose your card limit is 60 in 4 zones and 1000 in the 5th zone (1-999 cards in play. 1000 represents infinity, the only zone that allows it). That's 1,240 variables PER player! For more fun, 300 max cards in the first 4 zones + 1000 = 2,200 variables. That's not counting other variables used for remembering zone sizes, not to mention variables for rpg elements not found in the actual card matches! Trihan provided invaluable help here with a script command to handle all the zone changes:

temp = $gameVariables.value($gameVariables.value(1));
$gameVariables.setValue($gameVariables.value(1), ($gameVariables.value($gameVariables.value(2))));
$gameVariables.setValue($gameVariables.value(2), temp);

All the developer has to do is provide the var IDs beforehand, where 1 represents "FROM" and 2 is "TO". Most commonly, "FROM" is set to the var ID of the top card of a player's deck! (Drawing a card). In this case, "TO" would be the var ID for "top card" of player's hand + handsize. (This is so the first card in their hand isn't overwritten.) Also, note that the value of the var stored in "TO" is always 0, representing empty space. When the above script is executed, the top card of the deck goes to the player's hand, while the top card of the deck becomes 0. After this is done, I have another common event that detects all the empty spaces in card zones and make them pile up neatly, with positive values on top (tangible cards) and values of 0 (lack of cards) on the bottom.
I use Trihan's script AGAIN, except this time it is iterated over and over = to cards in zone. Every iteration increases the values of "FROM" and "TO" by 1. The 0 on top of the zone ends up on the bottom. I like this method because no values are lost, just switched. I could overwrite them all to the next var ID up with only 1 line of code, but then I have to set the proper amount of bottom cards to 0 too. All card shuffle/switch events operate on the principle that the "top card" of each zone (Deck, Hand, Discard Pile, Special Pile, Cards in Play) have a positive value.
(This is why I got frustrated with the Custom Variables plugin I tried! It wouldn't function with a variable value in the index argument. As you can see above, it's a must-have for this kind of thing.)

3) "Ogre Battle" style campaign battles!!! (Big ones). Have you played this Atlus game? It would be variable CRAZY if remade today! You could take the data encrytpion tutorial's example a step further and have a patriotism level for each unit corresponding to each country in your game. This could easily push variables to 6 digits.

Ex: If one or more of your unit hails from a region that you are invading, the desertion rate is high and morale is low. Conversely, if you are attacking the nation that killed your unit's family, the morale will soar and they will fight to the death.

4) VISUAL NOVELS. I understand they are more popular these days (tried Renpy, liked it) but found that the variable use on these are severely undertapped. Let's say you are making a high school/mystery type game like Persona. In the beginning you fill out a very extensive questionnaire that creates your character. Every answer sets a variable that determines the hair type, or nose type, or eye color and so on in sequence for each actor/NPC until a full Bust graphic is defined. Then repeat this for EVERY character. You manipulate json files checking variable values for these attributes. Teachers, cops, housewives, students, family members, pets, everyone! Just think of the thousands of combinations...
It also determines character stats as well. Here's where ORANGE time-system plugin comes in:
You have a set of variables for everything, for the duration of one day. The next day, another set of variables like the first, evaluating them all for changes and so on for 365 days x years allowed in your game. If you recorded like this, you could do VERY complex achievements.

Ex: You want to create a special achievement for being the best athlete at the high school. What if the requirements were to:
1. Not miss a single practice all season long, AND pass by the complex where practice is held at EACH different one hour interval within your game on different days. This means you would have to visit the complex between 11:00 and 12:00 one day, then between 12:00 and 1:00 a different day, until all possibilities have been visited.
2. Within practices, certain stats have to decrease over the course of a few days out of failure, then improve dramatically over the following 2 weeks with success! (by certain values). In other words, you have to make a falling, then ascending graph of your stats over time (To show you were broken down, but improved more than your peers.)
3. Retain a certain average of points scored over a span of time, retain it at summer training camp, then surpass it your senior year, which happens to be the following season! For example, average 6 or more points per game over the course of 2 weeks in your junior season, then retain that during summer training camp. Next year at high school, retain a higher points per game over 2 weeks to satisfy the requirement.
4. On the 20th of each month of the school year, your character (or an ally) must attend student council, and press your concerns for the athletic clubs. What if you had to evoke 3 positive and 3 negative responses from the student council one semester, then either boycott them completely or have them eating out of your hand the next semester? Either route here could satisfy requirement 4.

You could use also this concept for adjusting experience points received when whomping weak enemies that are no challenge to you over time, or summoning rare or super powerful enemies when you are dominating everything over time!

Thanks for thoughts!
Ed. Wow duh! I just realized I could use a variable's ID in the database as a queue (for the card zone thing), to only set variables I needed and not skip over long sequences of zeros in the database of variables I'm not using. I'm an idiot.
Pages: 1