[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]  Trigger to color room title
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Trigger to color room title

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


Posted by Kyzen5   (7 posts)  [Biography] bio
Date Sun 26 Dec 2004 08:53 PM (UTC)
Message
I'm still new to Mushclient and all it can do but looks like it's a great client... I'm also still learning triggers and such, and i've tried reading on triggers a little and maybe i'm missing something... but i'm looking for suggestions on how to color the title of the rooms? I've been playin with this but it's obvious i'm still learnin. :) any help would be appreciated.. or maybe i'm wantin to do the impossible?

kyzen5
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #1 on Sun 26 Dec 2004 10:41 PM (UTC)
Message
Not impossible, just possibly complicated. First question is, "Are the titles already colored and you just want to change the color?" If not, then things are going to get difficult and maybe won't even work.

Basically, what you are looking for is a regular expression trigger like:

^\S[\w\S]{0,10}$

This will then color anything between one and ten characters in length that contains letters or spaces. The first \S is to make sure that at least one non-space character is matched. Change the '10' to what ever you expect the maximum number of characters to be. This 'may' work. However it is likely to trap a lot of lines it shouldn't. If however, you know that existing room titles are bright white, then you can set the trigger to color only those lines and hope some other line on the mud doesn't meet the requirements. Fact is, if the mud doesn't do some sort of coloring for them itself, and in a color not used by anything else, then you are going to have a major problem trying to make a trigger work, in any client.

It might help us if we had an exmaple of how the rooms and title look, so we can figure things out better. Like if it shows up like:

A big room.
This room is big, and I mean really seriously huge. Like monstrously
enormous..

Then it might be possible to design a bit different trigger to deal with it, such as checking to see if the title ends with '.', if it is followed by a line longer than X characters, etc. However, without an example, we are left guessing what will or won't work, or even 'if' it will. ;)
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #2 on Sun 26 Dec 2004 10:50 PM (UTC)
Message
Ok, here is what a room looks like with title and description.. maybe this will help.

Seahaven, Town Square Morning Cloudy
The large town square is cobbled in small smooth stones of a dark
color. Several small time vendors try to push their wares at the
top of their voices. In the middle of the square stands a large statue
with a fountain encircling it, and a handsome wrought-iron bench set
on each side. To the west an arch leads into a handsome building.


thanks again,
Kyzen5
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #3 on Mon 27 Dec 2004 12:14 AM (UTC)

Amended on Mon 27 Dec 2004 12:15 AM (UTC) by Shadowfyr

Message
Hmm. Not really.. It is about as bad as I figured. lol The trigger I suggested would sort of work, if you made it look for up to say 40 characters, but there is no real way to tell the title appart from say the second line, or the third, etc.

I suppose you might try:

<triggers>
  <trigger
   enabled="y"
   lines_to_match="3"
   match="^$\n^\.*$\n^[:upper:].*"
   multi_line="y"
   regexp="y"
  </trigger>
</triggers>

This assumes that there is 'always' a space between other text and the room name. Like:

Quote:
Dec 12-26, 2004 5:57PM> south

Seahaven, Town Square Morning Cloudy
The large town square is cobbled in small smooth stones of a dark
color. Several small time vendors try to push their wares at the
top of their voices. In the middle of the square stands a large statue
with a fountain encircling it, and a handsome wrought-iron bench set
on each side. To the west an arch leads into a handsome building.

Dec 12-26, 2004 5:57PM>

Basically, the expression is like this:

^$ - match a blank line (if no spaces are on it).
\n - new line.
^.*$ - match any number of characters on a single line.
\n - new line.
^[:upper:].* - match only if this is an uppercase character at the start of the line, then follow by any number of other characters.

One you copy the trigger in, you will still need to set what color you want it to be. through editing. This 'should' work for all rooms. However, it will also incorrectly match in any situation where this pattern happens. This likely includes descriptions that are broken up:

Quote:
Some room
This is a room.

The room doesn't have much in it....
It has a dirty floor.

The trigger would also incorrectly match on the first line of the second paragraph in the above case.

