Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 01-20-2014, 10:16 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Did something like this on the Testbed server back in 2009. This was due the to the fact scripters loved to upload staff tools and write their name with thousands of staff blocks. Best part? putnpcs with non-existing classes

PHP Code:
/*
    Used to clear classes from levels.
    
    By classes I mean staffsigns, staffblocks etc.
    
    just edit 'temp.class' to what class to search for..
    Also remove the 'return;' to enable
      (Comment it out for fast toggling)
    
    -Chompy
*/

/*
  2.feb.09
  
  Most used classes:
  
  1. shared_blocks: 552 times
  
  -- After cleaning --
  
  Found 546x (shared_blocks) in new1.nw
  
  ------------------------------ 1th may
  
  Found 186x (shared_blocks) in firstscript1.nw
  Found 2x (shared_blocks) in jail_outside.nw
  Found 520x (shared_blocks) in era_sewerph-house14-1.nw
  Found 1x (shared_blocks) in ce_shop1.nw
  Found 1x (shared_blocks) in ******.nw
  Found 1x (shared_blocks) in ******.nw

*/

function onCreated() {
  
temp.paths findfiles("*.nw"1);
  
temp.class = "shared_blocks";
  
  return;
  
  for(
temp.path paths) {
    
temp.pos path.tokenize("/");
    
temp.lvl pos[pos.size()-1];
    
temp.lvl2 findlevel(lvl);
    
temp.blocks 0;
    for(
temp.lvl2.npcs) {
      if (class 
in n.joinedclasses) {
        
blocks ++;
        
n.destroy();
      }
    }
    if (
blocks 0) {
      echo(
"Found "blocks @"x ("@class@") in "lvl2.name);
    }
  }

Simply you would do /stats in RC chat, then look for the classes that occured to the most, and put that class name in the script, and it would look through levels for that class and destroy it.

Very old script, never optimized it or anything, but it takes a little different approach than yours.

I think you only need r to the folders the levels are in if I'm not mistaken, can't remember. Found this in an old testbed server backup

NB! Yes, you have no idea how often I saw era weapons, levels and whatever era stuff on the testbed stuff. was so fun deleting it. Most popular server's stuff to mess around in 2009 on testbed.
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.