|
The_Droz Newbie
Joined: 30 Oct 2004 Posts: 8
|
Posted: Fri Nov 26, 2004 4:03 pm
Help with list in trigger |
OK I have a trigger set up to feed me when i am hungry or drink when i am thirsty. The mud i play on has four diffrent things it says for each thing
Mud says when Hungry:
You are a mite peckish
You are hungry
You are famished
You are STARVING
Mud says when Thirsty:
You could use a sip of something refreshing
You are parched
You are thirsty
You are DYING of THIRST
So I wrote these two triggers to auto feed and auto drink
Feeding
#TRIGGER "autoeatwake" {^You are {a mite peckish|hungry|famished|STARVING}} {#IF (@FdAmt<=0) {#ECHO %ansi( high, red)You are out of food!;#ECHO %ansi( bold, red) Auto eating shutting down!;#VARIABLE FdAmt 0;#T- autoeatsleep;#T- autoeatwake} {get 2 @food @Con2;#2 eat @food;#MATH FdAmt @FdAmt-2}} "Feeding|WakeFeed"
Drinking
#TRIGGER "autodrinkwake" {^You {could use a sip of something refreshing|are parched|are thirsty|are DYING of THIRST}} {#IF (@DrAmt<=0) {#ECHO %ansi( high, red)Your Container is empty.;#ECHO %ansi( bold, red) Auto drink shutting down!!;#VARIABLE DrAmt 0;#T- autodrinkwake;#T- autodrinkwake} {get @drinkcon @Con2;#2 drink @drinkcon;put @drinkcon @Con2;#MATH DrAmt @DrAmt-2}} "Feeding|WakeFeed"
What i am looking for is if the fourth option in the list (You are STARVING or You are DYING of THIRST) comes in it excutes a diffrent command that eats and drink till full. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Fri Nov 26, 2004 5:37 pm |
Hmm.. I don't know if zMUD saves whatever it matched with in that list in %1, but if you cannot access STARVING from %1, you can always use %line or %trigger and make a check with IF %trigger == "You are STARVING" for instance, and that way then execute the command you wanted. Hope that helps.
|
|
|
|
The_Droz Newbie
Joined: 30 Oct 2004 Posts: 8
|
Posted: Sat Nov 27, 2004 6:15 am |
ok i rewrote the trigger like this and it doesn't work could i get some help debugging this monster
#TRIGGER "autodrinkwake" {^You {could use a sip of something refreshing|are parched|are thirsty|are DYING of THIRST}} {#IF (@DrAmt<=0) {#ECHO %ansi( high, red)Your Container is empty.;#ECHO %ansi( bold, red) Auto Drinking Shutting Down!!;#VARIABLE DrAmt 0;#T- autodrinkwake;#T- autodrinkwake} {#IF (%line =="You are DYING of THIRST(*)") {get @drinkcon @Con2;#4 drink @drinkcon;put @drinkcon @Con2;#MATH DrAmt @DrAmt-4} {get @drinkcon @Con2;#2 drink @drinkcon;put @drinkcon @Con2;#MATH DrAmt @DrAmt-2}} "Feeding|WakeFeed" |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Nov 27, 2004 6:52 am |
Surround your pattern group with () then you can include an if statement There are other ways to do this also this is just the simplest.
#TRIGGER "autoeatwake" {^You are ({a mite peckish|hungry|famished|STARVING})} {
#IF (@FdAmt<=0) {
#ECHO %ansi( high, red)You are out of food!
#ECHO %ansi( bold, red) Auto eating shutting down!
#VARIABLE FdAmt 0
#T- autoeatsleep
#T- autoeatwake
} {
#IF ("%1"="STARVING") {#ECHO commands to eat until full here} {
get 2 @food @Con2
#2 eat @food
#MATH FdAmt @FdAmt-2
}
}
} "Feeding|WakeFeed"
Used Pretty Print
Syntax Colourizer
EDIT: General bug fixes from the Colourizer |
|
|
|
The_Droz Newbie
Joined: 30 Oct 2004 Posts: 8
|
Posted: Sat Nov 27, 2004 9:08 am |
ok got it in and had to muck with it just a little but works pretty good. Thank you!
|
|
|
|
The_Droz Newbie
Joined: 30 Oct 2004 Posts: 8
|
Posted: Sat Nov 27, 2004 9:10 am |
nexela hey if you have a momment or the time could you show me one of those other ways. I am just interested to see thats all.
|
|
|
|
|
|