Description
Offers a generic hook for other scripts to read notetags from the current page of events.
Prerequisites
None
How to use
In your own scripts, register your regex by calling the following method:
IAVRA::EVENT_TAGS.register

key, /regex/, :int, :int)This will attempt to capture the first 2 groups from your regex and convert them to integers. Everything less than 2 will be set to nil in the result, while everything more than 2 will be discarded.Get the matches for that regex during runtime like this:
IAVRA::EVENT_TAGS.get_all(1, :key)IAVRA::EVENT_TAGS.get(1, :key)IAVRA::EVENT_TAGS.get(1, :key, 0)"get_all" returns an array containing all matches for the regex registered under :symbol."get" returns one of those matches and default to the first (0-indexed).
Each match is an array containing your captured groups.
Configuration
You can register your own capture categories by extending the CAPTURES variable.
CAPTURES = { :string => lambda {|value| value}, :symbol => lambda {|value| value.to_sym}, :int => lambda {|value| value.to_i}, :float => lambda {|value| value.to_f}}
Terms of UseFree to use for both commercial and non-commercial games. Please give credit.
Credits
Iavra
FAQ
None so far
Changelog
- 1.01: Added support for named capture groups.
- 1.02: Renamed get to get_all and added a new get method for direct access.
- 1.03: Added an $imported entry for the script.
- 1.04: Shortened the hash building.
- 1.05: Rebuilt the script. Support for named groups was discarded, since i figured those don't get used much, anyway.
- 1.06: Reduced the number of iterations to improve performance.
Script
http://pastebin.com/UVw3ULHB
本贴来自国际rpgmaker官方论坛作者:Iavra处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/iavra-event-tag-reader.40626/