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
➜ Suggestions
➜ A couple of suggestions...
|
A couple of suggestions...
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Thu 14 Mar 2002 04:55 AM (UTC) |
| Message
| First this was brought up but I don't think you added it to the suggestion list. How about making the entire line for a trigger be wildcard(0)? Since they run from 1 to whatever, this should not effect existing scripts, but I have had a few times when it would have been nice to color say 'only' the numbers on a line, but you can't really do that. With access to the full line and using a script and world.note, with some other features this should be possible, but it is definitely not if you set the color 'in' the trigger.
The second is this.. I have downloaded the help for vbscript 5.5 from microsoft as have others. While I suppose you can add a button to the shortcut tray, on my system it is already 'very' crouded. ;) It would be useful if we could link additional help files for vbscript, javascript or perlscript to the existing help menu in mushclient, not to mention other programs or tools that we may link to through scripts. That way if we need to look something up we don't have to go hunting for it someplace else every time. ;) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Thu 14 Mar 2002 09:28 PM (UTC) |
| Message
| Wildcard 0 is already "the whole matching text". In other words, if you have a regular expression like this:
(\w*) = (\w*)
And it matches on:
dog = animal
Then the wildcards will be:
0: dog = animal
1: dog
2: animal
However, if this part of a larger line, then wildcard 0 is still only the matching text. eg. if the line was:
Someone said "dog = animal" but I wasn't sure.
In this case the wildcard 0 is still "dog = animal".
However if you call a trigger script then the second argument (matching line) is still the entire line, so you can still find what the entire matching line was.
If you want to colour every number on a line, I would suggest using a trigger like this:
Trigger: [0-9]+
Regular expression: checked
Repeat on same line: checked
Change colour to: whatever
That works, I tested it, and every number on the line was coloured, but other text wasn't.
Let me take the opportunity to warn against matching on:
[0-9]*
This seems to send MUSHclient into a loop (probably in the regular expression matching) because "*" means "zero or more" and it is probably trying to colour zero-length matches.
I have added your suggestion about the help files as suggestion #451. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #2 on Fri 15 Mar 2002 08:33 PM (UTC) |
| Message
| ?? Umm.. 1) I am confused - Do you mean that in:
sub Test(Name, Output, Wildcards)
Output is the full line it triggered on? Makes sense I suppose, since it is never used for anything else. Should have thought of that. :p
2) Yes your methods would color 'all' numbers a certain way, but since the intent was to color 'only' certain numbers on certain lines, while leaving the remaining text the same, it really wouldn't work. ;)
You really need to update that help file. There is literally 'no' exlaination of what the Output field does contain, not on your web site or in the help file, that I could find. Though the help file also doesn't provide an example of calling subs from a trigger or anything else (except the command line) anyway. :p Hope you are making it one of the priorities on the next version you are working on. Calling it out of date is beginning to be an understatement. lol | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sun 17 Mar 2002 12:44 AM (UTC) |
| Message
|
Quote:
Output is the full line it triggered on? Makes sense I suppose, since it is never used for anything else.
Yes, that is what I mean. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jeffrey F. Pia
(49 posts) Bio
|
| Date
| Reply #4 on Thu 02 May 2002 05:40 PM (UTC) |
| Message
|
Wildcard 0 is already "the whole matching text". In other words, if you have a regular expression like this:
(\w*) = (\w*)
And it matches on:
dog = animal
Then the wildcards will be:
0: dog = animal
1: dog
2: animal
However, if this part of a larger line, then wildcard 0 is still only the matching text. eg. if the line was:
Someone said "dog = animal" but I wasn't sure.
In this case the wildcard 0 is still "dog = animal".
In the last example, wouldn't the wildcards be:
0: Someone said "dog = animal" but I wasn't sure.
1: Someone said "dog
2: animal" but I wasn't sure.
If not, what regular expression would be used to get these results? | | Top |
|
| Posted by
| Magnum
Canada (580 posts) Bio
|
| Date
| Reply #5 on Thu 02 May 2002 08:48 PM (UTC) |
| Message
| (\w*) is the regular expession code for "word wildcard". It will ONLY grab one word. In the example provided, only the word immediately proceeding the "=", and immediately following the "=" will be grabbed.
(.*?) is the regular expression to grab everything as a wildcard, so:
(.*?) = (.*?)
...would do what you want.
From the Add/Edit trigger window, click help, and then follow the "Regular Expression" links to learn a little more, though the help file is not complete.
Nick says that the regular expression code follows a certain standard (I forget which). He's mentioned it in other posts. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Fri 03 May 2002 02:06 AM (UTC) |
| Message
|
Quote:
If not, what regular expression would be used to get these results?
What results do you want? Magnum is right about "." matching anything, that could be what you want.
Otherwise, the trigger gets passed down the entire matching line (second argument) thus it isn't really needed as a wildcard. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #7 on Fri 03 May 2002 02:07 AM (UTC) |
| Message
| The documentation for the PCRE (Perl-Compatible Regular Expressions) is in the file "RegularExpressions.txt" in the docs subdirectory of the MUSHclient install.
The help file, whilst largely correct, documents the earlier regular expression parser that is now not used.
It is correct (or almost correct), but incomplete. Read the file above for much more detail. |
- 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.
25,787 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top