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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Converting triggers and what they mean

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Converting triggers and what they mean
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by WRTIII   Canada  (76 posts)  [Biography] bio
Date Thu 08 Jan 2004 10:38 PM (UTC)  quote  ]
Message
I'd be curious to know what game this is for because it looks an awful lot like sylvanus at a quick glance...
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 08 Dec 2003 06:31 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Sat 06 Dec 2003 12:20 AM (UTC)  quote  ]

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 &gt; LastHP then
  LastHP = %1
else
  if %1 &lt; LastHP then
    if abs(datediff(&quot;s&quot;,ldrinktm,now)) &gt; 2 then
      send &quot;heal&quot;
      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 &gt;= LastHP then
  LastHP = %1
else
  send &quot;heal&quot;
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.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Fri 05 Dec 2003 09:37 PM (UTC)  quote  ]
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?
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Fri 05 Dec 2003 08:53 PM (UTC)  quote  ]
Message
Hmm.. You could change it to something like:

if %1 &gt; LastHP then
  LastHP = %1
else
  if %1 / LastHP &lt;= 0.5 then ' Check percentage of last highest HP.
    if abs(datediff("s",ldrinktm,now)) > 2 then
      send &quot;heal&quot; '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. ;)

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Fri 05 Dec 2003 08:32 PM (UTC)  quote  ]
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?
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Fri 05 Dec 2003 06:48 PM (UTC)  quote  ]
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.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Fri 05 Dec 2003 04:57 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Thu 04 Dec 2003 11:49 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Thu 04 Dec 2003 11:11 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Thu 04 Dec 2003 11:06 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Thu 04 Dec 2003 10:28 PM (UTC)  quote  ]

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 &gt; LastHP then
  LastHP = %1
else
  if %1 / LastHP &lt;= 0.5 then ' Check percentage of last highest HP.
    send &quot;heal&quot; 'Send command hear.
  end if
end if</send>
  </trigger>
</triggers>

The problem if you compare them in that I used < instead of &lt;, 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.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Thu 04 Dec 2003 08:57 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 04 Dec 2003 08:47 PM (UTC)  quote  ]
Message
You might be able to match on the optional asterisks in a more readable way:


A [p*][r*][i*][c*][k*][l*][y*] .*


Each of the things in square brackets is an alternative letter to match on, so it is a bit easier to read what the word is.

- Nick Gammon

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

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Thu 04 Dec 2003 07:53 PM (UTC)  quote  ]
Message
See this thread for how to build a trigger that gets around anti-trigger lines that uses astericks in random places:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2544

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[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.


7,174 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]