Pages: 1

2012 by EN.I

Iorana everyone... (sorry for my bad english)

I want to show you a DynRPG Plugin who i've created. His name is DynVarStorage.

And ... what is DynVarStorage?

Basically, DynVarStorage is an external by-name variable manager plugin for DynRPG - RPG Maker 2003. You will obtain a secondary variable storage (apart from default RPG Maker variables and switches), referenced by name (and not by number as RPG Maker does), and with dynamical management (you can create and delete variables anytime), like most programming languages. Also it will support Array and Matrix data types’ management, giving more flexibility in game making. This will make making engines a lot more easily, as well, gives more power to create new experiments and prototypes.

-Secondary variable stock, independent from RPG Maker ones.
-By-Name Variable management. (You can get a variable "Hello" instead \v(0003) : Hello)
-Manage variables dynamically (Create-delete variables on the go, as you need it).
-Support for one and two-dimensional arrays (Put many variables into one, like programming languages, like "Hello").
-Saves/loads variables automatically when you load/save a game.

DynVarStorage was a plugin for DynRPG patch, from Cherry; this patch allows you to create plugins for RPG Maker 2003 and manipulate many features of a game. You can obtain more info in the main thead here: http://rpgmaker.net/forums/topics/10254/.

How it works
DynVarStorage works apart from RPG Maker variables, so, you will need to “communicate” the plugin and RPG Maker itself. How? Setting and getting variables (like a database). This can be done with “Insert Comment” RPG Maker Event Command. By this way, you can give orders to DynVarStorage, like creating variables; get actual values and setting new ones, for example. A typically command of DynVarStorage looks like this:

<>Note: @DVS_GET_FROM_ARRAY “hero_hp”, 3, 1

@DVS_GET_FROM_ARRAY will be the command, who will get a value from a array variable (“hero_hp”) in a given index (3), and it stores its value in RPG Maker variable . (1).

By this way, you can communicate, set and get values from and to DynVarStorage variable set, using only a few RPG Maker variables “like a variable buffer”, ready to use. With DynVarStorage and RPG Maker you can do many things that do programmers to do things (for example sort and search algorithms implementations, graphs and tree’s emulation, and much more), with RPG Maker conditional and Cycles.

For example if you want to set ascendant values 1~10 to a 3x3 matrix, you can do this event script:

You can download DynVarStorage from the links below. It comes with the plugin, the documentation, an small demo game and the source code, if you want to peek how it works.


Direct Link: http://elsemieni.net/eni_stuff/DynVarStorage_v1.0.zip
Mirror (CherryShare): http://share.cherrytree.at/showfile-6794/dynvarstorage_v10.zip

(Don't forget to download DynRPG before applying it to your project)!

Note: I don't know much C and C++ programming, so I know my code maybe it's not 100% efficient, and maybe somewhere in the source there will be silly lines. Anyways, any commentary o suggestions are welcome.

Hope you like it. Any comments will be welcome.
Maururu... bye.

looks great. I just wanted to tell you that the forum swallows any square brackets, so you better replace them with curly brackets.

An idea: You could add a "Variable mapping" function. You could let the user map a RM variable to a Dyn variable, or even a RANGE of RM variables to a Dyn array.

When the user maps a variable (or a variable range), you would write the current value(s) of the Dyn variable(s) into the corresponding RM variable(s) and then you would add an onSetVariable handler which would automatically transfer all changes the user is making to from the RM variable(s) to the Dyn variable(s), as long as the variable mapping is enabled.
Iorana Cherry.

Yes, variable mapping sounds good, but first i need to code something inside, because i need to store extra-data for each dyn-variable ( well, the dyn variables already have a flag attribute, but it's only a short int... i will need to expand that).

Also, changing topic, there's a strange bug in DynRPG I've discovered yesterday midnight: If I excecute this onComment callback...

@DVS_DELETE "test_variable"

... The parameter 0 will read : "test_variable" ( it cames already with that garbage char from parsedData->parameters.text ). It occurs especially after I call this onComment callback:

@DVS_CREATE "test_variable", V11

Will excecutes it without a problem. Also, i have to say if you remove or add a character to the command, the bug fixes (Something string cache issue?). Well, i'm temporaly fixed this changin "test_variable" into "test_var".

I will start working on the mapping after the exams X_x.
Maururu... bye.
Yes, I know this bug although I hadn't time to fix it yet.

It can be resolved by adding some arbitrary parameter (e.g. a token "end") to the command, e.g. @DVS_DELETE "test_variable", END
just downloaded it - good work!

Question: How do you save the variables? Where/Wich file/format?

Because i had the (crazy) idea a while ago to provide a plugin that allows to communicate with a remote server and a SQL database. your variable management would be the first step for something like this.

Thanks! ... I save it in a very simple way: I take the variable data, joining all of them in a string, i compress it with Zlib and i save it to a .dyn DynRPG savefile format. (Saving data is provided by DynRPG itself, for more info, take a look in DynRPG documentation, or take a look in the source), and I save another file (SaveXX.dds) wich contains the size in bytes of the variables for checksum operations. For loading them is just the inverse steps.

( Yes, maybe saving the data and the file size in 2 separately files may be inneficent, but i don't know yet how handle both data in a data block ( remember that's not a file stream, so i can't use things like fread or fwrite ):( )

Yes, also i have the same idea as yours ( but not remotely) with SQLite to store the variables. But the problem was handling a database in memory and not in a file, like most databases works, so I've decided to make my own variable management system.

If you can use a C/C++ library to handle SQL databases, you can perfectly make a plugin about that. DynRPG is very useful in this way, you can attach in your plugins any stuff you want.

Maururu... bye.

well, for saving both data streams, you would just save an int (binary) with the length of the first block, followed by the first block, followed by the length (binary) of the second block, followed by the second block.

This looks like a good plugin.
Pages: 1