Re: [NEWBIE] Shutdown

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 07/31/97

On Thu, 31 Jul 1997, Ron Cole wrote:

> >note, I've got the ascii patch in and tweaked to my liking, but I noticed
> >than when a character self deletes, it doesn't remove their entry from the
> >index file, nor does it remove the actual pfile... hrm hrm.
> This was true before also.  You had to run purgeplay to get rid of them
> completely.
        Posted before, but here it is again, just a short messy perl
script to reorder, delete, etc for pfile indexs, aliases, saveobjs, etc...
whatever.. basically purgeplay w/o the timing info for levels, and minus
checks for immos, i think. My own is now far modified of this one, and
specific to my mud, but this one is a good base.

#  House Cleaner v.1, by Pat Dughi 5-30-97
# kinda a substitute for automaint once you get that fancy ascii pfile
# thing and they aint removed no more.

#general declares
#change these as needed for your system.
$DELETE_BIT=1024;          #this is 2^10 or (1 << 10)
$NODELETE_BIT=8192;         #this is 2^13 or (1 << 13)




# Subroutine "find_old_dir", returns old style directory of character
# being examined.

sub find_old_dir {
  my $character_name = @_;
  $first_letter=($character_name[0] =~ tr/a-z/A-z/);

  foreach $old_dir (@OLD_STYLE_DIRS) {
    if ($first_letter <= $old_dir[0] && $first_letter >= $old_dir[2]) {
      return $old_dir;
  #this couldn't possibly happen,  but hey, we'll put it in for fun.
  return "ZZZ";

# find_and_remove subroutine
# Find out if a named player needs to be deleted!

sub find_and_remove {
  my $character_name = shift(@_);

  open(PFILE, "$PLAYER_DIR/$START_PLAYER_DIR/$character_name");
  while(<PFILE>) {
#Act  and Id are the unique lines for the player flags, and the idnum,
# if you've changed it in your system, change it here too.
# make sure you have all 4 letters, maybe..
    if (/~Act /) {
      if ($actnum & $DELETE_BIT && !($actnum & $NODELETE_BIT)) {
    if (/~Id  /) {

  if($delete) {
    print("Deleting $character_name, delete bits set.\n");

# right here, you may want to comment this bit out, until you're SURE it
# works.. don't delete your files if you don't have to!


    if(-e ("$RENT_DIR . "/" . find_old_dir($character_name) . "/$character_name.objs")) {
      unlink($RENT_DIR . "/" . find_old_dir($character_name) . "/$character_name.objs");
    if(-e ($ALIAS_DIR . find_old_dir($character_name) . "/" . $character_name)) {
      unlink($ALIAS_DIR . find_old_dir($character_name) . "/" . $character_name);
    return 0; # found and removed.
  return $idnum; #  found, is okay for insertion in index.

#this is the main function.

print("House cleaning started.\n");
open(NEW_PLAYER_INDEX, "> $TMP_DIR/tmpplr_index");

while($START_PLAYER_DIR ne "aa") {
  @dir_list= readdir TEMPDIR;
  closedir TEMPDIR;

  foreach $character (@dir_list) {

    if(find_and_remove($character)>0) {
      print NEW_PLAYER_INDEX "$their_id\t$character\n";



open(NEW_PLAYER_INDEX,  "$TMP_DIR/tmpplr_index"); #just for reading.

@sorted=sort sorter @presort;
foreach $line (@sorted) {
  print PLAYER_INDEX "$num\t$name\n";

print("All done!\n");

sub sorter {

  $numbera =split(/\s/,$a);
  $numberb =split(/\s/,$b);

 $numbera cmp $numberb;

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST