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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ How to make a separate chats window

How to make a separate chats window

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


Pages: 1  2  3  4  5 6  7  8  

Posted by Lawlimnatorization   (2 posts)  Bio
Date Reply #60 on Thu 24 Dec 2009 07:33 AM (UTC)
Message
>.>

You just linked me back to the start of this post. I don't really know how to go about changing it to only end on punctuation. I tried just throwing everything except ' into the script and I just got errors, so now I've got it sitting on a period.
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #61 on Thu 24 Dec 2009 07:40 AM (UTC)

Amended on Thu 24 Dec 2009 07:42 AM (UTC) by Nick Gammon

Message
Oh yeah, I thought it looked familiar. :P

Well, this part on page 1 looks for the end of a multi-line chat:


 -- 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


That is testing the last character of each line for the double-quote character. Now if you say a multi-line chat ends on a period or question-mark or something, you change it to:


 -- if ends with period or question-mark, end of multi-line chat
  if line:sub (-1) == '.' or 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


Now if that doesn't work, can you post what you did exactly, and what the lines from the MUD are?

And if you get errors, rather than saying "I got errors" can you post the exact error message, and what your code was that caused it?

- Nick Gammon

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

Posted by Cerxi   Canada  (1 post)  Bio
Date Reply #62 on Mon 25 Jan 2010 08:30 PM (UTC)

Amended on Mon 25 Jan 2010 08:51 PM (UTC) by Cerxi

Message
Sighh.. I'm really new at this. All I want it to do is match (<the name of any of the various guilds, cities, or clans>): <someone> says, "<something>" and pipe it to a new window. Also not to match regular <person> says, only group ones. But I can't figure out how because this is rather too complicated for my tiny brain.
Top

Posted by Basyiel   (10 posts)  Bio
Date Reply #63 on Mon 08 Feb 2010 10:50 PM (UTC)
Message
Ive followed the directions to a tee, I play midkemia, I cannot get anything to send from the main world to the chat window.. I'm copyin and pastin, enabling the plug in and nothing.. I dunno what to say.. past frustrated.. i like the client but nothing seems to work for me. Any help would be great.
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #64 on Mon 08 Feb 2010 11:52 PM (UTC)
Message
To help both of you we need to see, copied and pasted (not just described) the exact output from the MUD you want to match (and any similar output you want to not match).

Also, if you changed the plugin can you at least post the changed lines (or all of it?).

Regular expression matching can be fiddly to get right, an extra space somewhere and it won't match.

- Nick Gammon

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

Posted by Basyiel   (10 posts)  Bio
Date Reply #65 on Thu 11 Feb 2010 10:31 AM (UTC)
Message
I've toying with it here n there, found out the says are working in town and guild chats such as this:

(Sar-Sargoth): Raki says, "Thank you everyone for the hunt."
(Sar-Sargoth): Dhaed says, "Yes, thank you very much for the hunt."

But nothing I say in any kind of chat goes to the chat window, everything stays in in the main window:

(Clan Raven): You say, "Mhm."

You say in Moredhel, "Uhh."

(Sar-Sargoth): You say, "K."


And heres the plug in as it is loaded into the main window.

<?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|yells|tells you), &quot;.+"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="^You (say|tell|whisper) .+, &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 = "RoD 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>
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #66 on Thu 11 Feb 2010 10:53 AM (UTC)
Message
Try:

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

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


Should fix your issues. I don't think I changed the first trigger, but just to make sure I kept both in my post. :)
Top

Posted by Basyiel   (10 posts)  Bio
Date Reply #67 on Thu 11 Feb 2010 12:09 PM (UTC)

Amended on Thu 11 Feb 2010 07:30 PM (UTC) by Basyiel

Message
I dunno, its like these triggers take a minute to warm up :-) started workin normally the way i wanted after changed that line in the trigger, and played for 5-10min. Thanks Worstje








Top

Posted by Verdilak   (6 posts)  Bio
Date Reply #68 on Mon 24 Jan 2011 09:49 PM (UTC)
Message
Okay, somethings are carrying over, and some are not.


You say 'bah'

is carrying over, while

[OOC] Valasha says 'test'

[OOC] Volkar says 'but I did not study I hope its open book'

are not.

Any suggestions on how to make these work?
Top

Posted by Slowreflex   (3 posts)  Bio
Date Reply #69 on Mon 24 Jan 2011 11:08 PM (UTC)

Amended on Tue 25 Jan 2011 09:21 AM (UTC) by Slowreflex

Message
I've really been trying to get this to work, but I can't. Basically, I want to match any line that has something surrounded by ' ' regardless of where it comes in the line. I tried '*' but it seems to pickup any line with a ' in it, even if there's only one. Can someone please help?

This is what is picking up anything with a ' instead of surrounded by them, as I would expect.

<trigger
enabled="y"
match="'*'"
regexp="n"
script="chat_redirect"
omit_from_output="n"
sequence="100"
>
</trigger>

Thanks for your help.
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #70 on Tue 25 Jan 2011 10:26 AM (UTC)
Message
Modifying your trigger slightly to colour the line but not call a script gives this:



<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="'*'"
   sequence="100"
  >
  </trigger>
</triggers>


That does not match this line:


[OOC] Volkar says 'but I did not study I hope its open book'


Nor would I expect it to, as the line doesn't start with a quote.

I doubt you actually copied the trigger as advised here:

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


If you did, it wouldn't have this in it:


regexp="n"


That is because not being a regexp is the default, and it doesn't normally put defaults in.

So to assist you, I need the actual trigger you say doesn't work, not a modified version.

- Nick Gammon

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

Posted by Slowreflex   (3 posts)  Bio
Date Reply #71 on Tue 25 Jan 2011 02:14 PM (UTC)
Message
Hi Nick, you answered Verdilak, but not me. Did you miss my post?
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #72 on Tue 25 Jan 2011 08:40 PM (UTC)
Message
Oops. I saw two posts an hour apart on an old thread last posted to in February 2010, and just assumed they were from the same person, particularly as they were both about quote symbols. You notice my reply actually quotes Slowreflex's trigger but uses Verdilak's test data. So it was sort-of a "combined reply".




Slowreflex : can you please post the actual trigger you used?

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Also the actual line from the MUD you are trying to trigger on?




Verdilak : can you please post the trigger you used as well? (See copying advice above).




This is a 5-page thread, and there are a few variations on the plugin and suggested trigger in those pages, so it is hard to give advice without seeing what you are actually using.

- Nick Gammon

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

Posted by Verdilak   (6 posts)  Bio
Date Reply #73 on Tue 25 Jan 2011 09:11 PM (UTC)
Message
Nick, I used the trigger/script as listed from the first post on this thread.
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #74 on Wed 26 Jan 2011 03:54 AM (UTC)
Message
So this trigger?


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


That won't match on lines starting with "[OOC] " so you need to add that as an option:


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


The question mark means that "[OOC] " is an optional prefix.

- 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.


396,460 views.

This is page 5, subject is 8 pages long:  [Previous page]  1  2  3  4  5 6  7  8  [Next page]

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.