Difference between revisions of "Kill Buffer Tracking"

From RoDpedia
Jump to: navigation, search
m
 
Line 1: Line 1:
= Purpose =
 
 
 
Repeatedly killing the same mob causes the mob to gain advantages against you in combat and provide less experience.  Some believe this also affects pop rates on certain mobs.
 
Repeatedly killing the same mob causes the mob to gain advantages against you in combat and provide less experience.  Some believe this also affects pop rates on certain mobs.
  
Line 10: Line 8:
 
This script keeps track of your kill buffer, allowing you to know when you have cleared out the mob you are concerned about.
 
This script keeps track of your kill buffer, allowing you to know when you have cleared out the mob you are concerned about.
  
= Commands =
+
== Script 1 ==
 +
This script keeps track of the last 25 mobs killed and is fairly straight forward to understand.  When a mob is killed it checks the last line to see if the damage came from "You".
 +
 
 +
=== Commands ===
 
* setBufferLength - used to set a buffer length other than 25
 
* setBufferLength - used to set a buffer length other than 25
 
* clearBuffer - remove all mob kill history and reset buffer
 
* clearBuffer - remove all mob kill history and reset buffer
 
* showBuffer - display the current buffer state
 
* showBuffer - display the current buffer state
  
= Script =
+
=== cMud 3.34 ===
== cMud 3.34 ==
 
 
  #CLASS {killBufferTracker} {enable}
 
  #CLASS {killBufferTracker} {enable}
 
  #VAR killList ""
 
  #VAR killList ""
Line 56: Line 56:
 
   
 
   
 
  #CLASS 0
 
  #CLASS 0
 +
 +
== Script 2 ==
 +
This script operates on the premise that you might want to track the last x mobs (preconfigured to 50) but also to see how many of each of those mobs you've killed.  That is, instead of assuming the kill buffer is a list of 25 names, assume it's a list of 25 names and a kill count.  If a mob is already in the kill buffer increase it's count but don't change the list.  If it's not in the list and the list is full, bump off the oldest and add the newest with a count of 1.
 +
 +
=== Commands ===
 +
killistclear - empty the current kill buffer
 +
killistshow - show the current kill buffer
 +
 +
Note that it is also useful to display this in a window by tracking the "listokills" variable.
 +
 +
Suggested rewrite: Instead of doing all the string parsing, go ahead and rewrite it to properly use key/value pairs.  I'm pretty sure most of the #VAR commands can become #LOCAL but no time to test tonight.
 +
 +
To use this trigger cut and paste it into a text file, then use File->Import XML to read it in.
 +
 +
