Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Chat Redirect

Chat Redirect

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Boen310   (17 posts)  Bio
Date Thu 19 Jul 2018 01:42 PM (UTC)

Amended on Sat 21 Jul 2018 02:17 AM (UTC) by Nick Gammon

Message
Tried using the Chat Plugin found to modify to how chat appears for mud I play.
Chats appear like -

You tell your racewar 'test'
Vof tells you in gnome '.'

Here is what I am using:



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the 
world you want chats to go to.
-->

<muclient>
<plugin
   name="Chat_Redirector"
   author="Nick Gammon"
   id="cb84a526b476f69f403517da"
   language="Lua"
   purpose="Redirects chat messages to another world"
   date_written="2007-06-30 10:45:35"
   requires="4.08"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ (says|chats|yells|You tell your racewar)\'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^You (say|chat|yell|You tell your racewar)\'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "Duris Chat"
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

end -- function redirect 

]]>
</script>


</muclient>
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 21 Jul 2018 02:17 AM (UTC)
Message
What's your question? Is it working? If not, what is happening?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Boen310   (17 posts)  Bio
Date Reply #2 on Sat 21 Jul 2018 06:24 PM (UTC)
Message
It is not working - The redirect is not happening to my open Duris Chat window.
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #3 on Sat 21 Jul 2018 10:51 PM (UTC)

Amended on Sat 21 Jul 2018 10:52 PM (UTC) by Fiendish

Message
Those triggers definitely won't work.

Try this instead:


<trigger
   enabled="y"
   match="^You tell your racewar '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells you in gnome '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>



For more than that, you'll need to give more examples of chat messages.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Boen310   (17 posts)  Bio
Date Reply #4 on Mon 23 Jul 2018 12:20 PM (UTC)

Amended on Tue 24 Jul 2018 04:37 AM (UTC) by Nick Gammon

Message
Changed to this:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the 
world you want chats to go to.
-->

<muclient>
<plugin
   name="Chat_Redirector"
   author="Nick Gammon"
   id="cb84a526b476f69f403517da"
   language="Lua"
   purpose="Redirects chat messages to another world"
   date_written="2007-06-30 10:45:35"
   requires="4.08"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!--  Triggers  -->

<trigger
   enabled="y"
   match="^You tell your racewar '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells you in gnome '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "Duris Chat"
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

end -- function redirect 

]]>
</script>


</muclient>


But now rescievening this error when I try and load the plugin -

[WARNING] C:\Users\rbb353\Desktop\Chat_Redirector.xml
Line 56: Elements terminated out of sequence, expected </muclient>, got </triggers> (Cannot load)
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 24 Jul 2018 04:39 AM (UTC)
Message
To save me editing all your posts:

Template:codetag To make your code more readable please use [code] tags as described here.


In your earlier post you had:


<!--  Triggers  -->

<triggers>


That <triggers> line seems to have disappeared from your amended plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Boen310   (17 posts)  Bio
Date Reply #6 on Tue 24 Jul 2018 09:23 AM (UTC)
Message
It's works now but only captures what I am saying. I added a few lines to try and help capture it but its not capturing lines like this:

Vof tells your racewar: 'shrug'


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the 
world you want chats to go to.
-->

<muclient>
<plugin
   name="Chat_Redirector"
   author="Nick Gammon"
   id="cb84a526b476f69f403517da"
   language="Lua"
   purpose="Redirects chat messages to another world"
   date_written="2007-06-30 10:45:35"
   requires="4.08"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>

<trigger
   enabled="y"
   match="^You tell your racewar '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells you in gnome '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells your racewar '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ racewar '.*'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "Duris Chat"
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

end -- function redirect 

]]>
</script>


</muclient>

Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #7 on Tue 24 Jul 2018 11:08 PM (UTC)
Message
Quote:

Vof tells your racewar: 'shrug'


But your trigger is:


   match="^[A-Za-z]+ tells your racewar '.*'$"



The text from the MUD has a colon which your trigger does not have.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


23,471 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.