Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
The_Droz
Newbie


Joined: 30 Oct 2004
Posts: 8

PostPosted: 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.
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: 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.
Reply with quote
The_Droz
Newbie


Joined: 30 Oct 2004
Posts: 8

PostPosted: 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"
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base

Last edited by nexela on Sun Nov 28, 2004 10:28 am; edited 1 time in total
Reply with quote
The_Droz
Newbie


Joined: 30 Oct 2004
Posts: 8

PostPosted: 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! Very Happy
Reply with quote
The_Droz
Newbie


Joined: 30 Oct 2004
Posts: 8

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net