=== CMud v3.34 ===
 +
    #CLASS {killlist} {enable}
 +
   
 +
    #ALIAS killlistfind {
 +
        #SHOW Items in buffer kill list :  @listkillnum;
 +
        #IF (@listkillnum > 0) {
 +
            #SHOW Oldest kills listed first:;
 +
            #LOOP 1,@listkillnum {
 +
                #IF (%pos(%1,%word(@listokills,%i,|)) > 0) {
 +
                    #SHOW Buffer Entry %i :  %word(@listokills,%i,|)
 +
                }
 +
            }
 +
        }
 +
    }
 +
   
 +
    #TRIG {(%w) is DEAD!!} {
 +
        #VAR linebefore1 %line2;
 +
        #VAR fullmobname  %replace(%left(%trigger,%pos(" is",%trigger))," ","");
 +
        #SHOW MOB :  @fullmobname JUST DIED;
 +
        #SHOW LINE1BEFOREKILL :  @linebefore1;
 +
        #VAR killedit  %word(@linebefore1,1);
 +
        #IF (%pos("You",@killedit) > 0) {
 +
            //#SHOW YOU GOT THE KILL;
 +
            killlistadd @fullmobname
 +
        }
 +
    }
 +
   
 +
    #ALIAS killlistclear {
 +
        #VAR listokills {""}
 +
        #VAR listkillnum 0
 +
        #SHOW "Kill List Emptied."
 +
    }
 +
   
 +
    #ALIAS killlistadd {
 +
        #VAR itemtoadd %1
 +
        #VAR numkills {""}
 +
        #VAR itemtoadd2 ""
 +
        #VAR mobname {""}
 +
        #VAR mobnameandnum {""}
 +
        #VAR mobnamefound 0
 +
        #VAR listkillnum  %numwords(@listokills,"|")
 +
        //#SHOW Scanning list for @itemtoadd
 +
        #IF (@listkillnum > 0) {
 +
            #LOOP 1,@listkillnum {
 +
                #VAR itemtocheck %i
 +
                #MATH itemtocheck  @listkillnum-@itemtocheck
 +
                #MATH itemtocheck  @itemtocheck+1
 +
                #VAR itemtodel  %word(@listokills,%i,"|")
 +
                #VAR listkillnum  %numwords(@listokills,"|")
 +
                #VAR numkills  %word(@itemtodel,1,"/")
 +
                #VAR mobname  %word(@itemtodel,2,"/")
 +
                #IF (@mobnamefound = 0) {
 +
                    #IF (@mobname =  @itemtoadd) {
 +
                        //#SHOW Found  @itemtoadd
 +
                        #VAR mobnamefound 1
 +
                        //#SHOW REMOVING :  @itemtodel
 +
                        #VAR listokills  %delitem(@itemtodel,@listokills)
 +
                        //#SHOW INCREMENTING  @itemtodel
 +
                        #MATH numkills  @numkills+1
 +
                        #VAR itemtoadd  %concat(@numkills,"/",@mobname)
 +
                        //#SHOW RE-ADDING NEW :  @itemtoadd
 +
                        #ADDITEM listokills  @itemtoadd
 +
                    } // IF mobname==itemtoadd
 +
                } // IF mobnamefound is true
 +
            } // LOOP
 +
        }// IF listkillnum
 +
   
 +
        #IF (@mobnamefound = 0) {
 +
            #VAR itemtoadd2 %concat("1/",@itemtoadd)
 +
            %vartype( itemtoadd2, 4 )
 +
            //#SHOW  @itemtoadd not found, adding new :  @itemtoadd2;
 +
            #ADDITEM listokills @itemtoadd2
 +
        }
 +
   
 +
        #VAR listkillnum  %numwords(@listokills,"|");
 +
        //#show End of KILLLISTADD;
 +
        killlist50
 +
    }
 +
   
 +
    #ALIAS killlistshow {
 +
        #SHOW Items in buffer kill list :  @listkillnum
 +
        #IF (@listkillnum > 0) {
 +
            #SHOW Oldest kills listed first:
 +
            #LOOP 1,@listkillnum {
 +
                #SHOW Buffer Entry %i :  %word(@listokills,%i,|)
 +
            }
 +
        }
 +
    }
 +
   
 +
    #ALIAS killlist50 {
 +
        // keep list down to 50 items, removing oldest item
 +
        #VAR listkillnum  %numwords(@listokills,|);
 +
        #IF (@listkillnum > 50) {
 +
            #VAR itemtodel  %word(@listokills,1,|);
 +
            #SHOW CLEARING  @itemtodel OFF OF KILLLIST;
 +
            #VAR listokills %delitem(@itemtodel,@listokills)
 +
        }
 +
        #VAR listkillnum  %numwords(@listokills,|);
 +
    }
  
 
[[Category:Triggers]]
 
[[Category:Triggers]]
 +
[[Category:Scripts]]
 +
[[Category:CMud]]

Latest revision as of 02:09, 14 September 2020

Repeatedly killing the same mob causes the mob to gain advantages against you in combat and provide less experience. Some believe this also affects pop rates on certain mobs.

From help buffer:

  Mobs remember fighting you if it is within the last twenty-five kills. If they
  have a higher intelligence than you they will learn from it and potentially
  gain an advantage over you in combat, thus lessening the experience gained.

This script keeps track of your kill buffer, allowing you to know when you have cleared out the mob you are concerned about.

Script 1

This script keeps track of the last 25 mobs killed and is fairly straight forward to understand. When a mob is killed it checks the last line to see if the damage came from "You".

Commands

  • setBufferLength - used to set a buffer length other than 25
  • clearBuffer - remove all mob kill history and reset buffer
  • showBuffer - display the current buffer state

cMud 3.34

#CLASS {killBufferTracker} {enable}
#VAR killList ""
#VAR bufferLength 25

#ALIAS setBufferLength {bufferLength=%1;#say Updating killBufferTracker's bufferLength to %1} 
#ALIAS clearBuffer {#VAR killList ""}
#ALIAS showBuffer {
 #if ( %numitems( killList) == 0 ) {
   #say "Your kill buffer is empty, go kill something."
 } {
   #say "The last "%numitems( killList)"/"@bufferLength "mobs kills were:"
   #LOOPDB @killList {#say %key "=" %val}
 }
}

#TRIGGER {(*) is DEAD!!} {
 #local linebefore1 %line2
 #local linebefore2 %line3
 #local fullmobname %1
 
 #if ( %pos( "You", %word(@linebefore1,1) ) > 0 or 
       %pos( "You", %word(@linebefore2,1) ) > 0 ) {
     #if ( %iskey( killList, @fullmobname ) ) {
        killList = %addKey( killList, @fullmobname, (%int(%db( killList, @fullmobname)) + 1) );
        #SHOW %concat(%1," is in the kill buffer ( ",%db( killList, @fullmobname )," times ).")
     } {
        killList = %addkey( @killList, @fullmobname, 1 );
        #SHOW %concat(%1," added to kill buffer.")
     }   
 
     // rumour is that the kill buffer actually tracks 50 despite the help file saying 25
     #if ( %numkeys( killList ) > @bufferLength ) {
        #SHOW %concat( "Removing ",%pop(killList)," from the kill buffer.")
        killList = %delkey( killList, %pop(killList) );
     }
 }
}

