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


Joined: 21 Dec 2001
Posts: 7
Location: USA

PostPosted: Fri Dec 21, 2001 7:27 am   

Advanced Triggers
 
Hi. I'm in the process of building a bot and was wondering how I would go about checking a room for NPC's to kill and killing them. For example, I enter a room and I see a description similar to this:
-------------------------
> In the farm
(Exits: n e s w)
A small pig
A small pig
A large hen
A small pig
-------------------------
Now all I want to do is kill the first small pig. How would I go about setting up a trigger for this action? Thanks in advance. :)

BTW, I can't type 'kill a small pig'. It has to be 'kill pig'.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Fri Dec 21, 2001 9:08 am   
 
#TR {~(Exits:*~)$(*)} {kill %word("%1", %numwords("%1"))}

This will look at the first line after the exits line and uses the last word of the mob as keyword

To attack all of the mobs in a room you can use the following:

#TRIGGER {^~(Exits:*~)} {#T+ Targets;#TEMP {$} {#FORALL @Targets {Kill %i};Targets = %null;#T- Targets}}
#CLASS Targets
#VARIABLE Targets {}
#TRIGGER {(*)} {#VARIABLE Targets %additem(%word("%1",%numwords("%1")),@Targets)}
#CLASS 0

Acaila
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