Register forum user name Search FAQ

Gammon Forum

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 ➜ help with *

help with *

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


Posted by Cargo   Canada  (7 posts)  Bio
Date Tue 08 Apr 2008 07:18 AM (UTC)
Message
hey i have a question.
i have a trigger from when a group mate comes back when they tell the group back i tell the group "welcome back <name>"
is there a way i can make it so * signifies only one word and not just anything before * tells the group, 'back'.
example of what it is:

joe schmoe from idaho tells the group, 'back'
you tell the group, 'welcome back joe schmoe from idaho!'

example of what i want:
joe schmoe from idaho tells the group, 'back'
you tell the group, 'welcome back idaho!'

any ideas would be appreciated
Top

Posted by Cargo   Canada  (7 posts)  Bio
Date Reply #1 on Tue 08 Apr 2008 07:20 AM (UTC)
Message
ps: this is just a general example, first thing that popped into my head.
Top

Posted by SKYY   (28 posts)  Bio
Date Reply #2 on Tue 08 Apr 2008 08:49 PM (UTC)

Amended on Tue 08 Apr 2008 08:54 PM (UTC) by SKYY

Message
<triggers>
<trigger
enabled="y"
match="^(\w*) tells the group, 'back'$"
regexp="y"
sequence="100"
>
<send>gt welcome back %1</send>
</trigger>
</triggers>
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 08 Apr 2008 09:07 PM (UTC)

Amended on Tue 08 Apr 2008 09:09 PM (UTC) by Nick Gammon

Message
Quote:

joe schmoe from idaho tells the group, 'back'
you tell the group, 'welcome back idaho!'


Do you really mean: 'welcome back joe!' ?

That would make a bit more sense.

In that case I would agree with Skyy but with an amendment:


<triggers>
  <trigger
   enabled="y"
   match="^(\w+) (.* )?tells the group, 'back'$"
   regexp="y"
   sequence="100"
  >
  <send>gt welcome back %1</send>
  </trigger>
</triggers>


This is now a regular expression. See http://www.mushclient.com/regexp for more details about regular expressios.

Anyway, first it looks for a word (\w+) which would be the person's name (eg. Joe), followed by a space, and then other stuff (.* )? which is optional, and then "tells the group, 'back'".

See http://www.mushclient.com/pasting for how to copy that into the client.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #4 on Tue 08 Apr 2008 09:11 PM (UTC)
Message
http://www.gammon.com.au/mushclient/regexp.htm

That link will explain regular expressions. What Skyy posted will work perfectly fine, but I would use ="^(\w+) tells the group, 'back'$" so that it will not match " tells the group, 'back'$"

Also, when creating regular expressions, you can test them with this website: http://www.nvcc.edu/home/drodgers/CEU/Resources/test_regexp.asp

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #5 on Tue 08 Apr 2008 09:12 PM (UTC)
Message
Bah, curse Nick for being up at a ridiculous hour and posting helpful information while I'm working and posting.

Makes my posts seem redundant :p

It is much easier to fight for one's ideals than to live up to them.
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.


20,951 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.