Help - Search - Members - Calendar
Full Version: Chat Redirector
Achaea's Forums > Off-Topic > Tech Support > Client Help
Jarrin
Hello everyone,

The chat redirector that I am currently using works for the most part, it just will not redirect any names with prefixes when someone says anything. The other chat channels all work since they strip out prefixes and just use the name. This is the same chat redirector that was created by Nick Gammon on the MUSH forums.

How can I modify this so that it will capture chat that begins with prefixes? I tried what I thought would work adding a wildcard (.*?) before the name wildcard, but I failed so I removed that trigger.

CODE
<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="^(\(.+\): )?[A-Za-z]+ (says|say|asks|yells|tells you), &quot;.+"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^You (tell (.*?)|whisper|say|whisper|whine|sing), &quot;.+"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
  enabled="y"
  match="^(.*?) (says to|whispers|whines|asks|says) (.*?)\, &quot;.+"
  regexp="y"
  script="redirect"
  sequence="100"
  >
  </trigger>

  <trigger
   enabled="n"
   match="*"
   script="redirect"
   name="multi_line_chat"
   sequence="10"
  >
  </trigger>


</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "Chats"
local first_time = true

function redirect (name, line, wildcards, styles)

  -- try to find "chat" world
  local w = GetWorld (chat_world)  -- get "chat" world

  -- if not found, try to open it
  if first_time and not w then
    local filename = GetInfo (67) .. chat_world .. ".mcl"
    Open (filename)
    w = GetWorld (chat_world)  -- try again
    if not w then
      ColourNote ("white", "red", "Can't open chat world file: " .. filename)
      first_time = false  -- don't repeatedly show failure message
    end -- can't find world
  end -- can't find world first time around

  if w then  -- if present
    for _, v in ipairs (styles) do
      w:ColourTell (RGBColourToName (v.textcolour),
                    RGBColourToName (v.backcolour),
                    v.text)  
    end -- for each style run
    w:Note ("")  -- wrap up line

  end -- world found

  -- if ends with quote, end of multi-line chat
  if line:sub (-1) == '"' then
    EnableTrigger ("multi_line_chat", false)  -- no more lines to go
  else
    EnableTrigger ("multi_line_chat", true)  -- capture subsequent lines
  end -- if

end -- function redirect

]]>
</script>
</muclient>
Silas
what? chat with prefixes? what?
Trevize
^(.+?) (says to|whispers|whines|asks|says)(?: (.+?))?\, \".+

Seems to work for says, as far as I can tell.
Jarrin
QUOTE (Trevize @ May 24 2009, 09:40 PM) *
^(.+?) (says to|whispers|whines|asks|says)(?: (.+?))?\, \".+

Seems to work for says, as far as I can tell.



I'm getting the following error when I attempt to load the plugin after creating the trigger

Line 60: Attribute name must start with letter or underscore, but starts with "." (problem in this file)
Trevize
QUOTE (Jarrin @ May 25 2009, 12:20 PM) *
QUOTE (Trevize @ May 24 2009, 09:40 PM) *
^(.+?) (says to|whispers|whines|asks|says)(?: (.+?))?\, \".+

Seems to work for says, as far as I can tell.



I'm getting the following error when I attempt to load the plugin after creating the trigger

Line 60: Attribute name must start with letter or underscore, but starts with "." (problem in this file)

Well, to put it in the plugin " has to be &quot;
Adalie
QUOTE (Silas @ May 24 2009, 08:36 PM) *
what? chat with prefixes? what?

Trevize
Titles.
Jarrin
Thanks Trevize it works great now!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.