MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
85
Reaction score
32
First Language
Greek
Primarily Uses
RMMV
Latest Version: v1.3

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. 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 Name holding variable set to a valid id.

2. Name holding variable:

Default is 0, which means it's turned off. You can set it to a variable which you will no longer use, and it will store the names of the variables to which you have added properties. Provided these names are unique, you can then call them by name in text, instead of using their ids.

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 name holding variable set to a variable id.

New in v1.2
Array handling - check the help file, array explanations are towards the bottom of the file.

New in v1.3

maka.objVar.changeProp(operation, value, id, name);

operation = the operation you want performed in quotes
Operations supported:
'add' = addition
'sub' = subtraction
'mul' = multiplication
'div' = division (result is rounded)
'mod' = modulo

value = the value you want added or subtracted, etc.

id = the id of the variable whose property you want to change.
name = the name of the property whose value you want to change.

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
I'm learning all this stuff myself as i go.

->ADDED: Operations. It was understandably confusing to use getProp each time you simply wanted to add to a property, so i made a function specifically for that. You can now use add, subtract, divide, multiply and modulo.

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

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.3 it's the new one. This one has some bugfixes, arrays (since v1.2) and removed an unnecessary parameter. It also provides the ability to change a property via a single scriptcall.

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
3,605
Reaction score
1,356
First Language
Dutch
Primarily Uses
RMMV
it sounds so complicated. I wonder where it is usefull for!
 

ImaginaryVillain

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
177
Reaction score
20
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
3,605
Reaction score
1,356
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
85
Reaction score
32
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

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,246
First Language
Absurdism
Primarily Uses
RMMZ
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
177
Reaction score
20
First Language
Australian
Primarily Uses
RMMV
Nevermind. It works.
 
Last edited:

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
85
Reaction score
32
First Language
Greek
Primarily Uses
RMMV
Nevermind. It works.

Would you like to share what went wrong? Maybe i could make my explanation clearer inside the help section.
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
177
Reaction score
20
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

Made the "My Beating Mystery" board today:
3ENFLSC.png

in Grim Trigger episodes 3 & 4, the main characters play a Clue rip-off board game called "My Beating Mystery" (haha), so of course I had to draw the board for it. Can't decide if I wanna add blood or not
Jeez...
I finally decide, after several ppl asking me to, to create a gamethread about project M... And my internet craps out on me halfway through the process :(
making my first game is like trying to stuff all my experience with old games into one
so its slow and painful when i dont get it right... i bet the next game is gonna be finished earlier!
When you don't find any time to work... :kaocry:
First Ten Minutes of my Caretaker inspired game

Forum statistics

Threads
110,401
Messages
1,053,010
Members
143,460
Latest member
Totaldramawwe
Top