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. ;)
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.
?? 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
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.
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?
(\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.
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.
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.