OsNpcRemove

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
(Remove void)
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{| width="100%" style="border: thin solid black"
+
{{osslfunc
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
+
|threat_level=High
|- valign="top"
+
|permissions=${XEngine|osslNPC}
|'''Threat Level''' || High
+
|delay=0
 
+
|function_syntax=osNpcRemove(key npc)
|- valign="top"
+
|ossl_example =This might be helpful to erase all of the NPCs in your sim.
|'''Function Syntax''' || <source lang="lsl">
+
<source lang="lsl">
osNpcRemove(key npc);
+
// sim-wide NPC killer
</source>
+
// kill all of NPCs in this SIM
|- valign="top"
+
// Attempts to kill agents too, but it will silently fail
|'''Example(s)||
+
// http://opensimulator.org/wiki/OsNpcRemove
 
+
|}
+
default
 
+
{
[[Category:OSSL Functions]]
+
    touch_start(integer number)
[[Category:OSSL_functions_without_example]]
+
    {
 +
        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);
 +
        }
 +
    }
 +
}
 +
    </source>
 +
|description=*Removes the NPC specified by key '''npc'''.
 +
|
 +
|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 18:29, 11 December 2018

osNpcRemove(key npc)
  • Removes the NPC specified by key npc.
Threat Level High
Permissions ${XEngine|osslNPC}
Extra Delay 0 seconds
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