OsNpcRemove

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (some syntax modification (may be major or minor))
m (Example messages added)
Line 7: Line 7:
 
// kill all of NPCs in this SIM
 
// kill all of NPCs in this SIM
 
// Attempts to kill agents too, but it will silently fail
 
// Attempts to kill agents too, but it will silently fail
 
+
// http://opensimulator.org/wiki/OsNpcRemove
 +
 
default
 
default
 
{
 
{
Line 14: Line 15:
 
         list avatars = llList2ListStrided(osGetAvatarList(), 0, -1, 3);
 
         list avatars = llList2ListStrided(osGetAvatarList(), 0, -1, 3);
 
         integer i;
 
         integer i;
 +
        llSay(0,"NPC Removal: No avatars will be harmed or removed in this process!");
 
         for (i=0; i<llGetListLength(avatars); i++)
 
         for (i=0; i<llGetListLength(avatars); i++)
 
         {
 
         {
 
             string target = llList2String(avatars, i);
 
             string target = llList2String(avatars, i);
 
             osNpcRemove(target);
 
             osNpcRemove(target);
 +
            llSay(0,"NPC Removal: Target "+target);
 
         }
 
         }
 
     }
 
     }
 
}
 
}
</source>
+
    </source>
 
See [[osNpcCreate]] for another example.
 
See [[osNpcCreate]] for another example.
 
|description=*Removes the avatar who has specified by '''npc'''.
 
|description=*Removes the avatar who has specified by '''npc'''.
*If the '''npc''' is the uuid of any agent(or users, not NPC), this function will silently fail, not erasing existing avatar.
+
*If the '''npc''' is the uuid of any agent (or users, not NPC), this function will silently fail, not erasing existing avatar.
 
|
 
|
 
}}
 
}}

Revision as of 02:58, 17 August 2011

void osNpcRemove(key npc)
  • Removes the avatar who has specified by npc.
  • If the npc is the uuid of any agent (or users, not NPC), this function will silently fail, not erasing existing avatar.
Threat Level High
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
It 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);
        }
    }
}

See osNpcCreate for another example.

Personal tools
General
About This Wiki