Makai Object Variables

MiD

Villager
Member
Joined
Oct 22, 2018
Messages
22
Reaction score
13
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: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.

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:

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

Latest Threads

Latest Posts

Latest Profile Posts

i watched the sonic movie it was pretty good i hope they make a sequel
tomorrow I'ma go on a cruise for the first time ever... lets hope I'll survive the experience!
Omg! 8 years in this forum :o
Ksi
Streaming the last of the RMN Valentiny event games so feel free to drop on by and watch me cry (whether that's from laughter, rage or sheer pain, who knows?)
Today I went to sleep without setting an alarm, so I could sleep more than 2 hours. I woke up after 2 hours.

Forum statistics

Threads
94,312
Messages
919,837
Members
124,063
Latest member
pluscho
Top