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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  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] Refresh page


Pages: 1 2  

Posted by Hathcock   (49 posts)  [Biography] bio
Date Wed 03 Dec 2003 10:27 PM (UTC)
Message
I'm very thankful for all the help I've received, especially from Shadowfyr. I've figured out how to convert most of the triggers using the examples given, but there are a few that have me completly lost again....and I was wondering why they were written this way...for what reason?

This first one is because of a problem I guess in the game were a random letter or two is replaced with an astric within the word. I tried a couple ways of converting using the regular expressions table in the help files, but i kept saying I had errors when I tried to paste it.

#TRIGGER {{A|*}{*| }{*|p}{r|*}{*|i}{c|*}{k|*}{l|*}{y|*}{*| }{s|*}{t|*}{i|*}{n|*}{g|*}} {eb;#var frenzy 1;#t- Attacks;#cw red}

This next one really has me confused, I don't even know what it is used for, but it seems important

#TRIGGER {^You may eat another plant.$} {bal;#if {@stupid=1} {herb= Goldenseal (Stupidity)} ;#if {@goldenseal=1} {herb= Goldenseal};#if {@bloodroot=1} {herb= Bloodroot};#if {@kelp=1} {herb= Kelp};#if {@lobelia=1} {herb= Lobelia} ;#if {@ginseng=1} {herb= Ginseng};#if {@ash=1} {herb= Ash};#if {@bellwort=1} {herb= Bellwort};#cw 13}

This last one looks like the above, to me atleast, just alot shorter....what is up with all the herbbalance = 0 stuff?

#TRIGGER {You eat a bloodroot leaf.$The plant has no effect.} {#var bloodroot 1;herb= Bloodroot}


Anyone able to help I'd be appreciative as always, thanks
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Wed 03 Dec 2003 10:46 PM (UTC)
Message
It's rather difficult to tell what these are meant to do taken out of context, but here are a few thoughts...

The first one seems to be matching on "a prickly sting" - now why there are all those other things in there, I don't know. It depends completely on the output of your MUD, so it's impossible to tell why it's there without seeing sample output. In any case it seems to be sending the command "eb" and setting variable frenzy to 1, and then turning off trigger group attacks? (?) And then doing #cw red, whatever that means.

It's hard to help you with the second one if you're not sure what it even does :)
It seems that it's just setting up the variable "herb" depending on a whole bunch of conditions.

I don't really know enough about zMUD syntax to translate all this meaningfully. Again, it's also very difficult to tell what it's supposed to do without any context... it's like trying to translate something from a foreign language to English, but without speaking the foreign language nor knowing what the text is supposed to say...

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 Reply #2 on Wed 03 Dec 2003 10:52 PM (UTC)
Message
for the first one, here is an example of what I see...the missing letter is usually different each time.

A prickly st*n*ing over*helms your body, fading away into numbness.

What is a variable used for? You mentioned herb variable?
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Reply #3 on Wed 03 Dec 2003 11:02 PM (UTC)
Message
I noticed also that sometimes when I paste a triiger, that it doesn't set it as a regular expression like most of the other are....should they all be regular expressions or do I just leave it be?
[Go to top] top

Posted by Hathcock   (49 posts)  [Biography] bio
Date Reply #4 on Wed 03 Dec 2003 11:35 PM (UTC)
Message
if I have it set up to keep attacking every time I regain balance, is there a way I have have a trigger that goes off once I reach a certain amount of heaklth, to mend myself?
this is what the config promt thing looks like

H:546 M:860 B:100% [eb]
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #5 on Thu 04 Dec 2003 12:43 AM (UTC)
Message
Ok. First trigger.. You didn't read one of my previous explainations too well. * is not an asterix in either type of trigger. You can't use it at all in a normal trigger and in a regular expression it means "more than one of the prior character or group". Since | is an "OR", there is no character or group for it to look for more than one of. I have no idea why this works in zMud, except that zMud often doesn't correctly follow its own standards sometimes, let alone anyone elses. However, at a guess, I suspect that the use of {} in zMud is a way to include "|" commands without using regular expressions. The correct form in mushclient would be:

(A|\*)(\*| )(\*|p)(r|\*)(\*|i)(c|\*)(k|\*)(l|\*){y|\*)(\*| )(s|\*)(t|\*)(i|\*)(n|\*)(g|\*)

and set it as a regular expression. In this case '\' tells the regular expression parser to treat the next character as a 'real' one and not a command. So \* would be a literal * and not a request to look for more that one of something.

The rest is like this:

send "eb"
frenzy = 1
enablegroup "Attacks", 0

Note we completely ignore the #VAR command. In zMud this is the same as saying DIM in VB. VBSCript will automatically create a variable as soon as used, so this is redundant. Instead we simply set frenzy = 1 and VBScript handles the rest.

