Community Core Script

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
I just have no words...

I mean, the insane notetag reading methods in yanflys core script is reason enough to NOT use those scripts (imo, and assuming you can write your own).
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
I just have no words...

I mean, the insane notetag reading methods in yanflys core script is reason enough to NOT use those scripts (imo, and assuming you can write your own).
that was a rather rude response. My configuration options will be Javascript objects most notably json. I don't like note tags as options for scripts.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,041
Reaction score
13,675
First Language
English
Primarily Uses
RMMV
I just have no words...


I mean, the insane notetag reading methods in yanflys core script is reason enough to NOT use those scripts (imo, and assuming you can write your own).
If that isn't a case of the pot calling the kettle black ;) Your own scripts can be pretty complicated to wade through too. For a user, the method of reading note tags should be irrelevant. For a scripter, it should not interfere with your own methods for reading note tags, and is not a reason to avoid them - unless you are actually looking at modifying them yourself.

that was a rather rude response. My configuration options will be Javascript objects most notably json. I don't like note tags as options for scripts.
Pot ... kettle ...


Can you give some examples of your planned configuration options as JS objects? How would it look from the point of view of someone wanting to use your scripts in their game? Are you saying you're going to require users to actually edit the json files themselves to change configuration? That would be a step backwards imo, as MV has removed much of the error-factor that comes with non-scripters modifying scripts in order to customize them, and you would be reintroducing it.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
@Shaz - ok, that seems fair.. My own scripts can  be pretty complex to go through, no denying that. But complexity was not what I was highlighting, and I am certainly not trying to belittle yanflys work or anything of that nature..

My main point, was that - after seeing Yanflys Core script (Mv Core) - the methods for reading notetags are EXTREMELY poorly written. (like, there is 4 insanely long methods - basically a js iteration of how he read notetags in ace - never mind the fact all notetags are already loaded at runtime via extractMetaData, and thus, rendered all 4 methods almost pointless...) And if something so simple as reading notetags is inefficient, I dread to think about the harder, more complicated  stuff and how many lines that would take...

To me, when something as simple as reading the notetags from a database object cannot be done within a few lines, that raises the question of WHY. Why was that scripter not able to do that - was it cause they are too used to older methods (ie - hanging onto ace like coding styles), or was it the more worrying lack of knowledge of the new systems...

I mean, yes, Yanfly has been writing code longer than I (both in general, and for mv), and thus, should* be more experienced / better than I. But length !== skill. And in this case (reading notetags) My way is much much more efficient. (at least imo.. I am sure there is others who would have issue with the way I do it, and that would make them avoid my work :D )

Anyway, \rantover. ^_^
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Personally I don't use MV's default notetag matching because I don't see the point in the bracket structure, and it's not really a good match for what I like to do. Here's how I match the notetag "icon_offset 8 12;" anywhere in the notetag box only once, case insensitive:

