Makai Object Variables

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
Hello all, first time posting here i think. Not a native English speaker here! So i'm a newbie in JS but i'm loving it and i created my own plugin for RMMV. It's called "Object Variables".
  • Enables variables to hold infinite values (in the form of properties)

  • Simplified code for "Show Text"

  • Ability to get the values for conditions

  • Ability to use your variables' names instead of IDs

  • Compatibility (doesn't affect any other plugin as far as i've seen)

  • Doesn't do anything unless you want it to
You can get the plugin here:

So what do I mean by "Object Variables":
"Normal" variables hold a single value. "Object" type hold properties and each of those hold specific values. So, for example, If your variable is called "anything", then the object of "anything" could have anything.one=1, anything.two=2, anything.three=3, thus "anything" now has three properties, each holding its own value.

In essence, this means a single variable can hold many values.

Why should you get this plugin:
This plugin provides you a simplified control over creating, changing, getting and showing properties of object variables. On its own, the plugin doesn't do anything, so you can have it in your plugins manager even if you're not using it.

You have control over name storage and case-sensitivity:
So this version has two parameters:
1. Store Variable Names:

This stores the names you have given to the variables. So if you go to your variables, select variable 1 and type in, as a name, "Trigger" (without the quotes), then this name will be stored along with the variable's ID. This parameter enables you to now call the variable as "Trigger" (without the quotes) instead of using its ID.

2. Case Sensitivity:

This makes the letters' cases matter or not. If it's ON, "Trigger" and "trigger" are two different names, so you must pay attention to that if you call them. If it's OFF then they are all considered lower-case. For example "Trigger", "trigger", "TrIgGeR" are considered the same name.

This goes for variable names too, if you have the first parameter ON.

New! You can control the plugin through plugin commands!
1. NewVarProp: VariableID PropertyName Value

This will go to variableID and create a property with the name PropertyName and set its value to Value. If the variableID already has a property with that name, it will simply change its value to the new Value.

Example: NewVarProp: 16 height 4
Now variable 16 will have a property called "height" with a value of 4.

2. StoreVarProp: VariableID/Name PropertyName StorageVariableID

This will go to VariableID, to its property PropertyName, take its value and store it to StorageVariableID.

Example: StoreVarProp: 16 height 13
Now variable 13 will hold the value of variable 16, property "height".

If you did both of these examples, typing \v[13] in the box of "show text" will show you "4" as a result.

Note that if you have Store Variable Names parameter ON you can also type the variable's name in StoreVarProp. So if in our previous examples variable 16 was named "mark" you could type "StoreVarProp: mark height 13" instead.

You control the plugin via script calls:
To make a script call you have to go into an event, open up the command menu (the one that you open to "control variables") and go to its last page, to "script". There you can make any of the following script calls, by simply typing it in:

maka.objVar.setProp(x, y, z); // Creates or changes a property's value
X = Variable ID
Y = The name of the property that you want to create or change, in quotes
Z = The value that the property will hold

Examples: maka.objVar.setProp(141, "power", 10);
-
maka.objVar.getProp(x, y); // Gets a property's value
X = Variable ID (or name, if the Store Variable Names parameter is ON)
Y = Property name (in quotes)

Examples: open commands menu->condition->script:
maka.objVar.getProp(141, "power") == 10
->show text->"Wow! So much power!"
In the example above you can also type (mark, "power") if the name of variable 141 is "mark"(without the quotes), is unique and you have the Store Variable Names plugin parameter ON.

You can show the values of the variables properties in "show text" through a simple tag:
Whenever you want to get the value of a variable property type:
\VOBJ[x:y]
X = The variable that holds the property. You can get it by either typing its ID or, if you have the "Store Variable Names" parameter ON, typing its name. Note that in this case, its name must be unique.

Y = The property's name.

