silvestro673

Veteran
Veteran
Joined
Apr 6, 2014
Messages
53
Reaction score
3
First Language
english
Primarily Uses
Before someone thinks I'm wanting to simple display a variable in a text. Sorry to give you the wrong impression. I know to \V[x] to have a variable's value display in text.


What I'm looking at is in the notes of actors and the rest, the plugins are usually <whatever: x>, a regular expression. In this example if x were 1000. Then the "whatever" command sequence turns its target to value 1000. I want to know how to make either <whatever: variableID> or <whatever: \V[x]> work.


To my understanding, a reg expression searches strings for a specified match. So basically this <whatever: \V[x]> needs to have the \V[x] replaced with its value;   <whatever: 1000> all before the plugin is even read. Kinda reminds of the chicken or the egg story, which code line was read first?


~ my search for this answer's result mostly showed the \V[x] as the answer to a different problem. Hence, the opening comment. Ty for any answers.
 
Last edited by a moderator:

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
990
Reaction score
838
First Language
English
Primarily Uses
N/A
Could you clarify what you mean by "event plugin strings"? Do you mean the plugin command event function? That isn't regex (regular expressions), that reads what is typed in and checks to see if it exists as a function. That is, plugin writers can modify the plugin command method to accept a specific string to call a certain method. I won't go into specifics, but that's basically how it works.


<whatever: variableId> will not work without additional coding to add support for what you want in the specific plugin that uses that notetag. The reason for this is that notes are read as strings and are NOT evaluated, rather, a variable is created that is set equal to the string that follows-- that is, item.meta.whatever (that's what the notes are converted to) will be set to "1".
 

S_Rank_Crazy

Veteran
Veteran
Joined
Dec 30, 2015
Messages
78
Reaction score
48
First Language
English
Primarily Uses
RMMV
Expanding on what mjshi said: the Notes section in the Database is stored on the object as a property (item.note), this property is a (long) string. For example:


<whatever1: x>
<whatever2: y>


Is stored as:


"<whatever1: x>\r\n<whatever2: y>"


Plugin developers have to read that property and use regular expressions to retrieve the values of x and y for their plugin variables. I think the reason why we use that specific format is twofold:


1) It gives users a familiar way to set up variables across different plugins


2) When using regex, it helps to have a simple format to be able to extract the data you need


So by default there's no way to do what you need. These settings are usually stored inside a plugin's namespace in the code, so you may be able to retrieve the value using a script call (if you know exactly where that plugin is stored). Other than that I'm not sure what to suggest.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
858
First Language
English
Primarily Uses
RMMV
The core code of RPG Maker MV will convert any such note tags into meta properties automatically. Although plugin authors often process the raw tag data with regular expressions.

Code:
// Note Tag Field of Actor 4
<foo:bar>

// Note Tag Processed Meta Data
$dataActors[4].meta.foo // returns 'bar'

// Note Tag Raw Data
$dataActors[4].note     // returns '<foo:bar>'
 

S_Rank_Crazy

Veteran
Veteran
Joined
Dec 30, 2015
Messages
78
Reaction score
48
First Language
English
Primarily Uses
RMMV
The core code of RPG Maker MV will convert any such note tags into meta properties automatically. Although plugin authors often process the raw tag data with regular expressions.



You learn something new every day.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,489
Reaction score
8,136
First Language
German
Primarily Uses
RMMV
@silvestro673


an additional problem here is that the note itself has absolutely no function, it is the plugin that works through the data.


And different plugin writer handle that differently.


For example, some plugins process the notetag data on newgame and store it in their own datastructure, to never look at the notetags again. If that is not handled dynamically, nothing you do can change the values. So even if you manage to redirect the notetag to a variable (which is extremely difficult, see above), some plugins would still load the variable data from the game launch only (which will be zero in most cases) and never look again for any update inside that variable.
 

silvestro673

Veteran
Veteran
Joined
Apr 6, 2014
Messages
53
Reaction score
3
First Language
english
Primarily Uses
// Note Tag Field of Actor 4
<foo:bar>

// Note Tag Processed Meta Data
$dataActors
[4].meta.foo // returns 'bar'

// Note Tag Raw Data
$dataActors
[4].note // returns '<foo:bar>'

Exhydra. I basically have no skill in regular expression creating so far. I'm willing to learn it, just don't want to lose focus off game development for now. (albiet - go hand in hand). I'm making it for my little guy and we enjoy our creating time together but he's too young to sit through coding lessons.


Anyways, is there a way in common events > scripting to achieve this effect? the exact effect is only actor1 gets a bonus of jobpoints equal to the variable.


example, on event, variable = variable + 500


write to plugin text box (whatever the "gainJp actorId jp" name is),  "gainJp 1 " + "variable";


then execute the plugin with the new text input.


Whether the theory works or not, I'm hoping what i'm trying to do is not misunderstood.
 

silvestro673

Veteran
Veteran
Joined
Apr 6, 2014
Messages
53
Reaction score
3
First Language
english
Primarily Uses
after some fiddling about, i didn't get the direct way i was asking for. but using a loop, i was able to achieve a successful result. 


so i'm satisfied. this thread can be closed.
 

Latest Threads

Latest Posts

Latest Profile Posts

That moment when you try to figure out a color scheme for an alien ship so that it's something other than "Grey on Grey".
It's up for viewing! See what happened when EquestriAlert got tested in 1997... or was it a test? Did somepony hack the system? Or did somepony push the wrong switch? Even Adagio Dazzle (the owner of the channel) has no clue.

Can you put the pieces together? Don't worry, the game isn't over yet! There's more pieces to add on!
Why parodies are always underrated on your opinion?

Forum statistics

Threads
111,116
Messages
1,058,434
Members
144,335
Latest member
notreeee
Top