[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Simple trigger - little help needed
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Simple trigger - little help needed

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

Posted by English Lad   (4 posts)  [Biography] bio
Date Sat 18 Oct 2008 07:38 PM (UTC)
Hi all.

What i want to do should be pretty easy, so i'm sure i'm just unable to locate the right helpfile, have spent a little while looking.

Basic principal is a trigger to bless items for other people, and hand them back to people.

Triggering off: * gives you *
In the trigger then is;
c bless %2
give %2 %1

This works fine when the item i'm given only has one word in the short description eg apple.

It does this Bob gives you apple.
c bless apple
give apple bob.

The problem is when the short description has two or more words eg red apple.

Bob gives you red apple
c bless red apple - Works fine
give red apple bob - Doesn't work, as the mud tried to give red to apple.

have tried putting the information in ' and " but the problem is then the mud doesn't recognise the item at all.

What should solve the problem is make the * in the original trigger only pick up the 1st word, but despite trawling helpfiles i couldn't get it to.

What am I missing?
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Sat 18 Oct 2008 07:47 PM (UTC)
Try using the following regular expression (select the Regular Expression box):

^(\w+) gives you ((\w+)(?: .*)?)$

Short explanation:
^ means beginning of line.
(\w+) means one word of one or more characters which is captured with () into %1.
(...) captures the stuff inbetween into %2
(\w+) same as above, for %3.
(?: .*)? optionally takes the remainder of a line.
$ means end of line.

You can use that in combination with:

c bless %2
give %3 %1

This way, the bless-cast will still use the full item name.
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #2 on Sat 18 Oct 2008 08:36 PM (UTC)
There's a problem with the above. It will end up sending "give red bob". The problem with making a trigger is knowing where the noun is. How can we systematically deduce if bob's giving you a "red apple" or "sword of slaying"?

I'd suggest seeing if your mud have a more verbose way to give things. i.e. "give red apple to bob"
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 19 Oct 2008 03:18 AM (UTC)
Can't you do something like:

give "%2" %1

That way you quote the thing that is being given. (the red apple).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by English Lad   (4 posts)  [Biography] bio
Date Reply #4 on Mon 20 Oct 2008 01:10 PM (UTC)

Amended on Mon 20 Oct 2008 02:35 PM (UTC) by English Lad

Ok well it was simpler than i thought when i worked it out.

Unfortunately the MUD doesn't recognise the item with " around it, but what i did was this

* gives you * * *
c bless %3
give %3 %1

The 1st * is obviously the person's name, the second 1 picks up a an the some etc..... the third picks up the 1st word in the items short description, but because there is a fourth (which i don't use) it doesn't pick up the rest of the short desc.

This isn't perfect, as some items has a short desc format that doesn't fit, and some items don't have the 1st word in the short desc as a keyword, but it works for 95% of the stuff i need to use it on. What i'm doing is producing a list of items, as and when they come up, that don't have the 1st word as a keyword, and making a trigger just for them, which should in time pick them all up.

Thanks all


Ok slightly new problem - I knew from the start that their would be items that wouldn't work, as the 1st word in their short desc wouldn't be a keyword. My plan was that when I came across these I would make a trigger for each.


Bob gives you a red apple - Doesn't work if the red apple doesn't have red as a keyword.

There are only a few of these so what i would do is, when i find one make a trigger for it individually. Rather than using:

* gives you * * *

I would use

* gives you a red apple.
and then gave the output as give %1 apple.

These are all obviously made by hand, to get around the problem of the short desc not matching the keyword. The problem i'm having is that the original trigger runs, not the new one i've made specifically for that item, as it still matches the criteria with the wild cards. Is there anyway to make it so that the individual triggers for unsual items take prescedence over the general all purpose one?
[Go to top] top

Posted by Cage_fire_2000   USA  (119 posts)  [Biography] bio
Date Reply #5 on Mon 20 Oct 2008 07:36 PM (UTC)
Yes, there is. It's very easy. In the trigger dialog box(as well as the aliases) there is a box labeled 'sequence' this is the priority of the trigger, the lower the number the earlier it'll be checked, so just change the sequence number to something lower than that of your general trigger. Like 99 for example. You can put all the custom triggers at 99 and as long as the general one is at 100, the custom ones will be checked first, and as long as you don't have 'keep evaluating' checked it will stop with the first one that matches. Alternatively you could just raise the sequence number of the general trigger.
[Go to top] 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.


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

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]