• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Sign in to follow this  
Followers 0
estriole

EST - SIMPLE NOTETAGS GRABBER

7 posts in this topic

EST - SIMPLE NOTETAGS GRABBER

 

Author : Estriole

Also Credit : Xethas for giving me the inspiration to make this :D

 

Version History
v. 1.0 - 2013-01-07 - finish the script

v. 1.1 - 2013-01-08 - fix the regexp to recognize text without ""
                               - add long_note_args method.
v. 1.2 - 2013-01-08 - improve the regex so now can grab any notetags format now can grab most yanfly notetags format,

                                 mr buble format, victor, tsukihime, etc (i hope so). rewrite the introduction and how to use to simplify

                                 things.
v. 1.3 - 2013-01-09 - change the method to module so we can include it in an class as long as it have @note. to add it just

                                 add in the class:
                    
                                 include ESTRIOLE::NOTETAGS_SYSTEM
                      
                                 i already include the module in these following class:
                                                 RPG::BaseItem
                                                    RPG::Map
                                                  RPG::Tileset
                                             RPG::Class::Learning
                                 since i think it's all the rpg class that have @note.
                                 also add method in game map to make it able to access the @map

v. 1.4 - 2013-02-04 - fix some regexp to recognize more than 1 strings in one notetags
v. 1.5 - 2013-05-26 - fix some regexp to recognize '-' example: -1321, -asdr, ase-3
                                 fix some regexp to recognize '.' example: 10.33, acd.331, 33.21a
                                 also compatibility update for dynamic note script(if any).
                                 also feature to grab event note (comment) (from victor code)
v. 1.6 - 2013-06-07 - fix regexp to use multi line mode.
                               - fix some regexp so can put array in note example: [1,2] it will saved as "1,2"
                               later you could do some eval to make it array again. ex:
                               note:
                               <test: [1,3],[11,9]>
                               then we grab it using note_args method
                               a = note_args("test")
                               now to transform all element in a to array. you could use collect.
                               a.collect!{|x| eval("[#{x}]")}
                               - fix some regexp so can put hash in note example: {1=>30,2=>2} it will saved as "1=>30,2=>2"
                               now to transform all element in a to hash the same method as array above just use different eval
                               a.collect!{|x| eval("{#{x}}")}

 

 

Introduction
this script basically works as notetags grabbers
Make your notetagging job for any database object easier (for scripter).
you can easily grab any notetags value using simple method. then use that
either in event script call / inside class

 

 

How to Use

Available also in script header

 

 

now we can easily grab the notetags from any RPG database object such as:
RPG::Actor, RPG::Enemy, RPG::Class,
RPG::Item, RPG::Weapon, RPG::Armor, RPG::Skill, RPG::State
RPG::Map, RPG::Tileset, RPG::Class:Learning

basically every child class of RPG::BaseItem

this script give you two type of notetags grabber.
================================================================================

1) rpg_instance_object.note_args("notetags name")
example:
  -> Actor
     $game_actors[id].actor.note_args("notetags name")
     $game_party.members[slot_id].actor.note_args("notetags name")
  -> Enemy
     $game_troops.members[slot_id].enemy.note_args("notetags name")
  -> Class
     $data_classes[id].note_args("notetags name")
  -> Item, Weapon, Armor, Skill, State
     $data_items[id].note_args("notetags name")
     $data_weapons[id].note_args("notetags name")
     $data_armors[id].note_args("notetags name")
     $data_skills[id].note_args("notetags name")
     $data_states[id].note_args("notetags name")
  -> Map
     $game_map.map.note_args("notetags name")
  -> Tileset
     i don't know how to access it yet. if anyone know pm me :D
  -> Class::Learning
     i don't know how to access it yet. if anyone know pm me :D
 
this will grab notetags of this type:
<name: a b c d e f g h i ...>
or
<name: a, b, c, d, e, f, g, h, i,...>
or
combination of both (have coma or only spaces)

... means you can have as many as you want

it then will return array
[a,b,c,d,e,f,g,h,i,...]

every array member is in STRING format. so if you want to use it as integer
you need to use .to_i after grabbing array[index]
for true and false. it also become text. so you need to change it to boolean
yourself.

and if you want to have block text in your notetags you could put it inside ""
example:
<testnote: "King Maker" 10 true 322>
return array ["King Maker","10","true","322"]

and if all of your note value is integer and you're too lazy to use .to_i
you could change .note_args to .note_args_all_int
it will convert all array member to integer. (use collect method)
================================================================================

2) rpg_instance_object.long_note_args("notetags name")
example: just see number 1) above and change the method to
.long_note_args("notetags name") instead.

this will grab notetags of this type:
<name>
key1: a b c d e f g h i ...
key2: a, b, c, d, e, f, g, h, i,...
key3: a b, c, d e f g h i ...
</name>

note: key3 is the combination with coma and just spaces.

it then will return 2 level array
[[key1,a,b,c,d,e,f,g,h,i,...],[key2,a,b,c,d,e,...],[key3,a,b,c,d,e,f,g,...]]