...... Actually, the trigger I provided won't actually work. Since it matches on the text of the line that follows the title as well, it would color both the title and the line that follows it. I don't know of any way that you can exclude that line, but still match on it so the trigger works.... :( You might have to capture the lines, then fiddle with 'omit from output' and redisplaying them through scripting using the 'colournote' command.

I think this may be a case where you just can't do it easilly. Likely the muds staff did this intentionally, not to prevent coloring it, but just to make capturing the titles difficult. Some muds do stuf like this to make it much harder for people to use automappers. Others just because they are too damn lazy to make the text pleasing to read. ;)
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #4 on Mon 27 Dec 2004 01:10 AM (UTC)
Message
Ok, thanks for the help though :) appreciat it. Also i was wondering real quick if you could tell me how to put multiple commands in an alias? i'm used to zmud and how it just uses multiple lines for each command in an alias, but from what i've heard mush client is a little different?

Thanks for the help Shadowfyr,


Kyzen5
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Mon 27 Dec 2004 01:26 AM (UTC)

Amended on Mon 27 Dec 2004 01:31 AM (UTC) by Nick Gammon

Message
You have only given one room description, so it is hard to say for sure, but one thing I notice is that each word is capitalised.

This trigger might work for you:


<triggers>
  <trigger
   custom_colour="3"
   enabled="y"
   match="^([A-Z]{1}[A-Za-z]*,? ?)+$"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>


What is is doing is looking for one or more capitalised words.

It worked for me, colouring your example room name but not the description. It also worked on various other rooms in Darkhaven.

You could limit the number of words by replacing the final "+" sign by, say, "{1,5}" which would match between 1 and 5 words.

I found it didn't work on names like "Meeting of Hawk Street and Justice Road" because the "of" and "and" were in lower case, however this variation worked:


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   match="^(([A-Z]{1}[A-Za-z]*,? ?)|and |of ){1,8}$"
   regexp="y"
   sequence="50"
   other_text_colour="orangered"
   other_back_colour="#FEC0B5"
  >
  </trigger>
</triggers>


Note the "and" and "of" literally in the trigger. I also here put in the test for between 1 to 8 words in the room name, to rule out really long names.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 27 Dec 2004 01:30 AM (UTC)

Amended on Mon 27 Dec 2004 01:32 AM (UTC) by Nick Gammon

Message
Quote:

Also i was wondering real quick if you could tell me how to put multiple commands in an alias?


You can send multiple things (ctrl+enter to type type multiple lines), or click on the "..." box to enter a dialog box where you have more space to type.

If you want to send multiple commands, set the alias to "send to script" and then put as many script commands in the send box as you like. eg.


Note "test note"
Send "go west"
DoAfter 10, "eat fish"


There are many script functions you can use, see this page:


http://www.gammon.com.au/scripts/doc.php?general=function_list


That will list them all, there are currently 284 separate script functions you can use.

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #7 on Mon 27 Dec 2004 02:51 AM (UTC)
Message
Damn.. I must be brain dead. Didn't even notice the capitalization on those lines... That solves the problem a lot more nicely.
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #8 on Tue 28 Dec 2004 06:40 AM (UTC)
Message
Wow.. Thanks for all the feedback you guys. Much appreciated indeed. i'll give those suggestions a shot Nick, thanks again.

Kyzen5
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #9 on Tue 28 Dec 2004 07:13 AM (UTC)
Message
Hey Nick,

Just so i understand.. The two suggestions you posted for coloring room titles. Would i want to put all that into a trigger itself, or is that entering all that into a script file and then having it run that way? Sorry, still learnin some :) thanks for the help.

Kyzen5
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #10 on Tue 28 Dec 2004 08:54 AM (UTC)
Message
Wow.. I think i just discovered how powerful this whole ability to script in mushclient can be.. seems there's a *ton* of stuff you can do. Pretty cool!

Kyzen5
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #11 on Tue 28 Dec 2004 09:38 AM (UTC)
Message
You put that stuff in the trigger dialog (copy/paste if its in the correct format), which means it will end up in your world file (in a trigger).

The stuff that IS for a script, can either go in your script file (which is called from a trigger, alias, etc) OR can go in the 'send' box of your trigger/alias if you change the 'send to' box to 'script'.


~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Kyzen5   (7 posts)  [Biography] bio
Date Reply #12 on Tue 28 Dec 2004 11:12 AM (UTC)
Message
Ok. Thanks.
[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.


9,769 views.

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]