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
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Tue Dec 04, 2001 1:53 am   

Need Help creating triggers
 
I need to make a class of triggers that uses the muds 'scan' command to go in a given direction and kill the mob that is in that direction.

The output from scan is like this:
scan
North from here you see:
- Grumpy smurf
- Handy smurf
South from here you see:
- A smurf
- Smurfette
2 South from here you see:
- Hefty smurf
West from here you see:
- A smurf

I want the triggers to extract the mobs name, then move in that direction, then kill <mobname>. For all purposes, it would probably be best to just make it go towards the first mob it sees. I would also be nice to be able to make it choose a certain type of mob, such as goblin or dragon, over any other type of mob it sees.

Also, could someone tell me how to enable/disable a class from the command prompt?

Thanks in advance, and looking forward to whatever you guys can cook up :)
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Tue Dec 04, 2001 5:48 am   
 
By the by, I dont need a finished script, just somewhere to start :P

I'm not good at creating triggers, but I CAN modify them to suit my needs :)I just need to know where to start...but dont let that stop you from creating a finish script :P
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 04, 2001 7:27 am   
 
quote:

By the by, I dont need a finished script, just somewhere to start :P

I'm not good at creating triggers, but I CAN modify them to suit my needs :)I just need to know where to start...but dont let that stop you from creating a finish script :P



It might take some doing, since I don't recall much in the way of post titles, but there are at least 4 posts I remember that tackle this very problem and should have enough code for you to get your hands very dirty.

Search, it is our version of the White Mighty Morphin Power Ranger

li'l shmoe of Dragon's Gate MUD
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Tue Dec 04, 2001 9:14 am   
 
goosh! this is a tricky problem
but fun
if you try this :


#class killing
#tr "dir" {^(%w) from here you see:$} {nmbr_steps = 1;direction = %1;#t- dir;#t- multi_dir;#t+ first_mob}
#tr "multi_dir" {(%d) (%w) from here you see:$} {nmbr_steps = %1;direction = %2;#t- dir;#t- multi_dir;#t+ first_mob}
#tr "first_mob" {^- (*)$} {full_name_mob = {%1};#t- first_mob}
#tr {They aren't here.} {worked = 0}
#class 0
#alias go_kill {
worked = 0
item = 1
scan
#t+ killing
#t+ dir
#t+ multi_dir
#wait
#loop @nmbr_steps {@direction;#wait}
mob_name_parsed = %replace(@full_mob_name," ","|")
#while (@worked = 0 and @item <= %numitems(@mob_name_parsed)) {
kill %item(@mob_name_parsed,@item)
#add item 1
worked = 1
#wait
}
#t- killing
}

you'll probably have good luck.
it got complictated, since the mud outputs names like "A smurf", and the command "kill A smurf" will probably return a mob not found sort of error.
the alias should go through each word in a mobs short name, and attempt to attack each one. I assumed the message you get when the mobs name is unrecognized is "They aren't here" (the red line) but you should change it to whatever the message actually is.
Also, i used several #wait statements. Since these might not be supported in future versions, you might want to experiment with #alarm to see if you can get it to work as a substitute.
I think this script will work, but its untested. try it and let me know, ok?
Emit
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