OsNpcRemove
From OpenSimulator
(Difference between revisions)
(Update Script) |
|||
Line 5: | Line 5: | ||
|function_syntax=osNpcRemove(key npc) | |function_syntax=osNpcRemove(key npc) | ||
|ossl_example =This 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. | ||
+ | |description=*Removes the NPC specified by key '''npc'''. | ||
<source lang="lsl"> | <source lang="lsl"> | ||
− | // | + | // |
− | // | + | // osNpcRemove Script Exemple |
− | // | + | // Author: djphil |
− | // | + | // |
default | default | ||
{ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "Touch to see osNpcWhisper usage."); | ||
+ | } | ||
+ | |||
touch_start(integer number) | touch_start(integer number) | ||
{ | { | ||
− | list | + | list npcs = llList2ListStrided(osGetNPCList(), 0, -1, 3); |
− | + | ||
− | + | if (npcs == []) | |
− | + | ||
{ | { | ||
− | + | llSay(PUBLIC_CHANNEL, "There is no NPC's in this sim currently."); | |
− | + | } | |
− | + | ||
+ | else | ||
+ | { | ||
+ | integer length = llGetListLength(npcs); | ||
+ | integer i; | ||
+ | |||
+ | for (i = 0; i < length; i++) | ||
+ | { | ||
+ | key npc = llList2Key(npcs, i); | ||
+ | llSay(PUBLIC_CHANNEL, "Remove NPC: " + npc + " (" + llKey2Name(npc) + ")."); | ||
+ | osNpcSay(npc, "Goodbye!"); | ||
+ | osNpcRemove(npc); | ||
+ | } | ||
} | } | ||
} | } | ||
} | } | ||
− | + | </source> | |
− | + | ||
− | + | ||
|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" ? --> | |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. | *See [[osNpcCreate]] for another example script. | ||
}} | }} |
Revision as of 06:23, 29 November 2020
osNpcRemove(key npc)
| |
// // osNpcRemove Script Exemple // Author: djphil // default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osNpcWhisper usage."); } touch_start(integer number) { list npcs = llList2ListStrided(osGetNPCList(), 0, -1, 3); if (npcs == []) { llSay(PUBLIC_CHANNEL, "There is no NPC's in this sim currently."); } else { integer length = llGetListLength(npcs); integer i; for (i = 0; i < length; i++) { key npc = llList2Key(npcs, i); llSay(PUBLIC_CHANNEL, "Remove NPC: " + npc + " (" + llKey2Name(npc) + ")."); osNpcSay(npc, "Goodbye!"); osNpcRemove(npc); } } } } | |
Threat Level | High |
Permissions | ${OSSL|osslNPC} |
Extra Delay | 0 seconds |
Example(s) | |
This might be helpful to erase all of the NPCs in your sim. | |
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.
|