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