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


Joined: 24 Sep 2002
Posts: 1

PostPosted: Thu Nov 07, 2002 3:54 am   

Triggers Help
 
I have some triggers for killing mobs. But they are too long. In what way, can it be shortened? Here is the part of triggers. I have mobs assigned to @east, @north, etc from scan information. I want to pick specific mob to kill.



#if (@east == "a rabid dog" and @position == "standing") {
east
kill dog
@position = "fighting"
}
#if (@west == "a rabid dog" and @position == "standing") {
west
kill dog
@position = "fighting"
}
#if (@north == "a rabid dog" and @position == "standing") {
north
kill dog
@position = "fighting"
}
#if (@south == "a rabid dog" and @position == "standing") {
south
kill dog
@position = "fighting"
}
#if (@east == "a large eagle" and @position == "standing") {
east
kill eagle
@position = "fighting"
}
#if (@west == "a large eagle" and @position == "standing") {
west
kill eagle
@position = "fighting"
}
#if (@north == "a large eagle" and @position == "standing") {
north
kill eagle
@position = "fighting"
}
#if (@south == "a large eagle" and @position == "standing") {
south
kill eagle
@position = "fighting"
}
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Thu Nov 07, 2002 4:21 am   
 
For a start, you can nest the ifs - since all have the @Position

#IF (@position == "standing") {#IF (@east == "a rabid dog") {east;kill dog;@position = "fighting"} {#IF (@west == "a rabid dog") {east;kill dog;@position = "fighting"}}}

etc...

If there are a lot of possible mobs, this will get horribly messy, and I would suggest a string list instead of separate variables for the 4 directions, using case to select which direction to go.

Also possibly a lookup (database?) for the kill string relating to each scan string - so when you see a rabid dog, the string dog is read to @mob, and you simply send kill @mob.
It's 3 a.m., so hopefully that makes sense without details...

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
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