every level two array member is in STRING format.
so if you want to use it as integer you need to use .to_i after grabbing it
for true and false. it also become text. so you need to change it to boolean
yourself.

and if you want to have block text in your notetags you could put it inside ""
example:
<testnote>
can have spaces: "Dragon Slayer" "yes", true, 123
w: 10 13, 33
</testnote>

will return array
[["can have spaces","Dragon Slayer","yes","true","123"],["w","10","13","33"]]

================================================================================
 

 

 

 

 

Script

EST - SIMPLE NOTETAGS

 

EXAMPLE USAGE

SIMPLE ACTOR USAGE

SIMPLE WEAPON USAGE (REQUIRE ADD ON BELOW)

 

ADD ON

EST - DATA OBJECT SAVE  (save the modification done to all $data database object)

 

Screenshot

Not needed

 

Demo

Not needed

 

Licenses

Read my sig

 

Author Note

This script is the way i tested myself on how much i've grown in notetagging and
regex in this past 6 month. i would like to see my limit.
and also learn to code efficiently (making as few line as possible)

Next patch maybe adding long_note_args_eval method.
for grabbing something like victor enemy action condition / some yanfly notetags...
which use eval method.

i don't know but i think this script will more suited named EST - NOTETAGS GRABBER
LOL...

Edited by estriole

Share this post


Link to post
Share on other sites

Interesting concept, though, as a scripter it doesn't seem that much different from writing my own method for scanning a note tag. Except I don't have to learn regex to get the job done, which definitely makes it easier for some devs.

 

Some objects like RPG::Tileset do not inherit from RPG::BaseItem, but that is a minor issue.

Share this post


Link to post
Share on other sites

@tsukihime: yes i agree... it's not hard to write method to scanning notetags. but regexp is hard for newbie (from my personal experiences) :D.

that's why i made this to make things simpler for newbie scripter. this also kinda like a test for myself to see how much i've grown in regexp and notetagging in the past 6 months i started coding.

 

and since this is only embed in RPG::BaseItem i guess RPG::Tileset didn't work (maybe we could add the code inside RPG::Tileset but how to access instance of the RPG::Tileset? know anything about that? :D).

not to mention RPG::Map(i think this is important :D) and RPG::Events(planning on comment scan maybe but depends on how hard it is)

 

I update the script to v 1.2

 

I change the regex for more flexible notetags format. and make it able to read common notetags format which used by yanfly, victor, mr bubble, etc. btw for your information... the first format is based on your effect series notetags Tsuki :D.

 

so now we can read other scripter notetags too thus make this script work as notetags grabber too.

 

supported format now:

<notetagsname: a b c d e>

or

<notetagsname: a, b, c, d, e>

or combination of with/ without spaces. (i tried grabbing notetags from yanfly party class script and it work)

 

i also add new method:

.long_note_args("string")

 

this used for notetags with this format:

<notetagsname>

w: 1 3 4 5

a: 1,3,5 ,22

armor upgrade: 10 "Super Strong" true yes

</notetagsname>

for more information see the How To Use section (in spoiler tag or inside script header)

 

any suggestion on what kind of notetags format to cover? (i have some i think of)

Share this post


Link to post
Share on other sites

update the script to v. 1.3

 

i extend the script to RPG::Map, RPG::Tileset, RPG::Class::Learning

since it's the only RPG that have @note.

 

i also put the method in module. so whenever you want to add it to a class just use

include ESTRIOLE::NOTETAGS_SYSTEM

but i don't see the point of using that other than database RPG class :D.

Edited by estriole

Share this post


Link to post
Share on other sites

updated the script to v1.4

regexp fix so we can use more than one "your tag here can contain spaces as long inside quotes" in notetags

before if we have "heads","eyes"

it will return [heads","eyes]

now will return [heads, eyes]

Edited by estriole

Share this post


Link to post
Share on other sites

updated script to v1.5

update content:

 

 

v. 1.5 - 2013-05-26 - fix some regexp to recognize '-' example: -1321, -asdr, ase-3
                      fix some regexp to recognize '.' example: 10.33, acd.331, 33.21a
                      also compatibility update for dynamic note script(if any).
                      also feature to grab event note (comment) (from victor code)

 

 

Share this post


Link to post
Share on other sites

updated the script to v.1.6

update content:

 

 

v. 1.6 - 2013-06-07 - fix regexp to use multi line mode.
                    - fix some regexp so can put array in note example: [1,2] it will saved as "1,2"
                      later you could do some eval to make it array again. ex:
                      note:
                      <test: [1,3],[11,9]>
                      then we grab it using note_args method
                      a = note_args("test")
                      now to transform all element in a to array. you could use collect.
                      a.collect!{|x| eval("[#{x}]")}
                    - fix some regexp so can put hash in note example: {1=>30,2=>2} it will saved as "1=>30,2=>2"
                      now to transform all element in a to hash the same method as array above just use different eval
                      a.collect!{|x| eval("{#{x}}")}
 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.