OsGetLastChangedEventKey: Difference between revisions
From OpenSimulator
Jump to navigationJump to search
imported>Ubit No edit summary |
imported>Djphil Update Script |
||
| Line 5: | Line 5: | ||
|function_syntax=key osGetLastChangedEventKey() | |function_syntax=key osGetLastChangedEventKey() | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
// | |||
// osGetLastChangedEventKey Script Exemple | |||
// | |||
default | default | ||
{ | { | ||
state_entry() | |||
{ | |||
llSay(PUBLIC_CHANNEL, "Drop a item to this primitive's inventory to see osGetLastChangedEventKey usage."); | |||
llAllowInventoryDrop(TRUE); | |||
} | |||
changed(integer change) | |||
changed(integer | |||
{ | { | ||
if ( | if (change & CHANGED_INVENTORY) | ||
{ | |||
llSay(PUBLIC_CHANNEL, "The inventory has changed ..."); | |||
} | |||
if (change & CHANGED_ALLOWED_DROP) | |||
{ | { | ||
llSay(PUBLIC_CHANNEL, "An item has been dropped in this primitive's inventory"); | |||
key id = osGetLastChangedEventKey(); | key id = osGetLastChangedEventKey(); | ||
if(id != "") | |||
if (id != "") | |||
{ | { | ||
key who = osGetInventoryLastOwner(id); | key who = osGetInventoryLastOwner(id); | ||
llSay( | llSay(PUBLIC_CHANNEL, "I got inventory dropped item " + (string)id); | ||
llSay(PUBLIC_CHANNEL, "Item dropped by "+ (string)who + " (" + llKey2Name(who) + ")"); | |||
llSay(PUBLIC_CHANNEL, "The item name is " + osGetInventoryName(id)); | |||
llSay(PUBLIC_CHANNEL, "The item description is " + osGetInventoryDesc(id)); | |||
} | |||
else | |||
{ | |||
llSay(PUBLIC_CHANNEL, "This item id is empty ..."); | |||
} | } | ||
} | } | ||
} | |||
} | } | ||
</source> | </source> | ||
Revision as of 16:10, 2 December 2020
key osGetLastChangedEventKey()
| |
| Returns id(key) parameter of some changed events. Currently only works with CHANGED_ALLOWED_DROP, being the id of the dropped item. Returns empty key ("") if none found. | |
| Threat Level | This function does not do a threat level check |
| Permissions | Use of this function is always allowed by default |
| Extra Delay | 0 seconds |
| Example(s) | |
//
// osGetLastChangedEventKey Script Exemple
//
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Drop a item to this primitive's inventory to see osGetLastChangedEventKey usage.");
llAllowInventoryDrop(TRUE);
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llSay(PUBLIC_CHANNEL, "The inventory has changed ...");
}
if (change & CHANGED_ALLOWED_DROP)
{
llSay(PUBLIC_CHANNEL, "An item has been dropped in this primitive's inventory");
key id = osGetLastChangedEventKey();
if (id != "")
{
key who = osGetInventoryLastOwner(id);
llSay(PUBLIC_CHANNEL, "I got inventory dropped item " + (string)id);
llSay(PUBLIC_CHANNEL, "Item dropped by "+ (string)who + " (" + llKey2Name(who) + ")");
llSay(PUBLIC_CHANNEL, "The item name is " + osGetInventoryName(id));
llSay(PUBLIC_CHANNEL, "The item description is " + osGetInventoryDesc(id));
}
else
{
llSay(PUBLIC_CHANNEL, "This item id is empty ...");
}
}
}
}
| |
| Notes | |
| This function was added in 0.9.1.0, February, 22 2019 | |