Examples: \VOBJ[141:power] , \VOBJ[mark:height] , \VOBJ[141:5]
(in the example above, a smiley keeps on being created instead of : P. I don't know how to make it stop showing smileys. Basically what I wrote was \VOBJ[141: Power] but without the space.)

tl;dr version: Exercise, my own games, gift to the community:
So basically, while learning JS, i found it supports "object" variables, which are able to hold more than one value as properties. I also have a guide on Steam (MAKAIROSI guides). But since it's a rather simple procedure, i thought of making a plugin to automate it, as exercise.

I mostly wrote it for my games, since i was often in a situation where i had values, minimums and maximums of those values, for each of 5 attributes, for each of 4 characters, to a total of...60 variables? I think it's 60. Anyway, with this thingie i only need 1 variable, which is the character's name, with 15 attributes, calling them by their names instead of their ids. So i'd just call \VOBJ[Cyril:Joy]/\VOBJ[Cyril:MaxJoy] et voila.

The third reason I made this was because the community has helped me immensely and I wanted to give something back. More plugins are coming!

It's really easy to use and i doubt it will be incompatible with anything because of its simplicity.

The plugin could use some improvement:
Please tell me what you would like it to do! I can only come up with so many ideas :p

->ADDED: Array handling! I have included specific functions for array handling now. You can add properties which are arrays!

->ADDED:I am now trying to learn how to include plugin commands so that the user doesn't need the script call.

->ADDED:I think i might add a parameter to enable or disable case-sensitivity in names. I *think* it's case sensitive right now. I'm learning all this stuff myself as i go.

->ADDED:I will also stop deleting the variable name and ID for the array "storage" every time something is changed in its properties, i promise xD It's just that at the time that i was learning about how to delete information in arrays, it worked and i thought "just leave it there!". It kept adding multiple entries of names and ids before... EDIT: Now it just replaces its previous name with the new one, even if they're same, in case someone is crazy enough to change the name of a variable via script mid-game.

->ADDED:Also, i will add a script call for returning a variable's property value for conditions.

It will be cool to see if it helped anyone, or if anyone wants to comment on my code or the plugin's usage, anything really. I'm open to criticism, speak freely. Also, obviously, tell me your own suggestions.

EDIT: I updated the file, if it's v1.2 it's the new one. This one will handle the variable names storage even between saves, and even enable you to store arrays in properties! I will also update it to v1.3 which will remove some unnecessary stuff.

Please inform me about bugs and suggestions! I'm new to JS and it's really hard to catch all those errors on my own! I apologize in advance to anyone who got frustrated by an error i overlooked :s

License:
Use freely as commercial, non-commercial, whatever. Edit it as you wish but if you do i'd like to be credited as the original author inside the plugin description. If you want to be extra nice, you can include this page's link as well.
 
Last edited:

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,288
Reaction score
432
First Language
Dutch
Primarily Uses
RMMV
it sounds so complicated. I wonder where it is usefull for!
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Since the variables in MV can already hold objects, which you can manipulate. This mostly seems to create some plugin commands to handle that. Probably more useful if you don't know much Javascript... But then one has to wonder, would someone who doesn't know about Javascript use objects?
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
118
Reaction score
7
First Language
Australian
Primarily Uses
RMMV
I can see the value of this plugin when you're dealing with the complex game and thousands of variables.
For events for example, instead of creating a bunch of variables for different quests, you can set up a single variable and use its objects for multiple quests?
var 1 quest/quest2... and so forth with different values for conditions and such?
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
it sounds so complicated. I wonder where it is usefull for!
In general, object-type variables are useful for holding different properties under a single name. Take $gameActors.actor(x) for example. If you log $gameActors.actor(1).hp it will show you actor 1's current hp. This is a property of the object actor(1). Which means that, just like actor(1) has hp, mhp, atk, def, etc, you can treat any variable to "behave" like that.

So for example variable 1 can now have its own hp, atk and def. Or whatever you want to add to it.


Since the variables in MV can already hold objects, which you can manipulate. This mostly seems to create some plugin commands to handle that. Probably more useful if you don't know much Javascript... But then one has to wonder, would someone who doesn't know about Javascript use objects?
True, and that's basically what i'm utilizing. If you know JS then you could simply write $gameVariables.value(1)['height'] = 1 or something and achieve the same thing. However, as i was finding out all the new info (i'm a js newbie) i decided to group everything together to make it simpler for me. Also, it was a cool exercise.

To be honest using object variables can get your code complicated really fast, which means you will probably need to use them inside plugins. And if you can write your own plugins, it becomes kinda obsolete. But i still used it myself so i thought why not share it ?

However there is the addition of printing the variable's property to text with \vobj[x:y]. This was extremely useful for me.


I can see the value of this plugin when you're dealing with the complex game and thousands of variables.
For events for example, instead of creating a bunch of variables for different quests, you can set up a single variable and use its objects for multiple quests?
var 1 quest/quest2... and so forth with different values for conditions and such?
Yep! That's exactly why i made it because i wanted to do exactly that. So for example if you had a variable quest1, then you could setup quest1 to hold properties such as 'name', 'timeLimit', 'rewards' or whatever you can imagine. In your database you would only "waste" 1 space.
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Can't fault you there, I never really fault anybody who creates free stuff for the community. Actually ages ago before I understood objects, I watched this thread. I figured maybe I could use this plugin, but was never really able to find a case where it was useful for me. Then I just started working on my own plugins, and creating my own objects in them. So I get where you're coming from here. Half of my plugins aren't really useful to anybody but me at the moment, but in making them one can really learn so much. :LZSexcite:
 
  • Like
Reactions: MiD

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,288
Reaction score
432
First Language
Dutch
Primarily Uses
RMMV
are you able to make a demo for it? than I can tr to understand it from within :)
 
  • Like
Reactions: MiD

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
are you able to make a demo for it? than I can tr to understand it from within :)
That's a great idea! I've no idea where to upload it though. At the moment i'm trying to fix an error i've found that deletes the stored variable names... also the new version will enable you to create arrays inside properties (not sure if it's useful for anyone who doesn't know js though)

