Transform Input With a Hook

From Gwen Morse's Wiki
Jump to: navigation, search

At times you want to transform input to a MU** in ways that go beyond what or simple /def can do. For those you have to create a hook on SEND, and manipulate the text before sending it on to the MU**

An example - you want to transform :blah to emote blah so that you may use the syntax of a familiar MU** on a strange MU**.

/def -mregexp -h'SEND ^:(.+)$' emote_match = /send -w emote %{P1}

This breaks down as follows:

/def -mregexp

This starts the macro and tells it to use regex for processing the text

-h'SEND ^:(.+)$'

-h means it's a hook. SEND regex tells it to match and capture text being sent to the MU** The regex ^:(.+)$ matches a : at the start of the line, and captures all the text following

emote_match =

The name of the macro

/send -w emote %{P1}

/send -w sends text to the correct world. emote is the literal text we want to send, and ${P1} is the captured text from the regex