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


Joined: 31 Oct 2005
Posts: 4

PostPosted: Mon Oct 31, 2005 1:49 am   

Simple kill script help.
 
Hey guys sorry for posting another kill script help thread but I searched for a few hours and havn't been able to work this out on my own.

What I want to do is simply walk through a zone, manually, not with a path or anything, and instead of having to type kill bird, kill warrior etc, I want it to do it automatically. So I go into a room, and it kills all the mobs in the room. It would be nice if I could have a list of mobs not to attack too. Like if I go into a room and there is a mob that is in the lsit not to attack, it will kill the other mobs, and leave the other one alive. I am not worried about waiting for one fight to end. If it sees 4 mobs, 3 which are okay to kill and 1 which isn't, it simply spams kill mob1, kill mob2, kill mob3. I am pretty sure this isn't too complicated but for some reason I can't figure it out. Thanks guys.

Sample room desc from mud:

Coliseum Way
Smooth cobblestones line the wide avenue leading eastwards toward the grand coliseum that towers over the flat roofed buildings surrounding it. The faint roar of the crowds within the coliseum drift right over the top of the roofs, over the chatter of townspeople traveling up and down the road. Merchants with small carts trundle up and down the road with food and small souvenirs, keeping their eye out for prospective clients. The deep clank of iron meeting iron ring from the open doorway to the south. A small inn stands on the north corner of the town square.
[ Exits: north east south west]
A wandering citizen is standing here.
A wandering citizen is standing here.
A gladiator stands here, taking a break from the arena.

The mob descriptions often start wtih "A" or "An" or "The", but not always.
Reply with quote
saplingg
Novice


Joined: 06 Oct 2005
Posts: 31

PostPosted: Mon Oct 31, 2005 3:03 am   
 
Hmm, simple enough, I'll try to help

First, create a class folder labelled whatever, in your case let's call it
Code:

#CLASS {Coliseum}
#TRIGGER {A wandering citizen is standing here. } {
  k citizen
  #T- @Current
  }
#TRIGGER {A gladiator stands here, taking a break from the arena.} {
  k gladiator
  #T- @current
  }
#CLASS 0


And then we have the variable
Code:
@current = Coliseum



Now, set up a trigger so that when your target dies, the class is turned back on, and looks for the next target
Code:

#TRIGGER {is DEAD} {#T+ @current;look}


You might want to add another trigger that lets you keep on killing in case the target flees
Code:

#TRIGGER {has fled!} {#T+ @current;look}




Hope this works for you
Reply with quote
patrck17
Newbie


Joined: 31 Oct 2005
Posts: 4

PostPosted: Mon Oct 31, 2005 9:01 pm   
 
This is actually helpful thanks. One question though. It looks like there is an individual trigger to match each of the mob descriptions. Is there any way I can condense that into a single trigger that searches through a string list, with all the descriptions in it? Like instead of:

#TRIGGER {A wandering citizen is standing here. } {
k citizen
#T- @Current
}
#TRIGGER {A gladiator stands here, taking a break from the arena.} {
k gladiator
#T- @current
}

there could be a string list that had the contents like:

A wandering citizen is standing here.
A gladiator stands here, taking a break from the arena.
A person is here.
Etc
etc

Sorry I have a hard time describing what I need. I basicly want the trigger to match any of the contents of the string list, where I would have a list of all the mob descriptions it should match. If you can help thanks! Please ask if you need me to try to better explain what I mean.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Oct 31, 2005 10:13 pm   
 
#CLASS AutoKill
#VARIABLE ConfirmedMobs {}
#VARIABLE Verbs {is|stand|sit|sleep}
#VARIABLE Suffixes {ing|ed|s|}
#VARIABLE TempMobName {} {}
#VARIABLE KillTargets {} {}
#VARIABLE LookTargets {} {}
#TRIGGER "MobCap" {~^[ Exits: *~]$} {MobList="";KillTargets="";LookTargets=""}
#COND {} {#IF (%line!="") {MobList=%additem(%line,@MobList)} {#STATE MobCap 3;#SET MobCap 3 1}} {looplines|param=30}
#COND {*} {#STATE MobCap 0;#ECHO Error in MobCap: over 30 mobs seem to have been detected.}
#COND {} {#FORALL @MobList {TempMobName="";#IF (%match("%i","{The |An |A |}(*) {@Verbs}{@Suffixes} ",@TempMobName)=0) {#ECHO Error proccessing mob name for '%i'.} {#IF (%ismember(@TempMobName,@NoKillList)=0) {#IF (%iskey(@ConfirmedMobs,@TempMobName)) {TempMobName=%db(@ConfirmedMobs,@TempMobName);#IF (%iskey(@KillTargets,@TempMobName)) {#ADDKEY KillTargets @TempMobName {%eval(@{KillTargets.@TempMobName}+1)}} {#ADDKEY KillTargets @TempMobName {1};kill @{TempMobName}.@{KillTargets.@TempMobName};#DELITEM MobList {%i}} {#ADDKEY LookTargets {@TempMobName} {%word(@TempMobName,1)}}};#IF (@LookTargets) {TempMobName=%word(%item(%expanddb(@LookTargets),1,"|","="),2,"=");look %word(@TempMobName,%numwords(@TempMobName))}}}} {manual}
#CLASS 0

That is about as far as I can get. Basically it does some parsing based on looking for text between an article and a set of predefined verbs. This is going to achieve the most likely capture of a given mobs keyword(s). Then it checks to see if it knows that text for a mob, if it does increases the counter and does the kill for it. I assumed a number of things: first that a blank line would follow the listing of mobs, second that the kill command would attack multiple mobs of the same with name.# format.

Finally what is missing is a way to distinguish items from the mob list, since it seems likely they will be combined there; and the format for 'look' output, perhaps even another command would be better, so that mobs can have the correct keywords identified. This might even cover the problem of mobs and items being listed in the same block.

As always this script was written off the top of my head, and is likely to contain a error here of there.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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