Is there a place where i can upload stuff permanently? I can add it to wetransfer, but the link will be valid for 7 days only.


Can't fault you there, I never really fault anybody who creates free stuff for the community. Actually ages ago before I understood objects, I watched this thread. I figured maybe I could use this plugin, but was never really able to find a case where it was useful for me. Then I just started working on my own plugins, and creating my own objects in them. So I get where you're coming from here. Half of my plugins aren't really useful to anybody but me at the moment, but in making them one can really learn so much. :LZSexcite:
That's exactly it. I have a plugin called "generalscriptcalls.js" which basically has a huge number of scriptcalls useful to me, but only me xD and only the game they were designed for... for example "getFoodQuality()" xD
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Yeah, I have a tools plugin that I put code into do event interaction, coordinate checking, info harvesting at those coordinates, etc. It's actually slowly turning into an entire movement system. But it sure didn't start that way.

Or my Overwrites plugin which makes the game fullscreen, changes the menu button around, skips the title, sets on always dash, and sets the volume to lower levels... It's kind of a wreck of plugin. But I didn't want to clutter up my plugin lists with tiny overwrites. :LZSwink:

As for where you should host your demo for you plugin, how about Itch.io, Github or Dropbox?
 
  • Like
Reactions: MiD

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
Yeah, I have a tools plugin that I put code into do event interaction, coordinate checking, info harvesting at those coordinates, etc. It's actually slowly turning into an entire movement system. But it sure didn't start that way.

Or my Overwrites plugin which makes the game fullscreen, changes the menu button around, skips the title, sets on always dash, and sets the volume to lower levels... It's kind of a wreck of plugin. But I didn't want to clutter up my plugin lists with tiny overwrites. :LZSwink:

As for where you should host your demo for you plugin, how about Itch.io, Github or Dropbox?
That looks pretty cool! Is that what you're working on? Good job!
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Yep, thanks! Mostly just my Dev room so I can visit maps quickly, and er... break things without breaking other stuff. Figured it could live in my signature for a bit unless it annoys people. :LZSwink:

