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


Joined: 02 Jul 2009
Posts: 2

PostPosted: Thu Jul 02, 2009 3:39 pm   

Help with modifying Autohunt script
 
Found this nifty script in the finished scripts section that automates mob killing:

#CLASS {Autohunt}
#ALIAS Hunt {
#var mobEnemy {} {_nodef} {Autohunt}
#var mobDirection {} {_nodef} {Autohunt}
#var numRooms {} {_nodef} {Autohunt}
look
#wait 6000
#t+ MatchEnemy
#loop %numitems( @exits) {scan <%item(@exits,<%i>)>}
#wait 6000
#t- MatchEnemy
#if (@mobEnemy) {
#loop 1,@numRooms {@mobDirection}
kill @mobEnemy
} {
RandomMove
hunt
}
}
#ALIAS RandomMove {
#exec %item( @exits, %random( 0, %numitems( @exits)))
#var exits {} {_nodef} {Autohunt}
}
#VAR mobEnemyList {monster|kobold|human|cat|wolf|snake}
#VAR mobEnemy {wolf}
#VAR mobDirection {northwest}
#VAR numRooms {1}
#VAR exits {north|east|south|west|up|down|northwest|northeast|southwest|southeast}
#TRIGGER {*{@mobEnemyList}* is DEAD!!} {hunt}
#TRIGGER {^ ~[Exits:%s(*)%s~]} {#var exits {%replace( %1, ' ', |)} {_nodef} {Autohunt}}
#TRIGGER {They aren't here.} {hunt}
#CLASS 0
#CLASS {Autohunt|MatchEnemy}
#TRIGGER {*({@mobEnemyList})*, nearby to the (%w).} {
#var mobEnemy {%1} {_nodef} {Autohunt}
#var mobDirection {%2} {_nodef} {Autohunt}
#var numRooms {1} {_nodef} {Autohunt}
#t- MatchEnemy
}
#TRIGGER {*({@mobEnemyList})*, not far (%w).} {
#var mobEnemy {%1} {_nodef} {Autohunt}
#var mobDirection {%2} {_nodef} {Autohunt}
#var numRooms {2} {_nodef} {Autohunt}
#t- MatchEnemy
}
#CLASS 0

I updated my mob enemy list, went to the zone, started the script, and it works like a charm. However, I would like to make it more efficient if possible and I have no clue how to do it. Basically what it does now, is when the look command is sent to the mud, it saves all the available room exits in a variable, then it will scan in all those directions and look for mobs in the mobEnemyList. If it finds something, it will move in that direction and kill that mob, and when the mob dies it will repeat the entire process. Like I said, it works great, however it could be better.

First, I would like to add something where it will look in the current room first and kill everything there that's on the mob enemy list before it scans and moves to the next room. Right now, it will only kill one mob in any particular room.

Second, when it starts the scanning loop, I would like it to break out of the loop when it finds the first match. Right now, it will scan in all available directions regardless of if it finds a match, and then it moves in that direction and kill the mob.

I think with these few tweaks it would run a lot more efficiently and it wouldn't send so many "needless" commands to the mud. Oh, one thing I should point out, I lowered the #wait commands from 6000 to 1000 because I felt like the script was running too slow, maybe that is why I am having these "issues".
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