estriole 326 Posted January 7, 2013 (edited) EST - SIMPLE NOTETAGS GRABBER Author : Estriole Also Credit : Xethas for giving me the inspiration to make this Version Historyv. 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 notetagsv. 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}}")} Introductionthis script basically works as notetags grabbersMake your notetagging job for any database object easier (for scripter).you can easily grab any notetags value using simple method. then use thateither 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::StateRPG::Map, RPG::Tileset, RPG::Class:Learningbasically every child class of RPG::BaseItemthis 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 -> Class::Learning i don't know how to access it yet. if anyone know pm me 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,...>orcombination of both (have coma or only spaces)... means you can have as many as you wantit 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 integeryou need to use .to_i after grabbing array[index]for true and false. it also become text. so you need to change it to booleanyourself.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_iyou could change .note_args to .note_args_all_intit 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 itfor true and false. it also become text. so you need to change it to booleanyourself.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, 123w: 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 andregex 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 GRABBERLOL... Edited June 13, 2013 by estriole 2 Share this post Link to post Share on other sites
Tsukihime 1,489 Posted January 7, 2013 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
estriole 326 Posted January 8, 2013 @tsukihime: yes i agree... it's not hard to write method to scanning notetags. but regexp is hard for newbie (from my personal experiences) . 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? ). not to mention RPG::Map(i think this is important ) 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 . 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
estriole 326 Posted January 9, 2013 (edited) 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 . Edited January 9, 2013 by estriole Share this post Link to post Share on other sites
estriole 326 Posted February 6, 2013 (edited) 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 February 6, 2013 by estriole Share this post Link to post Share on other sites
estriole 326 Posted May 30, 2013 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
estriole 326 Posted June 13, 2013 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