TDDP_SuperSecretPlugin._findInEventNotetags(this, /icon_offset\s(.*?)\s(.*?);/i, function(result) { // Do things with the params if match is found, otherwise this isn't called this.SecretObj.customOffsetX = Number(result[1]); this.SecretObj.customOffsetY = Number(result[2]);});The _findInEventNotetags function prioritizes finding a match in an event's active page first before it looks in the Note box; my plugins generally view the Note box as "global" for said event, while notetags in comments as "local" to said page. The latter will override the former.
 
Using the _findInEventNotetags function means that I cut down on "boilerplate" code later on when I check for lots of different notetags. No if/else chains or long case blocks while parsing the notetags whatsoever. The above code runs when an event changes its page, then stores the result in an object so as to not repeatedly call regexp functions (costly if it were to be done 60 times per frame).
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
I opted for a similar, yet somewhat different approach - using the default meta..

Within my core plugin, I have this:

(function($){  $.extractMetaData = function(object, metaid){    var meta = object.meta[metaid];    return meta !== undefined ? meta : null  };})(DMV);And then lets say I want to add a notetag into my custom script like this:

<notetag: value>I can do so by aliasing the extractDataMethod to check my notetag when its checking everything else..

(function(dm){ var extractMetadata = dm.extractMetadata; dm.extractMetadata = function(data) { extractMetadata.apply(this, arguments); data.myCustomNotetagValue = DMV.extractMetaData(data, 'notetag') };})(DataManager);which then stores the 'value' portion of the notetag into every single database item. Then, from an item - lets say an actor - I can easily check for the value of that notetag..

this.actor().myCustomNotetagValue Annddd... Job done. :D

By using this technique, I am able to store the data into my database objects like you, and also am not causing much harm to the system - cause all my logic is performed within loops that already occur, rather than creating my own and iterating over every line of a notetag all over again...

I also have an extraction method for when notetags are expected to be split with some delimiter such as the ',' character.

For my uses, there is not much need for anything else. :D

Again, there is probably a better way to do it still, but this for me works perfectly, and doesnt require 4 methods just to read the note...
 
Last edited by a moderator:

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
That looks very sensible to me and I don't think you could optimize it further, really. I'd opt for the same approach when using database notetags. In my case I need to refresh notetags when an event changes its page, so I had to add some new functionality regardless :)
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
Yea, event pages are about the only thing that would require notes to be reread for each page, but even then, its not overly hard to refresh things when a page changes, so I dont think that would cause too heavy an impact on anything :D

I cant wait till Mv is released and I can finally see what all you NDA'd people have been working on ^_^
 

Yanfly

Veteran
Joined
Mar 15, 2012
Messages
1,739
Reaction score
2,626
@Shaz - ok, that seems fair.. My own scripts can  be pretty complex to go through, no denying that. But complexity was not what I was highlighting, and I am certainly not trying to belittle yanflys work or anything of that nature..

My main point, was that - after seeing Yanflys Core script (Mv Core) - the methods for reading notetags are EXTREMELY poorly written. (like, there is 4 insanely long methods - basically a js iteration of how he read notetags in ace - never mind the fact all notetags are already loaded at runtime via extractMetaData, and thus, rendered all 4 methods almost pointless...) And if something so simple as reading notetags is inefficient, I dread to think about the harder, more complicated  stuff and how many lines that would take...

To me, when something as simple as reading the notetags from a database object cannot be done within a few lines, that raises the question of WHY. Why was that scripter not able to do that - was it cause they are too used to older methods (ie - hanging onto ace like coding styles), or was it the more worrying lack of knowledge of the new systems...

I mean, yes, Yanfly has been writing code longer than I (both in general, and for mv), and thus, should* be more experienced / better than I. But length !== skill. And in this case (reading notetags) My way is much much more efficient. (at least imo.. I am sure there is others who would have issue with the way I do it, and that would make them avoid my work :D )

Anyway, \rantover. ^_^
I'll go ahead and shed some insight on why I choose to use my "poorly" written methods for notetagging over the inherent extractMetaData function.

Frankly speaking, the extractMetaData function, while useful for the inexperienced scripter, is extremely un-userfriendly for the RPG Maker user (not the scripter). The meta data function requires the notetag to be case sensitive and the data stored later will also need to be extracted later. That's why using the method I use, I personally don't have to deal with that, plus I can give users the flexibility they need with non-case sensitive notetags. The work I've done for the notetags may look messy, but the extra work I put it is all for userfriendliness.

As for this:

(function(dm){var extractMetadata = dm.extractMetadata;dm.extractMetadata = function(data) {extractMetadata.apply(this, arguments);data.myCustomNotetagValue = DMV.extractMetaData(data, 'notetag')};})(DataManager);I've attempted to do that already. However, I've stumbled upon a couple problems:

  1. It's just raw data. It doesn't detect if it's from $dataItems, $dataWeapons, etc.
  2. It's doing it as it loads, which means, if I were to make a notetag that would copy or reference the properties of another object that would be loaded later, it wouldn't be able to do so.
A brief history of my plugin creation process: I originally went with the extractMetaData function. However, because it wasn't doing what I wanted it to, I switched over to Scene_Boot, and realized that wasn't too effective a few weeks down the line. I eventually came to the conclusion that the best time to load and extract all the notetag data is during the time the entirity of the game's database is finished loading, which is where I got to for my plugin library today. Overall, I've made two major switches for the entirity of my notetags.

That said, I'm open to criticism. There comes a problem in when doing something for a long time, programming styles can become stiff and uninnovative. That's why if you are to shed some light on where you can see my plugins can make an improvement, do share. Making a third switch for notetags isn't something I'm unwilling to do if I feel it's more beneficial.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
I like to see people using the note box field for things like you know 

<increaseStatX: 10%>, but I also like to see something like: 

{increaseStatex: 10% } which is easier to parse and doesn't require regex. Now I don't have MV like Yanfly does so I don't know if that would be entirely possible.

Now I like working with objects and json elements in javascript over strings and regex, so thats mostly how my scripts will be configured. For example:

{  increaseStatx: 10%,  increaseStatY: {      whenHPIs: 5,      orWhenMPIs: 10,     by: 20%  }}This way you understand that we increase stat 10% and then we increase stat y by 20% when HP is 5 or when MP is 10. Its easy to read and you understand the logic of whats happening.

Its also easy to parse. (The above would not be in a note tag. for note tags I would do: {enemyLevel: 5, seeConfig: "enemyName"} which would then know how to parse the core JSON config object looking for an enemy name with additional configuration options.)
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
@Yanfly - Yes, of course the points you raise are fully valid. And I can understand why you have done things the way you have.. While I was looking over your functions I realized the flaws that lay within the default extract meta functionality - such as being case sensitive.

One of my main 'concerns' would be that its not only your core doing that, its going to be every plugin that you write that uses notetags.  So with that in mind, would it not be more friendly - for you, and other people who stumble onto your code - to have I dunno, maybe one method to read any kind of notetag.. Then, just call that method a number of times to store the desired notetag values onto some variable?

I dunno, just a thought... Ramiro came up with a VERY nice function to parse a string of text for some <tag> (case insensitive).. I shall message you about it. :)
 

Yanfly

Veteran
Joined
Mar 15, 2012
Messages
1,739
Reaction score
2,626
@Yanfly - Yes, of course the points you raise are fully valid. And I can understand why you have done things the way you have.. While I was looking over your functions I realized the flaws that lay within the default extract meta functionality - such as being case sensitive.

One of my main 'concerns' would be that its not only your core doing that, its going to be every plugin that you write that uses notetags.  So with that in mind, would it not be more friendly - for you, and other people who stumble onto your code - to have I dunno, maybe one method to read any kind of notetag.. Then, just call that method a number of times to store the desired notetag values onto some variable?

I dunno, just a thought... Ramiro came up with a VERY nice function to parse a string of text for some <tag> (case insensitive).. I shall message you about it. :)
In the case where there's one way to read notetags across all my plugins, it'd have to come out with a goto function that would decipher the data and then parse it.

However, the notetags I use are structed based on userfriendliness and flexibility, something in which having a goto function would cause to be more difficult and tedious to proceed with. That said, should I even come up with the goto function, it'd be either included in a core script which everybody would need to download in order to use my plugins or included in all my plugins if I were to keep them separately and usable without the need of other plugins.

I typically prefer stand-alone plugins so the first option is out of question, but if I proceed with the second option, it'd be easier to just extract the data straight from the notetags themselves. Also, I cannot speak for others, but I have a faster time reading RegExp in its raw form than if I had to read through various functions to determine what the notetag is supposed to be.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
One of my main 'concerns' would be that its not only your core doing that, its going to be every plugin that you write that uses notetags.  So with that in mind, would it not be more friendly - for you, and other people who stumble onto your code - to have I dunno, maybe one method to read any kind of notetag.. Then, just call that method a number of times to store the desired notetag values onto some variable?
What happens if the chosen standard is unsuitable for certain cases? You'd have to live with it, or risk being alienated by the community because your note-tag does not conform to the rest of the project.


