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, 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 ➜ Miniwindows ➜ Mini-window for public chatter

Mini-window for public chatter

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  9  

Posted by Renox Dashin   (17 posts)  Bio
Date Reply #60 on Tue 07 Jun 2011 03:19 PM (UTC)
Message
Okay that told me nothing,
^(.*?) chats\: \'(.*?)\\n(.*?)\'\\Z$
thats my attempt at a multi-line chat trigger, All i need to know is what to change to make it pick up multiline chats, I can figure the rest out on my own. All i need is the updated trigger. I've got the blasted thing to work, EXCEPT for multi-lines, I feel like i'm on a customer service line, Always being transfered to a different operator and never quite getting the service i request.
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #61 on Tue 07 Jun 2011 06:33 PM (UTC)
Message
Renox Dashin said:

Okay that told me nothing,

Then you didn't actually read it.

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #62 on Tue 07 Jun 2011 08:21 PM (UTC)
Message
Further down on the first page of that thread, Nick explains how to capture variable-length, server-wrapped lines using multiple triggers. You have one trigger for the start (^.+? chats: '(.+)), one for the middle (^(.+)$), and one for the end (^(.+)'$, with a lower sequence value). All but the first start out disabled. When the first triggers, it enables the other two. When the third matches, it disables itself and the second again. In each of the triggers, you can get the pieces of the message and put them back together.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #63 on Tue 07 Jun 2011 09:45 PM (UTC)
Message
Renox Dashin said:

Okay that told me nothing,
^(.*?) chats\: \'(.*?)\\n(.*?)\'\\Z$
thats my attempt at a multi-line chat trigger,


I repeatedly ask people here to post their triggers using the inbuilt copy function.

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.


Just pasting the match line tells me nothing about whether you have regular expressions checked, multi-line checked, and other relevant things.

Also you haven't posted what you are trying to match on (copy and paste some samples). Maybe there is an extra space there you didn't spot.

Renox Dashin said:

All i need to know is what to change to make it pick up multiline chats, I can figure the rest out on my own. All i need is the updated trigger. I've got the blasted thing to work, EXCEPT for multi-lines, I feel like i'm on a customer service line, Always being transfered to a different operator and never quite getting the service i request.


The service, huh? Would that be the free technical support for the free software you downloaded? I get around 2000 to 3000 downloads of MUSHclient every month. As an unpaid supporter it really isn't feasible for me to give lengthy detailed support to every one of those downloaders. I try very hard to support people, but after typing in pages and pages of examples of doing multiple line triggers, and then looking up where those pages are, I expect you to at least make an attempt to read them and implement the suggestions in them.

The fact is that the multiple-line trigger feature in the client, whilst it works, can easily match too much or too little. For example with two chats in a row it might match both of them, and maybe the stuff inbetween. The techniques I describe are more likely to work.

If what you posted above is really what you have it is wrong on at least two counts, the \\Z should be \Z and then \\n should be \n.

I can't force you to read the documentation but I put a lot of work into it, and reading it will help you.

Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

- Nick Gammon

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

Posted by Roady   Netherlands  (3 posts)  Bio
Date Reply #64 on Wed 08 Jun 2011 10:14 PM (UTC)

Amended on Wed 08 Jun 2011 10:16 PM (UTC) by Roady

Message
Ok, I have been trying to edit this to make it work for New Worlds ateraan.
But I ran into a problem, as the chats don't always end in the same symbol, and wrap around.
(so far I have only managed to have it recognise the first line)

sample output here:

 Neechi <OOC> no it wasn't
 Drustian <OOC> Going back in time; dingy acts like it never was out in the
                first place. there will be some odd things. Also, ask things
                like that on question. :)
 Kegan <OOC> so this is YOUR fault Walter!
 <OOC> Reana chuckles.
Alzheni <CHAT> Neechi clearly has no sense of humor
Alzheni <CHAT> I forgive her, though
Reana <CHAT> I think that was her sense of humor. lol.
 <OOC> Elani winks at Walter.
Alzheni <CHAT> Don't hit me with your logic!
<CHAT> Drustian mutters under his breath
<CHAT> Airith pets Drustian soothingly
 Fericia <OOC> Andrew, quick tell?


my current thinking is that I could achieve this by having 3 triggers:
one that triggers to the first line.
two seperate triggers that trigger to: a certain number of spaces followed by at least one character of the correct colour.

the first trigger enables the 2nd.
the 2nd enables the 3rd and disables itself.
the 3rd enables the 2nd and disables itself.

Do you think that could work? or am I needlessly complicating things?
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #65 on Thu 09 Jun 2011 01:14 AM (UTC)
Message
Yes I think you are on the right track, except maybe that 3rd trigger.

The 2nd trigger (the spaces followed by the rest of the chat) is likely to stay enabled indefinitely, because there is nothing to disable it (like, if there were 4 lines).

I think I would have trigger 1 matching the start of the chat, and enable 2 and 3.

Trigger 2 matches the rest of the chat (spaces ... chat) and copies that to wherever (like the miniwindow).

Trigger 3 matches "*" but is a lower priority. Thus trigger 3 matches all lines that are *not* chat. When it fires it disables triggers 2 and 3.

I think I would leave trigger 1 enabled (because you may get 2 chats in a row).

- Nick Gammon

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

Posted by Roady   Netherlands  (3 posts)  Bio
Date Reply #66 on Thu 09 Jun 2011 05:16 PM (UTC)

Amended on Thu 09 Jun 2011 05:19 PM (UTC) by Roady

Message
so a trigger can't disable itself?
My idea was that the 2nd and 3rd triggers are the same and end up alternately disabling themselves and enabling the other. (until it no longer matches the correct pattern)

...thinks
realises that that indeed needs additional triggers to disable the 2nd/3rd trigger on a new line.

in that case
yes, your idea sounds like a much better approach(as it requires less triggers).
but wouldn't that 3rd trigger end up constantly disabling the 2nd trigger without it being re-enabled, resulting in it never catching more than 2 lines?
(I guess I don't really know how priority works exactly)
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #67 on Fri 10 Jun 2011 (UTC)
Message
Yes, a trigger can disable itself, I just don't like the idea of two triggers toggling each other.

I meant "a higher sequence number" for the 3rd trigger, which is a lower priority. If a trigger fires, and you don't have "keep evaluating" checked, that stops further trigger evaluations.

I use that often to have a specific trigger (like in your case, to catch a chat line) and then a "catch-all" trigger with a lower priority (higher sequence) which it falls through to if the specific trigger doesn't match.

- Nick Gammon

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

Posted by Roady   Netherlands  (3 posts)  Bio
Date Reply #68 on Fri 10 Jun 2011 12:44 PM (UTC)

Amended on Fri 17 Jun 2011 11:59 AM (UTC) by Roady

Message
ah now I see, thanks for the clarification.
that should be enough information for me to figure things out on my own.

EDIT:
and I have (Ithink), below is an example of the triggers I used.
I haven't tested it that thoroughly yet, but it seems to properly catch more than 1 line, without sending EVERYTHING to the miniwindow. (I haven't yet tested wetter it catches 3 or more lines though)


  <triggers>

  <trigger
   enabled="y"
   match="^.*\&lt;CHAT\&gt;.*$"
   match_text_colour="y"
   omit_from_output="y"
   regexp="y"
   script="chats"
   send_to="12"
   sequence="100"
   text_colour="13"
  >
  <send>EnableGroup ("CHATx" , true)
    </send>
  </trigger>

  <trigger
   enabled="n"
   group="CHATx"
   match="^\s{3,}.+$"
   match_text_colour="y"
   omit_from_output="y"
   regexp="y"
   script="chats"
   sequence="100"
   text_colour="13"
  >
  </trigger>

  <trigger
   group="CHATx"
   match="*"
   send_to="12"
   sequence="101"
  >
  <send>EnableGroup ("CHATx" , false)    
    </send>
  </trigger>

</triggers>

Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #69 on Sat 11 Jun 2011 12:15 AM (UTC)
Message
I edited your triggers so they can be pasted back into the client if other people want to try them:

Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


That looks like the right idea.

- Nick Gammon

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

Posted by Chyort   USA  (58 posts)  Bio
Date Reply #70 on Sat 11 Jun 2011 12:05 PM (UTC)
Message
Upgraded to 4.73 and decided to update this as well, and now the window defaults to top left instead of top right.

Which unfortunately forces me to ask... What do i need to change to put it back to defaulting to top right?
Top

Posted by Jadinna   Australia  (8 posts)  Bio
Date Reply #71 on Wed 09 Nov 2011 04:55 AM (UTC)
Message
Is there a way to have multiple miniwindows opened from this script?

Example:
[Chat] Person waves.
[Community] Anotherperson cheers.
[Roleplay] Somebody says, "Hi."
Person pages: "Heya."

In the above example, I want the [Chat] and [Community] to go to one miniwindow called 'Communications', [Roleplay] to go to another miniwindow called 'Misc' and the page to go to a third window called 'Pages'