It also uses a ColorWord command. Seeing how it is used here, I now suspect this is the equivalent of setting a color trigger in this case. Which is to say that the trigger turns the line with the "A prickly sting" on it red. The other triggers I helped you with send an error, then set the color of "that" line to red, or so I think... If you use the "Change colour and style" in the trigger in 'Edit' or 'Add' to use red (Either the custom color that is red or using "Other.." and selecting red for the foreground). This will color the words red, as I assume the original was supposed to.

Now as for the second one.. I just love scripting that crams every bloody thing on one line, so lets shift stuff around a bit so it makes more sense first:

TRIGGER {^You may eat another plant.$} {
  bal;
  #if {@stupid=1} {herb= Goldenseal (Stupidity)} ;
  #if {@goldenseal=1} {herb= Goldenseal};
  #if {@bloodroot=1} {herb= Bloodroot};
  #if {@kelp=1} {herb= Kelp};
  #if {@lobelia=1} {herb= Lobelia} ;
  #if {@ginseng=1} {herb= Ginseng};
  #if {@ash=1} {herb= Ash};
  #if {@bellwort=1} {herb= Bellwort};
  #cw 13
}

That's better. ;) Now we can see what it really does. And can make a trigger that works as intended:

<trigger
  match="^You may eat another plant.$"
  regexp="y"
  enabled="y"
  send_to="12"
  custom_colour="17"
  other_text_colour="fuchsia"
  other_back_colour="black">
  <send>send &quot;bal&quot;
if stupid = 1 then
  herb = "Goldenseal (Stupidity)"
end if
if goldenseal = 1 then
  herb= "Goldenseal"
end if
if bloodroot = 1
  herb = "Bloodroot"
end if
if kelp = 1 then
  herb = "Kelp"
end if
if lobelia = 1 then
  herb= Lobelia
end if
if ginseng = 1 then
  herb= Ginseng
end if
if ash = 1 then
  herb= Ash
end if
if bellwort = 1 then
  herb= Bellwort
end if</send>
</trigger>

A few explainations. I could have used custom_colour="13" and for most people it would be the same. However, since custom color can be changed, it is safer to use the equivalent 'real' color to the original ANSI. In this case the 'real' color that corresponds to bright-magenta is Fuchsia. By using custom_color="17", which is the same as setting it to "Other..." in the trigger editing dialog, you can specify any color you want, even of the set of 16 custom colors are completely changed from the normal ANSI colors. On my client only 2-3 of those colors are still the originals and color 13 would have ended up Orange.

The third one also uses #VAR. Again, just ignore this and make it bloodroot = 1. Note also that we place "" around strings. zMud uses @ to refer to the 'contents' of a variable and apparently leaving that off means it assumes that you are assigning a string to a variable. This isn't exactly consistant with any other language I know of. lol

Also, with the third trigger you will see that they use $ in it. This means that what it is literally looking for is:

You eat a bloodroot leaf.
The plant has no effect.

Mushclient "cannot" match multiple lines, so this gets complicated. You need two triggers. The first on needs to set a variable to tell the second trigger that it was a bloodroot that you used. If there are more than one of these triggers that match two lines, then things are bound to become a mess. However, the solution would be like:

<trigger
  match="You eat a bloodroot leaf."
  enabled="y"
  sent_to="12">
  <send>herbeaten = "bloodroot"</send>
</trigger>

<trigger
  match="You eat a goldenseal flower."
  enabled="y"
  sent_to="12">
  <send>herbeaten = "goldenseal"</send>
</trigger>

<trigger
  match="The plant has no effect."
  enabled="y"
  send_to="12">
  <send>select case herbeaten
  case "bloodroot"
    bloodroot = 1
    herb = "bloodroot"
  case "goldenseal"
    goldenseal = 1
    herb = "goldenseal"
end select</send>

The goldenseal trigger and "case" are examples and may differ for the triggers you are converting. However, they should give you an idea what I mean. Each trigger for the first line has to 'tell' the trigger for the second line what you just ate and the "case" sections in there handle setting the correct variables for each herb type. Simple. ;)
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #6 on Thu 04 Dec 2003 01:48 AM (UTC)
Message
I think, actually, that the * in the expression is actually used as the * wildcard, much like it would be in DOS or explorer searching or something.

To emulate that using "real" (quote, not emphasis, Shadowfyr :P) regular expressions, you'd want to do ".*", where the . is what's called a "metacharacter" which means, basically, "any character".

