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, 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.
Entire forum
MUSHclient
Tips and tricks
Chat redirection plugin assistance?
Chat redirection plugin assistance?
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Pages: 1
2
Posted by
| Calicoxx
(14 posts) bio
|
Date
| Reply #15 on Mon 18 May 2009 01:28 AM (UTC) |
Message
| Hello. I am also having a problem. I copied the plug in, and added in the messages for my realm, made sure everything checked up and matched, but there is nothing going from the main window to the redirect window. My plugin looks like:
<?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|[OOC]s) \'(.*?)\'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="^You (say|chat|yell|[OOC]) \'(.*?)\'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
chat_world = "DBE 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
end -- function redirect
]]>
</script>
</muclient>
Any help would be much appreciated. =) | top |
|
Posted by
| Worstje
Netherlands (899 posts) bio
|
Date
| Reply #16 on Mon 18 May 2009 08:37 AM (UTC) Amended on Mon 18 May 2009 08:38 AM (UTC) by Worstje
|
Message
| Adjust [OOC] to \[OOC\] in your triggers. [] signifies a character class in regular expressions, and you are basically saying O, O, or C. Which it apparently does not consider an error but in either case, it does not do what you expect it to. :)
Edit: Although the yells and other varieties should still work. Can I assume you only tested with the OOC channel? :) | top |
|
Posted by
| Calicoxx
(14 posts) bio
|
Date
| Reply #17 on Mon 18 May 2009 02:00 PM (UTC) |
Message
| Hmm, well I did that, and I checked other channels as well, but to no avail. It still did not work for the OOC or says, yells, ect. | top |
|
Posted by
| Nick Gammon
Australia (23,043 posts) bio
Forum Administrator |
Date
| Reply #18 on Mon 18 May 2009 11:09 PM (UTC) |
Message
| To help you, you need to show us some sample lines that you are trying to match. Triggers are pretty specific, maybe there is a comma there you didn't allow for. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Calicoxx
(14 posts) bio
|
Date
| Reply #19 on Mon 18 May 2009 11:51 PM (UTC) |
Message
| Some samples are (I am aware of the tells being transmission instead):
Player [OOC]s, 'ty Volaj... on my way back to recall, lol.'
You [OOC], 'Hello.'
Player says, 'whats goin onnnn uub'
You say, 'Yo'
You send a scouter transmission to Player, 'Heya'
Player sends a scouter transmission to you, 'okay :P'
You (Holler), 'Someone else holler!'
Player (Holler)s, 'why?'
You (Shout), 'Shout like you mean it'
Player (Shout)s, 'shout shout'
You sing, 'Someone sing!'
Player sings, 'why?'
Player (1): homo
You (Roleplay), '-=Test=-'
Player (Roleplay)s, '*kills the human*'
You (Quote), '2 more!'
Player (Quote)s, 'woot helping'
You (Congrat), '1 more!'
Player (Congrat)s, 'yo'
You RP/Quest say, 'That's all!'
Player RP/Quest says, 'you need this one too? >.>'
You tell the group, 'Yo'
Player tells the group, 'sup'
The Number in "Player (1): homo" also changes depending on what frequency it is on.
I believe that is all. | top |
|
Posted by
| Nick Gammon
Australia (23,043 posts) bio
Forum Administrator |
Date
| Reply #20 on Tue 19 May 2009 01:06 AM (UTC) |
Message
| That was a good guess by me about the comma. ;)
Your match string was:
match="^[A-Za-z]+ (says|chats|yells|[OOC]s) \'(.*?)\'$"
Even allowing for escaping the brackets, like this:
match="^[A-Za-z]+ (says|chats|yells|\[OOC\]s) \'(.*?)\'$"
That would match, say:
but you have:
Someone says, 'something'
Note the comma after "says".
So at least you need to try:
match="^[A-Za-z]+ (says|chats|yells|\[OOC\]s), \'(.*?)\'$"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Calicoxx
(14 posts) bio
|
Date
| Reply #21 on Tue 19 May 2009 02:45 AM (UTC) |
Message
| Thanks Nick! That did the trick! =) | top |
|
Posted by
| ShanG
(6 posts) bio
|
Date
| Reply #22 on Mon 14 Sep 2009 12:57 AM (UTC) |
Message
| I'm using the Chat Redirector/Input Redirector functions with several different worlds, and multiple chat windows.
What I want to know is, how can I set up the Input Redirect to take commands in the chat window, and send those commands to one window or another depending on the command entered.
Would it be possible to set up aliases in the chat window to that effect? | top |
|
Posted by
| Nick Gammon
Australia (23,043 posts) bio
Forum Administrator |
Date
| Reply #23 on Mon 14 Sep 2009 10:08 AM (UTC) |
Message
| Yes, I don't see a problem with that. Where it does:
.. substitute the world name you want instead of a fixed chat_world variable. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| ShanG
(6 posts) bio
|
Date
| Reply #24 on Tue 15 Sep 2009 08:56 PM (UTC) |
Message
| Allright, so I'm not really all that comfortable with the scripting, I haven't done a lot with it beyond making simple tweaks and edits to a few plugins.
Maybe you can tell me what I'm doing wrong here? I figure it's probably something extremely basic like 'completely messing up how the script should be written'.
<aliases>
<alias
match="^\+(P|Pub|Public) (.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>world_name = "World1"
local w = GetWorld (world_name) -- find world
-- not found? show error
if not w then
ColourNote ("white", "red", "World " .. world_name .. " is not open")
else
w:Execute (%0) -- execute command (handle aliases, etc.)
PushCommand (%0) -- save in command history
end -- if
return ("\t") -- clear command</send>
</alias>
</aliases>
| top |
|
Posted by
| Nick Gammon
Australia (23,043 posts) bio
Forum Administrator |
Date
| Reply #25 on Tue 15 Sep 2009 10:31 PM (UTC) |
Message
|
In particular, you need to quote the %0 |
- 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.
69,627 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.