User:Dz

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(NPC Utilities)
(NPC BotKiller)
Line 23: Line 23:
  
 
Remember,  you wil need to enable NPC functions  and set the severity level of allowed osNPC function calls for these scripts to work.
 
Remember,  you wil need to enable NPC functions  and set the severity level of allowed osNPC function calls for these scripts to work.
 
=== NPC BotKiller ===
 
Sometimes..things go wrong...and you have a region full of wandering NPC's.  Drop this code in a prim and touch it... 
 
It can take a while to remove them all. PLEASE DON'T NUKE other peoples NPC's.
 
 
<source lang = "lsl">
 
 
// OpenSimian BotKiller
 
// Kills all the NPC's in the region.. Please use with discretion.
 
// Iterate over a list of avatar keys, using them as an arguments to osNpcRemove
 
// Add a delay to the timer if sim performance starts to drag during logouts
 
// Feel free to use/distribute/modify to suit your needs
 
// Prepared for transfer to MOSES grid -  D Osborn  5.3.2013
 
 
integer who2kill = 0;
 
integer howmany = 0;
 
list avatars = [];
 
 
default
 
{
 
    state_entry()
 
    {
 
      llSetText("waiting ", <1.0, 0.0, 0.0>, 1.0);
 
    }
 
 
    touch_end(integer total_number)  // should not change state in touch_start events....
 
    {
 
      avatars = osGetAvatarList();
 
      howmany = llGetListLength(avatars)/3;
 
      state KillThem;
 
    }
 
 
    changed(integer change)    //  Reset on region restart
 
    {
 
      if (change & CHANGED_REGION_RESTART)
 
      {
 
          llResetScript();
 
      }
 
    }
 
}
 
 
state KillThem
 
 
{
 
    state_entry()
 
    {
 
      llSetText("Processing ", <1.0, 0.0, 0.0>, 1.0);
 
      llSetTimerEvent(3.0);                            // remove 1 every 3 seconds to minimize performance impact
 
    }
 
 
    timer()
 
    {
 
      osNpcRemove(llList2Key(avatars,who2kill*3)); 
 
      llSetText("Removed so far : " + (string) (who2kill + 1), <1.0, 0.0, 0.0>, 1.0);
 
     
 
      who2kill++;     
 
      if(who2kill>=howmany)
 
          state default;         
 
 
      llSetTimerEvent(3.0/ llGetRegionTimeDilation());  // Use timedilation to add to the delay if lagging
 
    }
 
 
 
 
    touch_end(integer interrupt)  // abort by touching the object while it is processing
 
    {
 
      llResetScript();
 
    }
 
 
    changed(integer change)
 
    {
 
      if (change & CHANGED_REGION_RESTART)
 
      {
 
          llResetScript();
 
      }
 
    }
 
}
 
 
 
</source >
 

Revision as of 19:28, 6 May 2013

Welcome to the OpenSimulator Space of dz

I am generally involved in running OpenSim instances for fun, but I have been induced to try it for profit and the pursuit of scholarly credits.

I am an incessant lurker...It took me 2 years to add these 3 lines to my profile here.

I monitor the following OpenSimulator mailing-lists Opensim-Users, OpenSim-devs, libomv-dev. I can also be found lurking in the SL opensim group chat.

I have been administering Linux based OpenSim servers since release 6.1, mostly on Ubuntu. I have active avatars on OSGrid, ScienceSim, Inworldz, and that "SL" place.



NPC Utilities

These are useful utilites I have developed over time to help me use NPCs in OpenSimulator. Many of them are assembled from bits and pieces of code I have read/seen/fixed/admired. Some of the code snippets appear with permissions, Please do not remove the attributions where they can be found in the comments. The code has been shared, only asking simple consideration. Please respect the wishes of the original authors as I have attempted to do.

Remember, you wil need to enable NPC functions and set the severity level of allowed osNPC function calls for these scripts to work.

Personal tools
General
About This Wiki