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
ohmford
Newbie


Joined: 23 Mar 2004
Posts: 3
Location: USA

PostPosted: Tue Mar 23, 2004 6:46 am   

Upgrade to 7x broke triggers
 
I have run a few searches and was unable to come up with anything. So maybe someone can assist. These triggers use to work I have used them for many many years.

Example:
(Output on my screen)
John says, 'heal'

(My actions)
Checks to see if I am sitting/resting if so stands up. If not goes on to next command. Casts heal on John if John is a member of my budlist.

Code:

Pattern: ^([a..z,A..Z]) says, 'heal'

Value:
#var temp %lower( %1)
#if %ismember( @temp, @budlist) {cast 'heal' %1}

I have messed around and changed the Pattern to (*) says, 'heal' and it seems to work. But I would still like to know what changed or how I could do this better?
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Tue Mar 23, 2004 8:08 am   
 
Try this pattern instead: ^([a-zA-Z]) says, 'heal'
I don't know where you got your .. from, Pascal?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Mar 23, 2004 8:43 am   
 
Better yet, just use the list in the pattern.
Pattern: ^({@budlist}) says, 'heal'
Value: cast 'heal' %1

You could also just replace a range containing all the upper- and lower-case letters with %w, the alphabetic wildcard.

EDIT: Fixed typo in pattern. Thanks for pointing it out, Pega, although it might help others more if you actually stated what the mistake was.
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Tue Mar 23, 2004 8:57 am   
 
quote:
Pattern: ^(@budlist) says, 'heal'
Edited by - LightBulb on 03/23/2004 01:44:30


Pattern: ^({@budlist}) says, 'heal' Wink
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Tue Mar 23, 2004 9:55 am   
 
quote:
Originally posted by LightBulb

Better yet, just use the list in the pattern.
Pattern: ^({@budlist}) says, 'heal'
Value: cast 'heal' %1

You could also just replace a range containing all the upper- and lower-case letters with %w, the alphabetic wildcard.

EDIT: Fixed typo in pattern. Thanks for pointing it out, Pega, although it might help others more if you actually stated what the mistake was.

Alright.

{val1|val2|val3|...} match any of the specified strings - taken from Pattern Matching in the help file

The variable list @budlist would look something like John|Tom|Bub, using braces around @budlist in the trigger pattern would essentially match in the pattern, any one of a single item in the list. Wink
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Mar 23, 2004 3:42 pm   
 
And completly off base here but for future refrence wouldnt (%w) do the same things as ([a-zA-Z])
Maybe a reread of the Pattern Matching help file is in order :P
Reply with quote
ohmford
Newbie


Joined: 23 Mar 2004
Posts: 3
Location: USA

PostPosted: Mon Mar 29, 2004 7:17 pm   
 
Thanks for the help/suggestions. As for the %w command I just like the A-Z a-z command better :>

I think I am going to go with the

Pattern: ^({@budlist}) says, 'heal'
Value: cast 'heal' %1

How can I get the code to check and see if I am sitting and if so stand before casting?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Mar 29, 2004 8:16 pm   
 
You would have to store this in another variable. For example, the variable @sitting could contain a 1 if you are sitting and 0 otherwise. The trigger would then check the value of this variable:
#IF (@sitting) {stand}

This #IF would go just before casting the spell. Also, notice that zMUD recognizes any non-zero value as true, so @sitting = 1 is not needed if the above convention is followed.

Now you need a way to make this variable contain the correct value. For this, you can create aliases of the commands you use to sit and stand. Example:
#ALIAS sit {~sit;#VAR sitting 1}
#ALIAS stand {~stand;#VAR sitting 0}
Reply with quote
ohmford
Newbie


Joined: 23 Mar 2004
Posts: 3
Location: USA

PostPosted: Wed Mar 31, 2004 4:10 pm   
 
Thanks once again! I will code it this weekend and test.
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