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


Joined: 31 Jan 2002
Posts: 5

PostPosted: Tue Feb 19, 2002 10:52 pm   

spell trigger
 
i wanna cast a spell if a group member tells me the right spellname.. e.g...

Superman tells the group 'fly'
cast 'fly' Superman

therefore, i created a trig that looks like this...

Trigger: %1 tells the group ~'(%sp)~'
Action:
#IF (%sp=fly) {cast fly %1}
#IF (%sp=infra) {cast infra %1}
#IF (%sp=refresh) {cast refresh %1}

However, it doesn't work.. what's wrong with that?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Feb 19, 2002 11:17 pm   
 
Avoid using %1..%99 in trigger patterns,
use %w for words (see help expressions
I believe for other matching things).

Anything you match in your pattern and
you want to reference you need to put
() brackets around it. The
first thing in () will be %1, the second will
be %2, etc.

IFF people asking you are only one word
then you can use (%w) to capture their
names.

IFF spells are only one word then you
can also use (%w) to capture it.

Trigger: (%w) tells the group ~'(%w)~'
Action:
#IF (%2 =~ "fly") {cast fly %1}
..

TonDiening
Beta Upgrading to 6.26

Appended 18:56
Lightbulb has an uncany way to state it simply :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Feb 20, 2002 12:30 am   
 
What's wrong with it is that zMUD doesn't have a "%sp" wildcard.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Wed Feb 20, 2002 5:46 am   
 
A slightly faster or slower depending on how look at it solution.

#VAR GroupSpells {fly|invis|detect invis|detect hidden|sanctuary|infra|refresh}
#TR {(%w) tells the group ~'({@GroupSpells})~'$} {cast '"%2"' "%1"}

Then you can just add to the list, and it validates both the spell and preforms all the messy ifs for you.
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