Not going to lie, I might turn it into the world map since I like running around it. And I kind of need someway to tie together all the randomly created areas. :kaoback: But for now, I'm working on the functionality of my visuals plugin. Turns out it wants to play a little rough with RAM, and since it handles 60% of the visuals, and 100% of the dialogue... er... I should probably fix that. :LZSwink:
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
Yep, thanks! Mostly just my Dev room so I can visit maps quickly, and er... break things without breaking other stuff. Figured it could live in my signature for a bit unless it annoys people. :LZSwink:

Not going to lie, I might turn it into the world map since I like running around it. And I kind of need someway to tie together all the randomly created areas. :kaoback: But for now, I'm working on the functionality of my visuals plugin. Turns out it wants to play a little rough with RAM, and since it handles 60% of the visuals, and 100% of the dialogue... er... I should probably fix that. :LZSwink:
It seems the bit you shared is a bit heavy, were you testing your RAM's capabilities or your own (as a dev i mean)? Well, maybe both. I doubt RPGmaker handles RAM with care, i've seen games that weren't supposed to be heavy, yet lagged like hell.
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Oh I'm testing my own abilities and learning PIXI along the way. MV is definitely heavy on the RAM usage for what it does. I push a lot of stuff to my own plugins for that very reason, but it wasn't at fault here. I was just excited that my plugin was working so well that I recorded it.
But there was definitely a memory hole in it when I did due to ever increasing text objects. Since then I've found a method for clearing that over and over, not the best method I'm sure. But I also suspect my initial implementation isn't the most optimal either.
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
Oh I'm testing my own abilities and learning PIXI along the way. MV is definitely heavy on the RAM usage for what it does. I push a lot of stuff to my own plugins for that very reason, but it wasn't at fault here. I was just excited that my plugin was working so well that I recorded it.
But there was definitely a memory hole in it when I did due to ever increasing text objects. Since then I've found a method for clearing that over and over, not the best method I'm sure. But I also suspect my initial implementation isn't the most optimal either.
Well it looks it manages RAM quite well for how heavy it is. I mostly avoid great visuals for that reason, and focus mostly on game mechanics, story, decisions etc... Then again, my JS skills are at a starting level. I'm at that point now that i can understand other people's code xD but still it's a bit hard to follow the code of the actual engine.
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
Not the worst place to be, I'm honestly not that knowledgeable about the actual engine. But I really like to break stuff and then try and fix it. So I've been learning a lot between that and solving problems on here. As for great visuals, I wouldn't completely avoid those. If you don't at least have a unique style, people tend to overlook your game.
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
48
Reaction score
21
First Language
Greek
Primarily Uses
RMMV
Not the worst place to be, I'm honestly not that knowledgeable about the actual engine. But I really like to break stuff and then try and fix it. So I've been learning a lot between that and solving problems on here. As for great visuals, I wouldn't completely avoid those. If you don't at least have a unique style, people tend to overlook your game.
I'm mostly making my game to learn javascript, as side-practice. I also like the process, so it doesn't really matter if people will like it or if it sells or anything.
 

ImaginaryVillain

"Hero" of Light, now with cool hat!
Veteran
Joined
Jun 22, 2019
Messages
310
Reaction score
952
First Language
Absurdism
Primarily Uses
RMMV
That's really a better place to be in my mind. If at the end of the day you end up with a useful skill that you had fun learning, it was well worth the time. It's just a nice bonus if you have a "shiny bauble" to show people afterwards. :LZSwink:
 
  • Like
Reactions: MiD

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
118
Reaction score
7
First Language
Australian
Primarily Uses
RMMV
Nevermind. It works.
 
Last edited:

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
118
Reaction score
7
First Language
Australian
Primarily Uses
RMMV
Would you like to share what went wrong? Maybe i could make my explanation clearer inside the help section.
Forgot to create an object before the IF condition, so condition failed every time.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

It's weird I actually have MORE work to do when stuck at home than before.
The No Travel Game Jam is here! Jump in to make a game in the month of April that takes place all in one town!


Decided to take a stab at video editing.... Even made a clickbait screen. I'm so proud of my sellout ways. :LZSexcite:

Forum statistics

Threads
95,470
Messages
929,385
Members
125,710
Latest member
SamAmimundo
Top