Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
OpenSim NPC NPC_BotKiller  

NPC_BotKiller

Original script from http://opensimulator.org/wiki/User:Dz/NPC_Scripts

License:
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
to make commercial use of the work See http://creativecommons.org/licenses/by-sa/2.5/

Category: OpenSim NPC
By : Ferd frederix
Created: 2013-08-02 Edited: 2014-09-24
Worlds: OpenSim

the Zip file

Download all files for NPC_BotKiller
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. NPC_BotKiller_1.lsl
Get file # 2. NPC_BotKiller_Nearby.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 / OpenSimian BotKiller
2 // Kills all the NPC's in the region.. Please use with discretion.
3 // Iterate over a list of avatar keys, using them as an arguments to osNpcRemove
4 // Add a delay to the timer if sim performance starts to drag during logouts
5 // Feel free to use/distribute/modify to suit your needs
6 // Prepared for transfer to MOSES grid - D Osborn 5.3.2013
7
8 integer who2kill = 0;
9 integer howmany = 0;
10 list avatars = [];
11
12 default
13 {
15 {
16 llSetText("waiting ", <1.0, 0.0, 0.0>, 1.0);
17 }
18
19 touch_end(integer total_number) // should not change state in touch_start events....
20 {
21 avatars = osGetAvatarList();
22 howmany = llGetListLength(avatars)/3;
23 state KillThem;
24 }
25
26 changed(integer change) // Reset on region restart
27 {
28 if(change & CHANGED_REGION_RESTART)
29 {
31 }
32 }
33 }
34
35 state KillThem
36
37 {
39 {
40 llSetText("Processing ", <1.0, 0.0, 0.0>, 1.0);
41 llSetTimerEvent(3.0); // remove 1 every 3 seconds to minimize performance impact
42 }
43
44 timer()
45 {
46 osNpcRemove(llList2Key(avatars,who2kill*3));
47 llSetText("Removed so far : " + (string) (who2kill + 1), <1.0, 0.0, 0.0>, 1.0);
48
49 who2kill++;
50 if(who2kill>=howmany)
51 state default;
52
53 llSetTimerEvent(3.0/ llGetRegionTimeDilation()); // Use timedilation to add to the delay if lagging
54 }
55
56
57 touch_end(integer interrupt) // abort by touching the object while it is processing
58 {
60 }
61
62 changed(integer change)
63 {
64 if(change & CHANGED_REGION_RESTART)
65 {
67 }
68 }
69 }

NPC_BotKiller

A NPC killer that works only on nearby NPC's. Rez it and touch it.
Tells you who and how many were deleted

License:
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
to make commercial use of the work
See http://creativecommons.org/licenses/by-sa/2.5/

Category: OpenSim NPC
By : Ferd frederix
Created: 2013-08-02 Edited: 2014-09-24
Worlds: OpenSim


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 // OpenSimian BotKiller
2 // Kills all the NPC's in the region.. Please use with discretion.
3 // Iterate over a list of avatar keys, using them as an arguments to osNpcRemove
4 // Add a delay to the timer if sim performance starts to drag during logouts
5 // Feel free to use/distribute/modify to suit your needs
6 // Prepared for transfer to MOSES grid - D Osborn 5.3.2013
7 // lots of mods for nearby and eliinate silly code bits. F Beckhusen 9/18/2014
8
9 integer n;
10 default
11 {
13 {
14 // owner only
16 return;
17
18 list avies = osGetAvatarList();
19 integer len = llGetListLength(avies); // no need to recalculate ht length each loop check
20 integer counter = 0;
21 for(n=0; n<len; n=n+3)
22 {
23 key npcKey = llList2Key(avies,n);
24 if(osIsNpc(npcKey)) {
26 vector pos = llList2Vector(things,1);
27 string name = llList2String(things,0);
28
29
30 float dist = llVecDist(pos, llGetPos());
31 if(dist < 10) {
32 counter ++;
33 llOwnerSay("Removing NPC named " + name);
34 osNpcRemove((key)llList2Key(avies,n));
35 }
36
37 }
38 }
39 if(counter)
40 llOwnerSay("Removed " + (string) counter + " NPC's");
41 else
42 llOwnerSay("No NPC's within 10 meters to remove!");
43
44 }
45 }

Back to the Best Free Tools in Second Life and OpenSim.