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
➜ Tips and tricks
➜ Triggers to match with optional prompt
Triggers to match with optional prompt
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| PJ
USA (48 posts) Bio
|
Date
| Wed 01 Jan 2003 12:19 AM (UTC) |
Message
| (Dont need help, just a tip)
When I use triggers to 'train' certain skills, sometimes my prompt is in front of it, and sometimes it's not, ex:
<100hp 100m 100mv> Your proficiency at blind is 50%
AND
<100hp 100m 100mv>
The day has just begun.
Your proficiency at blind is 50%
I could make a trigger for "* Your proficiency at blind is *" and another for "Your proficiency at blind is *" and have them both send "Cast Blind Dog"
But the more efficient way that I figured out after a bit was "* proficiency at blind is *" so that the first asterisk could either be the prompt and "Your" or just "Your"
Try this for lots of different triggers that seem to only work some of the time... | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #1 on Wed 01 Jan 2003 03:51 AM (UTC) |
Message
| Try making it a regular expression and use:
^(<.*> )?Your proficiency at .* is .*
Basically .* is the same as * in normal triggers, while ^ makes it match on the start of a line only, () creates a 'sub-group' and ? says, 'match this group if it is missing or if it is there one time'. It should match whether the prompt is there or not. ;) | Top |
|
Posted by
| PJ
USA (48 posts) Bio
|
Date
| Reply #2 on Wed 01 Jan 2003 08:04 PM (UTC) |
Message
| Alright, more complicated than mine but pre-made, thanks.. | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #3 on Fri 03 Jan 2003 05:03 PM (UTC) |
Message
| If you are doing something like writing a plugin, you might try an approach like this:
- Create a regular expression that matches your prompt (but don't use the endline symbol).
- Put the regular expression into an XML entity.
- Use the Entity in your trigger code (in the XML file).
By just putting the prompt expression in one place, you allow for relatively easy editing, should that task be required.
One option Nick might consider is allowing for the same, using the Trigger GUI. A field could be established where the user inputs the regular expression that matches their prompt. They could then use one or two new checkboxes in the individual trigger edit screen, perhaps like "[x] Ignore prompt on same line"
Also, a method could be devised where you might put a symbol to indicate you want to use the prompt expression, for example:
Match: %prompt A new day has begun.
Hmm, I forsee a problem with that, since there is an additional space character after the "variable" that you may not want, but can't avoid. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #4 on Fri 03 Jan 2003 06:32 PM (UTC) Amended on Fri 03 Jan 2003 06:38 PM (UTC) by Shadowfyr
|
Message
| You can always use something like %prompt% instead, as in start and end of entity. That way the system knows where it ends. it would probably be better to just have a special trigger named prompt and a setting in all other triggers like: 'Test for Prompt []' If a trigger had this then it could automatically add the prompt you defined to the trigger matching text when finding one. A second option 'Exclude matched Prompt []' would let you return 'only' the part of the line that was found 'after' the prompt, as though there wasn't one there and wildcards would be adjusted accordingly to contain only the wildcard matches of the trigger, not the prompt detected. At least in theory.. | 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,613 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top