A number of scripts are designed to be persistent, and it is frequently useful to be able to pass commands to an already-running script.
Currently, the only good option to do so involves an UpstreamHook that does the equivalent of capturing /^(?:<c>)?\s*#{Regexp.escape("#{$lich_char}#{script.name}")}(\s+.*)?$/ and parsing commands in such a hook.
This has a number of problems, notably:
- Each script that does it requires an UpstreamHook, which adds a (tiny) amount of input lag to the game
- Commands captured in this way either need to have the full name of the script (rather than a shortened form) or risk false positives. (Should
;tri be interpreted as a command to ;triage or a request to invoke ;trigger?)
My proposed solution would be to add, as an API, something like this:
on_reinvoke {|args|
# args would be the equivalent of `script_args` as it exists in @@elevated_script_start
}
# Non-forced invocations of this script instead call this block, akin to before_dying
on_reinvoke(nil)
# Revert to default (old) behavior
A number of scripts are designed to be persistent, and it is frequently useful to be able to pass commands to an already-running script.
Currently, the only good option to do so involves an UpstreamHook that does the equivalent of capturing
/^(?:<c>)?\s*#{Regexp.escape("#{$lich_char}#{script.name}")}(\s+.*)?$/and parsing commands in such a hook.This has a number of problems, notably:
;tribe interpreted as a command to;triageor a request to invoke;trigger?)My proposed solution would be to add, as an API, something like this: