[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  How to make a separate chats window
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

How to make a separate chats window

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


Pages: 1  2  3  4 5  6  7  8  

Posted by Sleeper1320   (2 posts)  [Biography] bio
Date Reply #45 on Fri 07 Nov 2008 04:46 AM (UTC)
Message
What exactly does this bit of code do?

for _, v in ipairs (styles) do
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run

What does the _ mean exactly, and where did the styles parameter come from? Can this script handle the fact that there is possibly more than one color in a say/tell/yell?

Ultimately, I want to convert this to python (since I have way to many scripts in python already), but I'm trying to get the colors, and I really don't see how to do that...

sleeper
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #46 on Fri 07 Nov 2008 05:54 AM (UTC)
Message
In Lua, a variable name can be _, and by convention, the variable named _ is a variable you aren't too interested in the value of (eg. think of it as _temp).

The styles parameter is passed as the 4th argument to a trigger, in Lua only. The COM definition for the trigger handler in other languages is for 3 arguments, so that can't be changed. For other languages you could use GetStyleInfo to find out the style runs in a line (you also need to work out which line it is). This has been covered a bit on the forum, search for GetStyleInfo.

http://www.gammon.com.au/scripts/doc.php?function=GetStyleInfo

Yes, the script is designed to handle multiple styles. That for loop iterates through the table of styles.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Sleeper1320   (2 posts)  [Biography] bio
Date Reply #47 on Sun 09 Nov 2008 01:51 AM (UTC)
Message
I'm bummed the styles is only a lua parameter. Would be really convenient to have it in python. :)

That explanation makes perfect sense. Thanks for the answer.

sleeper
[Go to top] top

Posted by Mymyc   (25 posts)  [Biography] bio
Date Reply #48 on Wed 15 Apr 2009 06:36 PM (UTC)
Message
STOP! I have an idea! It just might work! Use the MUSHCLIENT notepad instead of using complicated scripts and plugins!

Set up an alias: called SETMINIWINDOWS

AppendToNotepad("CHAT","Start:")
MoveNotepadWindow("CHAT",826,1,200,720) -- resizing notepad
NotepadFont("CHAT","Bitstream Vera Sans Mono",10,1,0)
NotepadColour("CHAT","whitesmoke","black")
MoveWorldWindow(0,0,825,723) -- resizing mud window

-------------------------------------------------------

Type: SETMINIWINDOWS, ta-da there is the main world + a notepad window.


Use triggers to catch <whatever> then use
AppendToNotepad("CHAT","<whatever>")

:-D
[Go to top]
[Go to top] top

Posted by Flek   (4 posts)  [Biography] bio
Date Reply #49 on Tue 10 Nov 2009 01:07 AM (UTC)
Message
Okay I am 100% new to scripting. I only recently have learned how to even add plugins. My problem is I am trying to incorporate this but languages are in my mud along with unique ooc tags for ooc channels and each clan channel as a specific adjective for the tag.

You moodily say 'test'
You moodily say, in Arkanian 'test'
(NEWBIE) *Anastasius: test
CommNet 0 [Soal]( moodily )<Arkanian>: Hrm
CommNet 1 [Soal]: hrm
[- AdasCorp -]{Arkanian Engineering}<Junior Technician>[Soal]( moodily )<Arkanian>: test


Theese are some examples, how do I isolate just say and NEWBIE, OOC, IMM, and [- AdasCorp -] as well as possibly Commnet.
[Go to top] top

Posted by Blainer   (191 posts)  [Biography] bio
Date Reply #50 on Tue 10 Nov 2009 01:43 AM (UTC)

Amended on Tue 10 Nov 2009 01:46 AM (UTC) by Blainer

Message
I wouldn't try to make one trigger to catch all those lines I'd try to make triggers to catch each type or how ever it
breaks down best.

This trigger is not a regular expression it just uses * to match anything between the two single quotes.

Matches: You moodily say 'some text between single quotes'

<trigger
   enabled="y"
   match="You moodily say '*'"
   regexp="n"
   script="redirect"
   sequence="100"
  >
</trigger>


Matches: [- AdasCorp -]{Arkanian Engineering}<Junior Technician>[Soal]( moodily )<Arkanian>: test

<trigger
   enabled="y"
   match="[- AdasCorp -]{*}<*>[*]( * )<*>: *"
   regexp="n"
   script="redirect"
   sequence="100"
  >
</trigger>


If you can identify words that start a chat line and are not going to appear at the beginning of any other lines
the MUD will send you can make a general trigger like this.
Matches: You moodily say 'some text between single quotes'
       : You angrily say 'some text between single quotes'

<trigger
   enabled="y"
   match="You * say '*'"
   regexp="n"
   script="redirect"
   sequence="100"
  >
</trigger>

or
Matches: CommNet 0 [Soal]( moodily )<Arkanian>: Hrm
       : CommNet 1 [Soal]: hrm

<trigger
   enabled="y"
   match="CommNet *"
   regexp="n"
   script="redirect"
   sequence="100"
  >
</trigger>

[Go to top] top

Posted by Blainer   (191 posts)  [Biography] bio
Date Reply #51 on Tue 10 Nov 2009 01:47 AM (UTC)

Amended on Tue 10 Nov 2009 01:49 AM (UTC) by Blainer

Message
All the triggers above should work in the plugin if you have them between the <triggers> and </triggers> tags.

You could read/watch these too. The videos are great.
Template:post=9626 Please see the forum thread: http://gammon.com.au/forum/?id=9626.

Template:post=9616 Please see the forum thread: http://gammon.com.au/forum/?id=9616.

Template:post=9617 Please see the forum thread: http://gammon.com.au/forum/?id=9617.

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.
[Go to top] top

Posted by Flek   (4 posts)  [Biography] bio
Date Reply #52 on Tue 10 Nov 2009 03:20 AM (UTC)
Message
Thanks much, the multi triggers works wonders. I messed up at first but I did not notice to set reg expression to n from y. I fixed it and I am loving every minute of it.
[Go to top] top

Posted by Flek   (4 posts)  [Biography] bio
Date Reply #53 on Thu 12 Nov 2009 06:23 PM (UTC)
Message
One thing I have noticed and this is mush in general I think...
When I add the line
omit_from_output="y"
it will gag it from my main window but I still get a blank line in my scrolling.
Is there a way to fix this?
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #54 on Thu 12 Nov 2009 07:44 PM (UTC)
Message
This is because what is happening is that the trigger matches and omits the line, but the MUD is helpfully sending an extra blank line, which the trigger doesn't match.

I found this hard to fix for the individual matches (sometimes the blank lines were there and sometimes not), so I just use the plugin below that suppresses *all* blank lines.

There is a discussion about it somewhere else on this forum.

Template:saveplugin=Omit_Blank_Lines To save and install the Omit_Blank_Lines plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Omit_Blank_Lines.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Omit_Blank_Lines.xml (which you just saved in step 3) as a plugin
  7. Click "Close"



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 07, 2008, 1:07 PM -->
<!-- MuClient version 4.31 -->

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

<muclient>
<plugin
   name="Omit_Blank_Lines"
   author="Nick Gammon"
   id="87a0ec3649ab9a04d5ea618d"
   language="Lua"
   purpose="Omits blank lines from output"
   date_written="2008-07-07 13:06:47"
   requires="4.00"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Omits completely empty lines from output.
]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^$"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>

</muclient>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Danthrall   (2 posts)  [Biography] bio
Date Reply #55 on Fri 04 Dec 2009 10:52 PM (UTC)
Message
Alright, it took me a while to figure it out, but I finally got the new worlds to open up and everything. My only problem is that I can't see to get color-based triggers to carry over.

For instance, if I disable the plugin that allows the chat worlds to open, pages show up color coded... one for incoming, another for outgoing. When the plugin is enabled, however, the colors are gone.

I've even tried to make a set of triggers for the new world, as well, with no luck.
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #56 on Fri 04 Dec 2009 11:04 PM (UTC)
Message
What version of MUSHclient are you using? Version 4.43 may possibly fix this, as the style run colours sent to triggers are the updated ones as amended by other triggers.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Danthrall   (2 posts)  [Biography] bio
Date Reply #57 on Sat 05 Dec 2009 12:03 AM (UTC)
Message
That did it. Updated my version, and it's working, all nifty-like. Thanks!
[Go to top] top

Posted by Lawlimnatorization   (2 posts)  [Biography] bio
Date Reply #58 on Wed 23 Dec 2009 04:17 PM (UTC)

Amended on Wed 23 Dec 2009 04:19 PM (UTC) by Lawlimnatorization

Message
How would I go about making the multi-line trigger activate over a line that didn't end in punctuation? I know it leaves this pretty open, but the only true indicator on the MUD I play that somebody's chat message has ended is that it ended with a form of punctuation, usually a period it throws on the end if somebody forgot (or was simply too lazy) to add one themselves.

Edit: Thinking of the English language itself, it should probably also trigger from lines that end with a comma, due to the fact it indicates that only a portion of the sentence has passed.
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #59 on Wed 23 Dec 2009 07:08 PM (UTC)
Message
Check this out:

Template:post=7991 Please see the forum thread: http://gammon.com.au/forum/?id=7991.


In that thread, a little way down the page, I describe how to handle multi-line chats, and sending to another window. Rather than using a single multi-line trigger it uses a couple of triggers, where the start of a chat activates a second one.

In the multi-line example, it keeps processing chats until they end with a double-quote (by a simple search). You would just modify that to keep processing until they do *not* end with punctuation. Otherwise conceptually it would be very similar.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


144,162 views.

This is page 4, 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] Refresh page

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]