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
➜ Converting triggers and what they mean
|
Converting triggers and what they mean
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| Hathcock
(49 posts) Bio
|
| Date
| Reply #15 on Thu 04 Dec 2003 08:57 PM (UTC) |
| Message
| When pasting the autoheal trigger, I get this error
Line 10: Element name must start with letter or underscore, but starts with "=" (problem in this file)
Thanks for the help, I'm sorry it made you run from your computer Shadowfyr. If I was able to find a system for this realm I would have bought it, but I haven't found one, so I'm forced to ask for everyone's help, since I'm practically computer illiterate. | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #16 on Thu 04 Dec 2003 10:28 PM (UTC) Amended on Thu 04 Dec 2003 10:30 PM (UTC) by Shadowfyr
|
| Message
| Hmm.. Creating it by hand and doing a copy I get:
<triggers>
<trigger
enabled="y"
match="H/:/d+ M/:/d+ B/:/d+/% /[eb/]"
regexp="y"
send_to="12"
>
<send>if %1 > LastHP then
LastHP = %1
else
if %1 / LastHP <= 0.5 then ' Check percentage of last highest HP.
send "heal" 'Send command hear.
end if
end if</send>
</trigger>
</triggers>
The problem if you compare them in that I used < instead of <, so the parser thought that it was the start of a new XML tag. Ooops!
As for Nick's idea.. Are you sure that would work Nick. It is a better option, but it still requires a regular expression and that means that * will probably still need to be made into \*. I could be wrong though. | | Top |
|
| Posted by
| Hathcock
(49 posts) Bio
|
| Date
| Reply #17 on Thu 04 Dec 2003 11:06 PM (UTC) |
| Message
| | If you are talking about the Prickly Stinging thing...it appears as I showed it....random letters in the first few words are replaced by astricts by the realm | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #18 on Thu 04 Dec 2003 11:11 PM (UTC) |
| Message
| Actually Shadowfyr, I believe that that IS a regex... the [] means "character class", so when you have a * inside that it doesn't have the same meaning. For example, [azjb*] means match on any one of a, z, j, b, or *.
The poor word "asterisk" has had enough mutilation in this thread... it's spelled asterisk. That poor word gets so banged up all over the Internet... :P |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #19 on Thu 04 Dec 2003 11:49 PM (UTC) |
| Message
| | The asterisk thing (prickey, etc) has shown up on another thread, instead of reinventing the wheel, search the forum for it... |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Hathcock
(49 posts) Bio
|
| Date
| Reply #20 on Fri 05 Dec 2003 04:57 AM (UTC) |
| Message
| | The autoheal trigger still doesn't work...I don't get any response from it, I tried to mess with it and make a wildcard after the H: but that just started an endless loop of drinking health. | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #21 on Fri 05 Dec 2003 06:48 PM (UTC) |
| Message
| Grr.. Stupid me.. I forgot to tell it which parts are returned... Try:
^H\:(\d+) M\:(\d+) B\:(\d+)\% \[eb\]
The () is used in regular expressions to both create a sub string for some special situations, but also to tell the regular expression parser which bits should be returned as a value. The above version should give you health as %1, magic as %2 and whatever B: is as %3. So it should work right. Oddly it should have matched anyway, but... Gah!! Just realized I had all the wrong \ characters in there... :p I keep confusing the damn things. lol Also, if the [eb] part changes in any way as you play, you may want to replace it with \[.*\] instead. ;)
Note: I also added the ^ character above. This is to prevent someone from sending you a tell or something containing text like>
Fred tells you: H:1 M:200 B:50% [eb] - Scary! I almost died..
This happens every once in a while on the mud I play and unless you use ^ to 'lock' your trigger to only things on a newline it can wreck havoc with triggers like this one. | | Top |
|
| Posted by
| Hathcock
(49 posts) Bio
|
| Date
| Reply #22 on Fri 05 Dec 2003 08:32 PM (UTC) |
| Message
| | wow, that worked great....but one problem, and this is my fault....I can only drink from the health vial once every few secinds...so when I go below the .5 it sends a loop that makes me drink my entire vial in a large spam of the trigger. Is there something I can add to stop it from looping itself like that so fast? Or atleast until I'm able to drink a second health vial? | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #23 on Fri 05 Dec 2003 08:53 PM (UTC) |
| Message
| Hmm.. You could change it to something like:
if %1 > LastHP then
LastHP = %1
else
if %1 / LastHP <= 0.5 then ' Check percentage of last highest HP.
if abs(datediff("s",ldrinktm,now)) > 2 then
send "heal" 'Send command hear.
ldrinktm = now
end if
end if
end if
This would mean that the first drink you take will set ldrinktm to the current time and day. The next prompt would then get as far as the 'if abs(datediff("s",ldrinktm,now)) > 2 then' line and skip over the command if at least 2 seconds haven't passed. The reason I use abs() is because I can never bloody remember which order the dang dates being compared need to be in. lol Just increase the '2' to how ever many second you need, not to mention the other changes you probably made to use it originally of course. ;) | | Top |
|
| Posted by
| Hathcock
(49 posts) Bio
|
| Date
| Reply #24 on Fri 05 Dec 2003 09:37 PM (UTC) |
| Message
| I'm really sorry to keep at this, but the autoheal still isn't working, for some reason it heals every time the config prompt comes up(H:580 M:670....) with a 2 second delay of course...is there a way to just do something like
trigger : H:(.*?)
send: if %1 < 2880
send "Heal"
anything simple like that? | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #25 on Sat 06 Dec 2003 12:20 AM (UTC) Amended on Sat 06 Dec 2003 12:46 AM (UTC) by Shadowfyr
|
| Message
| Hmm. I don't get why it is doing that... unless I got some code wrong. It should only heal if it drops under 50% of your maximum, not every time. The only reason it would not is if you used something that boosted you HP to more than double and that later dropped back to less than half of that max....
Also I am confused... Your previous statement was that you could only drink a potion to heal yourself every X seconds. This is an improved version of that, which will act in any case where your health is below the last 'normal' level, but it still acts on a delay. However, once you are completely healed it shouldn't continue to heal you:
<triggers>
<trigger
enabled="y"
match="^H\:(\d+) M\:(\d+) B\:(\d+)\% [.*]"
regexp="y"
send_to="12"
>
<send>if %1 > LastHP then
LastHP = %1
else
if %1 < LastHP then
if abs(datediff("s",ldrinktm,now)) > 2 then
send "heal"
ldrinktm = now
end if
end if
end if</send>
</trigger>
</triggers>
Yes, you can do what you asked though and simplify it to:
<triggers>
<trigger
enabled="y"
match="^H\:(\d+) M\:(\d+) B\:(\d+)\% [.*]"
regexp="y"
send_to="12"
>
<send>if %1 >= LastHP then
LastHP = %1
else
send "heal"
end if</send>
</trigger>
</triggers>
However, if you do that, then it is right back to healing you on 'every' single status prompt, even if you are currently unable to use a potion again, which is what you prevously said you wanted to avoid. It would be a heck of a lot easier if the prompt included something like H:500/2000, where you can see the maximum you are testing against, but...
You could however make an alias that set LastHP, so you can tell it what number to look for, however doing so means you need to remember to tell it what you max HP is every time you start, which the code above was supposed to avoid. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #26 on Mon 08 Dec 2003 06:31 AM (UTC) |
| Message
|
Quote:
As for Nick's idea.. Are you sure that would work Nick. It is a better option, but it still requires a regular expression and that means that * will probably still need to be made into \*. I could be wrong though.
Yep, I tried it, otherwise I would have thought the same thing. The * for multiples applies to a character or wildcard, but within the square brackets it is taken literally. Saves a few backslashes. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #27 on Thu 08 Jan 2004 10:38 PM (UTC) |
| Message
| I'd be curious to know what game this is for because it looks an awful lot like sylvanus at a quick glance...
| | 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.
96,470 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top