#CLASS 0

Script 2

This script operates on the premise that you might want to track the last x mobs (preconfigured to 50) but also to see how many of each of those mobs you've killed. That is, instead of assuming the kill buffer is a list of 25 names, assume it's a list of 25 names and a kill count. If a mob is already in the kill buffer increase it's count but don't change the list. If it's not in the list and the list is full, bump off the oldest and add the newest with a count of 1.

Commands

killistclear - empty the current kill buffer killistshow - show the current kill buffer

Note that it is also useful to display this in a window by tracking the "listokills" variable.

Suggested rewrite: Instead of doing all the string parsing, go ahead and rewrite it to properly use key/value pairs. I'm pretty sure most of the #VAR commands can become #LOCAL but no time to test tonight.

To use this trigger cut and paste it into a text file, then use File->Import XML to read it in.

CMud v3.34

   #CLASS {killlist} {enable}
   
   #ALIAS killlistfind {
       #SHOW Items in buffer kill list :  @listkillnum;
       #IF (@listkillnum > 0) {
           #SHOW Oldest kills listed first:;
           #LOOP 1,@listkillnum {
               #IF (%pos(%1,%word(@listokills,%i,|)) > 0) {
                   #SHOW Buffer Entry %i :  %word(@listokills,%i,|)
               }
           }
       }
   }
   
   #TRIG {(%w) is DEAD!!} {
       #VAR linebefore1 %line2;
       #VAR fullmobname  %replace(%left(%trigger,%pos(" is",%trigger))," ","");
       #SHOW MOB :  @fullmobname JUST DIED;
       #SHOW LINE1BEFOREKILL :  @linebefore1;
       #VAR killedit  %word(@linebefore1,1);
       #IF (%pos("You",@killedit) > 0) {
           //#SHOW YOU GOT THE KILL;
           killlistadd @fullmobname
       }
   }
   
   #ALIAS killlistclear {
       #VAR listokills {""}
       #VAR listkillnum 0
       #SHOW "Kill List Emptied."
   }
   
   #ALIAS killlistadd {
       #VAR itemtoadd %1
       #VAR numkills {""}
       #VAR itemtoadd2 ""
       #VAR mobname {""}
       #VAR mobnameandnum {""}
       #VAR mobnamefound 0
       #VAR listkillnum  %numwords(@listokills,"|")
       //#SHOW Scanning list for @itemtoadd
       #IF (@listkillnum > 0) {
           #LOOP 1,@listkillnum {
               #VAR itemtocheck %i
               #MATH itemtocheck  @listkillnum-@itemtocheck
               #MATH itemtocheck  @itemtocheck+1
               #VAR itemtodel  %word(@listokills,%i,"|")
               #VAR listkillnum  %numwords(@listokills,"|")
               #VAR numkills  %word(@itemtodel,1,"/")
               #VAR mobname  %word(@itemtodel,2,"/")
               #IF (@mobnamefound = 0) {
                   #IF (@mobname =  @itemtoadd) {
                       //#SHOW Found  @itemtoadd
                       #VAR mobnamefound 1
                       //#SHOW REMOVING :  @itemtodel
                       #VAR listokills  %delitem(@itemtodel,@listokills)
                       //#SHOW INCREMENTING  @itemtodel
                       #MATH numkills  @numkills+1
                       #VAR itemtoadd  %concat(@numkills,"/",@mobname)
                       //#SHOW RE-ADDING NEW :  @itemtoadd
                       #ADDITEM listokills  @itemtoadd
                   } // IF mobname==itemtoadd
               } // IF mobnamefound is true
           } // LOOP
       }// IF listkillnum
   
       #IF (@mobnamefound = 0) {
           #VAR itemtoadd2 %concat("1/",@itemtoadd)
           %vartype( itemtoadd2, 4 )
           //#SHOW  @itemtoadd not found, adding new :  @itemtoadd2;
           #ADDITEM listokills @itemtoadd2
       }
   
       #VAR listkillnum  %numwords(@listokills,"|");
       //#show End of KILLLISTADD;
       killlist50
   }
   
   #ALIAS killlistshow {
       #SHOW Items in buffer kill list :  @listkillnum
       #IF (@listkillnum > 0) {
           #SHOW Oldest kills listed first:
           #LOOP 1,@listkillnum {
               #SHOW Buffer Entry %i :  %word(@listokills,%i,|)
           }
       }
   }
   
   #ALIAS killlist50 {
       // keep list down to 50 items, removing oldest item
       #VAR listkillnum  %numwords(@listokills,|);
       #IF (@listkillnum > 50) {
           #VAR itemtodel  %word(@listokills,1,|);
           #SHOW CLEARING  @itemtodel OFF OF KILLLIST;
           #VAR listokills %delitem(@itemtodel,@listokills)
       }
       #VAR listkillnum  %numwords(@listokills,|);
   }