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
➜ VBscript
➜ Group member highlighting
|
Group member highlighting
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Bradley
(7 posts) Bio
|
| Date
| Thu 08 Jul 2004 09:58 AM (UTC) Amended on Thu 08 Jul 2004 01:24 PM (UTC) by Bradley
|
| Message
| I'm a bit rusty at programming so I thought I'd run the idea by you people first. Here's what I'm looking @ coding:
Upon forming a group (band/party etc), I'd type "group" to display the standard output returned from the MUD (I've cut the rest of the table off to save room):
Member Hits Move
------------------------------------
Peter perfect rested
John perfect rested
Jill perfect rested
The player names will be dumped into an array.
From then on, the name is matched and coloured so it's easy to see.
If another member joins later on, simply typing "group" again, spills out the table and renews the array with the names.
Any ideas/tips etc? If not, it's time to get to work =) The only spot where I'm a little hazy on is how to correctly grab the person's name only (from the group table).
| | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #1 on Fri 09 Jul 2004 02:42 AM (UTC) |
| Message
| Assuming the spacing of that table is correct (the forum can get troublesome), then the following regexp will work.
[ ]{2}(\w+)[ ]+(perfect|average|etc)[ ]+(rested|tired|etc)[ ]+
fill in the average/etc with the other states (seperate them with | which is shift+\ and the same for the rested things. Or replace them with (\w+). Just make sure you account for the spaces. You can read more in the Windows script doc.
To make this trigger work, you need to make sure you check the Regular Expression box. Then youll get the name with %1.
Erm, I cant figure out how to match on a variable with more than one name. I seem to remember that you could put person1|person2|person3 into a variable, and then match on that. Nick?
However, what you CAN do, is have a variable (like the one above) using setvariable (read the list of inbuilt script functions for everything you need), and then use that to delete your trigger, and add another one with an updated match for your newer group. (deletetrigger, and addtrigger) the trigger would be a regexp, repeat on the same line, and then a color change, and then the match would be (person1|person2|person3). Then you wouldnt need an array.
Nick? Help on the matching from a variable? |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Fri 09 Jul 2004 04:56 AM (UTC) |
| Message
| See the release notes for version 3.48 ...
12. When matching a trigger which contains a variable name, you can now prevent the variable's contents from being "escaped", in case you deliberately want to put a regular expression in it. eg.
variable target = "alice|bob"
trigger match = You see (@!target) here
The "!" after the "@" tells MUSHclient to use the variable literally and not try to put backslashes in front of any meta-characters in the regular expression.
So in your case you want to put each person found into a single variable, separated by the | character, and then make the trigger match on it. Say the variable name is "friends" then the trigger will match:
@!friends
As for the rest, I would make a trigger that matches on "Member Hits Move " - this clears out the "friends" variable to be empty. Then enable another trigger that matches along the lines of what Flannel said.
Finally have a trigger that matches something else (if necessary) like the prompt line, that disables the second trigger. This might not be necessary, you could try and see.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Bradley
(7 posts) Bio
|
| Date
| Reply #3 on Fri 09 Jul 2004 12:13 PM (UTC) Amended on Fri 09 Jul 2004 01:18 PM (UTC) by Bradley
|
| Message
| Damn am I rusty as. Had a shot of it and here's what I came out with. Used some of the idea and muddled my way through it =)
Here's the trigger:
<trigger
enabled="y"
match="[ ]{2}(\w+)[ ]+(perfect|v.good|good|fair|bad|v.bad|awful)"
regexp="y"
script="Hilite"
send_to="12"
sequence="100"
>
<send>%1</send>
</trigger>
</triggers>
And here's the script
sub Hilite (strTriggerName, strTriggerLine, aryWildcards)
dim temp
temp = world.GetVariable("currentmember") + "|" + world.GetVariable("friendlist")
world.note "temp atm = " + temp
world.SetVariable "friendlist", temp
end sub
I lost you Nick on the @! bit.
Say you have a variable called friendlist with |Nick|Bradley|Flannel in it (which it is doing atm).
It sounds like by simply putting @!friendlist into the "Trigger" field when creating a Trigger in MushClient would make the trigger fire when Nick, Bradley or Flannel are mentioned. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #4 on Fri 09 Jul 2004 03:03 PM (UTC) |
| Message
| You are correct. the @ means basically "this is a variable" and itll substitute in whatever the contents of the variable are. (well, assuming "expand variables" is checked) and then the ! behind it means that it treats that variable as part of your regexp. so, basically @!friendlist would, in all practical purposes, substitute in the variable, and THEN try and match.
So yes, your last trigger would be @!friendlist (nothing else needed) with regexp, keep evaluating, repeat on same line, and expand variables.
Actually, you shouldnt have your initial | it should be name|name|name and you should have parenthesis around it (either make your trigger (@!friendlist) or make the variable (name|name|name) I would assume the former would be easiest. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | 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.
17,218 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top