OsNpcRemove

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
(Moved some comments to the notes section)
Line 2: Line 2:
 
|threat_level=High
 
|threat_level=High
 
|function_syntax=void osNpcRemove(key npc)
 
|function_syntax=void osNpcRemove(key npc)
|ossl_example =It might be helpful to erase all of the NPCs in your sim.
+
|ossl_example =This might be helpful to erase all of the NPCs in your sim.
 
<source lang="lsl">
 
<source lang="lsl">
 
// sim-wide NPC killer
 
// sim-wide NPC killer
Line 25: Line 25:
 
}
 
}
 
     </source>
 
     </source>
See [[osNpcCreate]] for another example.
 
 
|description=*Removes the NPC specified by key '''npc'''.
 
|description=*Removes the NPC specified by key '''npc'''.
*If the '''npc''' is the UUID of any other agent (i.e. a user's avatar, not NPC), this function will silently fail, not erasing existing avatar.
 
 
|
 
|
 +
|additional_info=If the '''NPC''' is the UUID of any other type of agent (i.e. a user's regular avatar, not an NPC), this function will silently fail, not erasing existing avatar. <!-- Can't we just say "this function does not work on regular avatars, only on NPCs" ? -->
 +
*See [[osNpcCreate]] for another example script.
 
}}
 
}}

Revision as of 17:06, 17 August 2011

void osNpcRemove(key npc)
  • Removes the NPC specified by key npc.
Threat Level High
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
This might be helpful to erase all of the NPCs in your sim.
// sim-wide NPC killer
// kill all of NPCs in this SIM
// Attempts to kill agents too, but it will silently fail
// http://opensimulator.org/wiki/OsNpcRemove
 
default
{
    touch_start(integer number)
    {
        list avatars = llList2ListStrided(osGetAvatarList(), 0, -1, 3);
        integer i;
        llSay(0,"NPC Removal: No avatars will be harmed or removed in this process!");
        for (i=0; i<llGetListLength(avatars); i++)
        {
            string target = llList2String(avatars, i);
            osNpcRemove(target);
            llSay(0,"NPC Removal: Target "+target);
        }
    }
}
Notes
If the NPC is the UUID of any other type of agent (i.e. a user's regular avatar, not an NPC), this function will silently fail, not erasing existing avatar.
Personal tools
General
About This Wiki