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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Separating my MUD prompt
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Sun 12 Aug 2001 10:06 AM (UTC) |
Message
| I'm STILL trying to color my prompt. Can I make a trigger so that MUSHClient colors the first <*> it sees? Currently, if it sees "<Prompt> He says: Text <text>" it colors from the start to the last bracket. How can i get it to
match on the prompt only? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 12 Aug 2001 10:10 AM (UTC) |
Message
| Make the trigger a regular expression, then it only colours the exact thing it matches on.
However regular expressions have slightly different rules, if you are matching on <*> you might to write it as:
\<.*\>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #2 on Sun 12 Aug 2001 11:06 AM (UTC) |
Message
| Even so, MUSHClient matches on the last closing bracket it sees, not on the first. E.G. "colour <this> not <that>" colours from <this> to <that>, not just <this>. is there any way to get it co match the first closing bracket? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 12 Aug 2001 11:30 AM (UTC) |
Message
| Ah, OK. You need to add a question mark, like this:
\<.*?\>
This is discussed in the file RegularExpressions.txt that ships with MUSHclient:
By default, the quantifiers are "greedy", that is, they
match as much as possible (up to the maximum number of per-
mitted times), without causing the rest of the pattern to
fail. The classic example of where this gives problems is in
trying to match comments in C programs. These appear between
the sequences /* and */ and within the sequence, individual
* and / characters may appear. An attempt to match C com-
ments by applying the pattern
/\*.*\*/
to the string
/* first command */ not comment /* second comment */
fails, because it matches the entire string due to the
greediness of the .* item.
However, if a quantifier is followed by a question mark,
then it ceases to be greedy, and instead matches the minimum
number of times possible, so the pattern
/\*.*?\*/
does the right thing with the C comments. The meaning of the
various quantifiers is not otherwise changed, just the pre-
ferred number of matches.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #4 on Mon 13 Aug 2001 09:29 AM (UTC) |
Message
| I tried to separate my prompt (mentioned here as <Prompt> because it is enclosed in brackets) from the text coming after it. For example, I want "<Prompt>Text after prompt" in two lines. I used matching on "^(\<.*?\>)(.*)$" and then outputting %1\n%2 but I use MUSHClient's prompt coloring, and now the prompt colors are all messed up (the prompt is either colored white or with the normal text color). Is there any way that I can color it? Use triggers that match on output perhaps? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Tue 14 Aug 2001 02:40 AM (UTC) Amended on Tue 14 Aug 2001 02:41 AM (UTC) by Nick Gammon
|
Message
| This is a bit trickier - to keep the existing colours you cannot change the text. Once you change the text (eg. by adding a newline) you have to echo it to the world, which will discard the colours. However there is a way to change some colours, even if they are not the absolute original ones in the line.
You can do this with a bit of scripting, and changing "note" colours in the script. Something like this:
Match on: ^(\<.*?\>)(.*)$
(Which you have done). This will give you two wildcards, the first being the prompt and the second being the rest of the line.
Now change some more fields in the trigger:
Omit from output: checked
Label: prompttrigger
Script: OnPrompt
The script needs to change the note colours and then do a "world.note" for each line. Something like this:
sub OnPrompt (strName, strLine, aryWildcards)
world.notecolourfore = vbRed ' set prompt colour
world.note aryWildcards (1) ' show prompt
world.notecolourfore = vbGreen ' set text colour
world.note aryWildcards (2) ' show text
end sub
You could choose any colour you like of course, and MUSHclient now has a "colour picker" built in, which lets you choose a colour visually.
This method lets you colour the prompt and the line different colours, but you are discarding the original colours from the MUD. At present that is unavoidable, if you want to change the text itself. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #6 on Tue 14 Aug 2001 09:57 AM (UTC) |
Message
| Wouldn't it be better though to make MUSHClient support ANSI codes in triggers (kind of like mIRC)? For example, instead of choosing the colour I would like to make the line, I could write:
say ^K4 This is a red line
say ^K10 This is a black line
^K<number> being the ansi color character. I think that would make many lives easier :) |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Tue 14 Aug 2001 12:29 PM (UTC) |
Message
| I think that the whole colour handling in MUSHclient could be enhanced a bit, for advanced users.
Right now it handles incoming ANSI colours (all 16 of them), plus MXP colours which can be any one of 17,777,216 colours (256 red X 256 green X 256 blue).
You can also display any of those RGB colours yourself using scripts, as I suggested earlier, however it is admittedly a bit tedious to do, compared to what you are suggesting.
Look forward to enhanced colour management in the next major version. :) |
- 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.
15,030 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top