|
Fergal1982 Wanderer
Joined: 08 Aug 2005 Posts: 70
|
Posted: Sun Sep 10, 2006 10:43 am
Activation of a Trigger |
Hey guys. wonder if you could help with this.
I have created a trigger to complete two commands (get beef from oven, put beef in packpack) when the item displays as cooked. The output im seeing is:
Quote: |
1880/1880h 235/235m 50xp >
You run your eye over an old oven.
The oven has seen better days, it shows signs of frequent use, its owner
obviously not very concerned with cleanliness, as it is covered in rust and
grime. You wonder if it still works. An old oven is burning brightly.
Some prepared beef, "beef25726".
Some prepared beef, "beef25727".
Roast beef, "beef25723".
1880/1880h 235/235m 50xp > |
The trigger ive set up is
[quote]#TR {^Roast beef, %s "(%a)".}{Get %1 from oven
put %1 in backpack21546}
This works fantastically, but the problem is that if i examine the packpack, the triggers kick off. output from the examine is:
Quote: |
1880/1880h 235/235m 50xp >
You run your eye over a backpack.
The constant companion of any serious traveller, the backpack has been
designed to carry the heaviest of loads with the minimum discomfort. It has a
waterproof cover to protect your valuable possessions during any sudden
typhoon, monsoon, or indeed, small tidal waves. The carry straps are made to
fit the individual to allow for maximum arm movement. A backpack is nearly
full.
Roast beef, "beef8496".
Roast beef, "beef14307".
Roast beef, "beef18106".
Roast beef, "beef19213".
1880/1880h 235/235m 50xp > |
Just a bit of background on this - the MUD is providing the line-breaks, rather than it being controlled by ZMUD.
Thanks
Fergal
EDIT: is doesnt seem to display properly here, but there are a good few spaces between "roast beef," and "beef25723" - hence the %s |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Sun Sep 10, 2006 2:11 pm |
You run your eye over an old oven.
You run your eye over a backpack.
Since those are constant, make a trigger for oven that turns the beef trigger on
Name the roast beef trigger.
After the roast beef trigger hits, turn it back off.
all this is done with the #t+ "roastbeef" (for on) and #t- "roastbeef" (for off) |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Sep 10, 2006 6:51 pm |
Use [ Code] tags instead of [ Quote] to preserve your spacing
I would use a multistate trigger with a temp trigger
#TRIGGER "gotbeef" {^You run your eye over an old oven.} {#TEMP "gotbeefend" {^%d/%d} {#STATE gotbeef 0} {prompt|nocr}}
#COND {^Roast beef, %s "(%a)".} {
Get %1 from oven
put %1 in backpack21546
} {manual}
Used Pretty Print
Syntax Colourizer |
|
|
|
Fergal1982 Wanderer
Joined: 08 Aug 2005 Posts: 70
|
Posted: Sun Sep 10, 2006 11:38 pm |
would you mind explaining that code nexela? i dont fully understand what its all doing.
Thanks
Fergal |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Sep 11, 2006 5:00 am |
Any time you look in an oven the trigger advances and it grabs all the roast beef it sees and then resets itself using the #TEMP trigger next time you see the prompt, other wise it would only grab 1 roast beef every time you looked in the oven.
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Wed Sep 13, 2006 12:07 am |
You could also use a Duration condition instead of a Temp, just a personal preference thing in this case... Duration triggers will sometimes fail if you have very very heavy lag but it's usually not a big deal for something like this, and you can set it depending on how picky you want it to be/how much lag you normally have. This, for example, will do "get beef" every time it sees the beef line within 1 second of seeing the oven line.
Code: |
#REGEX {^You run your eye over an old oven\.$} {}
#COND {^Some prepared beef, "beef\d+"\.$} {get beef from oven} {dur|param=1000|regex} |
http://www.zuggsoft.com/library/trigadv.htm explains the various advanced trigger/condition types. |
|
|
|
Fergal1982 Wanderer
Joined: 08 Aug 2005 Posts: 70
|
Posted: Fri Sep 15, 2006 7:59 pm |
im confused.
This script works perfectly, but im trying to modify it for the following:
Code: |
1505/1880h 235/235m 75xp >
You run your eye over a frying pan.
The frying pan has been fashioned from iron, and consists of a shallow,
circular bowl with a long handle attached to one side, the handle long enough
that you could easily hold the frying pan over an open fire without risking
burning yourself. A frying pan is empty.
16 sips of olive oil, "oil24259".
Some fried venison, "venison25894".
1505/1880h 235/235m 75xp > |
so i used:
Code: |
#TRIGGER "friedvenison" {^You run your eye over a frying pan.} {#TEMP "friedvenison" {^%d/%d} {#STATE friedvenison 0} {prompt|nocr}}
#COND {^Some fried venison, %s "(%a)".} {
Get %1 from pan
put %1 in backpack21546
} {manual} |
but it doesnt appear to be working. where am i going wrong?
Thanks
Fergal |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Sep 15, 2006 11:16 pm |
@gamma_ray:
Good call on the duration never thought of that myself, might be time to do a few rewrites :P
@Fergal1982
first I would go with Gamma_ray's version of the script, second the problem is assigning both triggers the "friedvenison" ID, the temp trigger is overwriting the actuall trigger. Notice on my version that the TEMP trigger ID is "gotbeefend" and the ID for the oven trigger is "gotbeef" |
|
|
|
|
|