Do I need three seperate script files, or can it be done somehow by using the Trigger's 'group' field?
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #72 on Wed 09 Nov 2011 07:52 PM (UTC)
Message
You could adapt that one by making multiple windows. Something along the lines of, instead of:


Win = GetPluginID()


do:


Win = GetPluginID() .. "_Community"


Of course, you would change the last bit based on the trigger which has the chat channel in it.

This would need to be moved from a "global" assignment (done once) to inside the trigger script. Plus you would need to create all the windows when the plugin opens. But it could be done, yes.

- Nick Gammon

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

Posted by Jadinna   Australia  (8 posts)  Bio
Date Reply #73 on Thu 10 Nov 2011 09:10 AM (UTC)

Amended on Fri 11 Nov 2011 02:54 AM (UTC) by Nick Gammon

Message
These are the changes I have made. I do not know if they are valid changes or not, as I am not a coder and this is my first toe-dip into the xml and plugin coding.

Quote:

<trigger
enabled="y" keep_evaluating="y" regexp="y" omit_from_output="y"
match="^\[(Public|Roleplay|Code|Help|Chargen)\] .*"
script="chats"
send_to="12"
sequence="100"
>
<send>
Win = GetPluginID() .. "_Chats"
TRIGGER_TITLE_NAME = Chat Channels
</send>
</trigger>

<trigger
enabled="y" keep_evaluating="y" regexp="y" omit_from_output="y"
match="^(Long distance to |You paged |From afar, |.* pages: |\(To: .*\) ).*"
script="chats"
send_to="12"
sequence="100"
>
<send>
Win = GetPluginID() .. "_Pages"
TRIGGER_TITLE_NAME = Pages
</send>
</trigger>


Quote:

theme = {
TITLE_NAME = TRIGGER_TITLE_NAME, -- for miniwindow title area
}


Quote:

-- Title text
WindowText(Win, "titlefont"..Win, theme.TITLE_NAME, ((WINDOW_WIDTH)-(7.5*line_height))/2, (theme.TITLE_HEIGHT-line_height)/2, WINDOW_WIDTH, theme.TITLE_HEIGHT, theme.HIGHLIGHT, false)


When I install it I get the following error messages

Quote:

Error number: 0
Event: Run-time error
Description: [string "Plugin"]:116: bad argument #1 to 'WindowCreate' (string expected, got nil)

stack traceback:

[C]: in function 'WindowCreate'

[string "Plugin"]:116: in function <[string "Plugin"]:114>
Called by: Function/Sub: OnPluginInstall called by Plugin Chat_Capture_Miniwindow

Reason: Executing plugin Chat_Capture_Miniwindow sub OnPluginInstall


And when triggering the Chat trigger:

Quote:

Error number: 0
Event: Compile error
Description: [string "Trigger: "]:4: '=' expected near '<eof>'
Called by: Immediate execution


Quote:

Error number: 0
Event: Run-time error
Description: [string "Plugin"]:449: attempt to compare string with number

stack traceback:

[string "Plugin"]:449: in function 'add_line'

[string "Plugin"]:359: in function 'fillBuffer'

[string "Plugin"]:439: in function <[string "Plugin"]:411>
Called by: Function/Sub: chats called by trigger

Reason: processing trigger ""



[EDIT] (by moderator) quoted forum codes.
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #74 on Fri 11 Nov 2011 03:23 AM (UTC)
Message
After some experimenting, I think it would be easier to just make 3 plugins, once for each chat style.

Give each one a different plugin ID, eg.


81db44d9d749abe990cb39f4
6e6499aaa51cd07b6d2aa031
f560226b0139d394da61e7a6


Otherwise you'll get an error message about "plugin already loaded".

This goes here, near the start:


<muclient>
    <plugin
    name="Chat_Capture_Miniwindow"
    author="Fiendish"
    id="565dae21eb816a2fdb8d50f9"


Then make a trigger for each plugin, one for each type of chat.

Somewhere near the middle, on this line:


   -- Title text
    WindowText(Win, "titlefont"..Win, "COMMUNICATION", ((WINDOW_WIDTH)-(7.5*line_height))/2, (theme.TITLE_HEIGHT-line_height)/2, WINDOW_WIDTH, theme.TITLE_HEIGHT, theme.DETAIL, false)


Change "COMMUNICATION" to whatever for each window (eg. "CHATS", "PAGES", etc.).

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


358,481 views.

This is page 5, subject is 9 pages long:  [Previous page]  1  2  3  4  5 6  7  8  9  [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.