I think that even if you manage to do dumb conversions like this (I don't mean dumb as in stupid, but as in blind/mechanical) it's quite possible that your system will end up still not working. Much better would be to know what your system does, and then emulate that. It seems that the idea is simple enough, and should be feasible in just an hour's or so work. But if you (or someone else, for that matter) make a mistake during this dumb conversion you can easily mess up your system and introduce subtle errors without even knowing it.

I've never heard of purchasing a trigger package... what kind of deal is that? People actually make money selling triggers? Pfft...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #7 on Thu 04 Dec 2003 01:53 AM (UTC)
Message
Another note: you can't just copy/paste zMUD triggers into MUSHclient because the two applications use different formats. It's a little like copy/pasting C code into a Java compiler.

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 Reply #8 on Thu 04 Dec 2003 02:52 AM (UTC)
Message
How do I write this as a trigger with wildcards before and after it...

gathering momentum as {he|she} bears


Also, how do I set up Autoheal?
this is what my prompt looks like

H:546 M:860 B:100% [eb]
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #9 on Thu 04 Dec 2003 03:02 AM (UTC)
Message
I believe writing:
gathering momentum as * bears
would be sufficient. Only problem is that the wildcard could match on more than just he/she, but I'm not sure how much of a problem that is.

I think the right way using regular expressions would be:
gathering momentum as (he|she) bears

I don't think you need left and right parts, but if you do, those would be something like:
$.*gathering momentum as (he|she) bears.*^

I might have mixed up $ and ^... I take them to mean respectively "beginning of line" and "end of line" but it might be the other way around.

Matching prompts is a little tricky due to some newline problems; you can do a search on the forum for prompt and newline and see what you come up with. :) Basically the problem is that since newlines don't come after the prompt, you don't know you've received the prompt until the line finishes - either when you receive something new or when you type something yourself.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #10 on Thu 04 Dec 2003 03:54 PM (UTC)
Message
Man, one of you people who play that mud has got to come up with a plugin you can just share amongst yourselves. Heh... ;)

Do a search of the mushclient forums on the word "goldenseal" and about 6 or 7 threads show up.

That whole thing with the astericks in a phrase (Done to prevent triggering, by the mud admins), there's been a couple of threads on that too, although, unfortunately, I can't think of what keywords might bring up the threads in a search.

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

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #11 on Thu 04 Dec 2003 05:19 PM (UTC)
Message
Yes Ksilyan, you got the ^ and $ backwards. As for the "*" issue. Like Magnum said, this is intended to be an anti-trigger feature (not that it works), but I am 99.9% sure that using {} in zMud, instead of () means 'treat these as literal strings'. A wildcard in those places would be ineffective, since it would match on literally any line at all. In other words, using a wildcard in there, instead of a literal you net you a trigger equivalent to "***************" Any line 15 characters or more in length would cause it to trigger. This make is quite obvious that they intended the * in that trigger to be literals, not wildcards.

As for you autoheal:

<trigger
  match="H/:/d+ M/:/d+ B/:/d+/% /[eb/]"
  enabled="y"
  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>

Your prompt doesn't provide the original maximum and you don't mention what command you use to heal, so the above is a best guess. You will need to replace "heal" with whatever you actually use to heal yourself. Also, the 0.5 means '50%', so if you want to heal at a different point, you need to also change that. One change you may want to make is to replace the 0.5 with getvariable("HealPercent"), then add an alias like:

<alias
  match="setheal *"
  enabled="y"
  send_to="12">
  <send>setvariable "HealPercent", %1
note "You will now auto-heal at: " & %1 * 100 & "%."
save ""</send>
<alias>

This will set a variable that is internal to the client and thus is saved 'in' the world file. Everything I have used so far are script variables, whose values vanish as soon as the script closes. A world variable, if the world is saved properly, will persist from one to session to the next. The 'save ""' line will save the entire worlds settings, including the variable you just changed.

In plugins, this is handled a bit differently. By setting the plugin's save_state setting to "y", Mushclient automatically updates a special file that stores variables, every time you change one. This works like an automatic version of 'save ""' for plugins, though the values are not stored in the plugin itself. The reason being that state files are files named with WorldID-PluginID.XML. This allows each character(world file) to use the same plugins, but completely different settings. Had you provided a complete list of things you needed, and it didn't immediately send me screaming away from the computer, I would have likely created such a plugin instead. However, had you dropped the whole mess in our laps I would probably not have touched it with a ten foot pole. I hate zMud's script engine with a passion. ;) lol
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #12 on Thu 04 Dec 2003 06:08 PM (UTC)
Message
I'm not sure at all about what you say concerning the first one, Shadowfyr, the one with the prickly sting, because he posted that the output is something like:

Quote:

for the first one, here is an example of what I see...the missing letter is usually different each time.

A prickly st*n*ing over*helms your body, fading away into numbness.


Where the stars represent changeable letters.

So, "this makes it quite obvious" (echo... :P) that what the trigger is doing is allowing every single letter to either be what it should be, or be a star. Assuming, of course, that that output is actual output, and that the stars represent variable letters.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #13 on Thu 04 Dec 2003 07:53 PM (UTC)
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

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Thu 04 Dec 2003 08:47 PM (UTC)
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

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.


63,102 views.

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

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.

[Home]


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 HostDash]