I would rather scripters not assume anything about how the note-box is going to look and properly search for their own notes.
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,544
Reaction score
3,714
First Language
Java's Crypt
Primarily Uses
RMMZ
Well, I will only use the default format, but in a case insensitive way.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,502
Reaction score
3,185
First Language
Binary
Primarily Uses
RMMZ
... should I even come up with the goto function, it'd be either included in a core script which everybody would need to download in order to use my plugins or included in all my plugins if I were to keep them separately and usable without the need of other plugins...
You could always make your scripts work, but dont read the notetags unless the YEP_NoteCore.js (or whatever) is loaded - then, if available, you allow the script to alter various settings as per the notetags that have been set.   I mean, many systems can function perfectly without the use of notetags. :)

And I dont think many people would mind adding a small note reading plugin to allow the notes from your systems to be read... Hell, in the past, most projects I have seen have at least 10+ of your scripts anyway :D

What happens if the chosen standard is unsuitable for certain cases? You'd have to live with it, or risk being alienated by the community because your note-tag does not conform to the rest of the project.

I would rather scripters not assume anything about how the note-box is going to look and properly search for their own notes.
I wasnt suggesting all script writers conform to using a single note loading function - although that would be ideal if the note parser can truly work with any kind of notetag - I was suggesting that for yanfly, he could include a note reading function that is used solely within his own plugins.

Of course if someone requires notes to be read differently, it should be encouraged that they implement that to their hearts desire is fulfilled. But I also think that if someones code was not efficient in some way, it is all programmers duty to offer personal opinions and suggest improvements.

Again, its also completely optional weather those suggestions are implemented, or even taken into consideration. :D
 
Last edited by a moderator:

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
One of the things I find scriptors don't do is document there functions let alone document why they decided to alias something. I am glad that by documenting now you get to do a lot more in editor like setting values and what not.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
{  increaseStatx: 10%,  increaseStatY: {      whenHPIs: 5,      orWhenMPIs: 10,     by: 20%  }}
The problem is that the notetag box is not very big, so it won't take long for a JSON formatted string to go out of the bounds of the box, requiring scrollbars. Additionally, this wouldn't work very well if other notes are in the notebox, because JSON.parse would encount an error with the other notetags, because they're not JSON, so finding your note specifically would be difficult/annoying to do. It would really be best to stick with the normal notetag format.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
The problem is that the notetag box is not very big, so it won't take long for a JSON formatted string to go out of the bounds of the box, requiring scrollbars. Additionally, this wouldn't work very well if other notes are in the notebox, because JSON.parse would encount an error with the other notetags, because they're not JSON, so finding your note specifically would be difficult/annoying to do. It would really be best to stick with the normal notetag format.
it wouldn't go in the note box. :p Also no one said It was valid JSON, Welcome to javascript objects :D
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
How would you read javascript objects if they were stored in a text file or streamed from somewhere?
Unfortunately for this you would have to go back to the old way of configuring scripts :( especially if you wanted the level of customization i want to offer, youd do it at the top of the script 

var something = {   key: value}something.keyI realize we get to use comments and add customizability and then theres not tags for things like <bla: +10 > But the types of customizability wont work in those particular cases :(
 

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

Latest Threads

Latest Profile Posts

um... why didn't anyone tell how easy it is to add motions to Sideview battlers? I literally copied the last one, changed the name and index, said where it should play, and boom... I've got intro motions.
Lately when I listen to 1970s songs, I always think that the "real world" is still at mid 70s. What we experience now is a futuristic dream. With this point of view, even 80s and 90s looks super futuristic. :D

The GIF of this seemed too cool to bury in replies. :LZSwink:
You may have slept with my aunt... but, given the circumstances, cheers.

- Professor Ian Duncan, 2013

Forum statistics

Threads
105,528
Messages
1,014,428
Members
137,213
Latest member
kuraudo123
Top