User:ANSI Soderstrom/Event Scanner CHANGED
< User:ANSI Soderstrom
Jump to navigation
Jump to search
Revision as of 14:24, 26 January 2011 by ANSI Soderstrom (talk | contribs) (→Eventscanner: changed())
Leave a comment
Eventscanner: changed()
Find out what is really changing... Attached or loose...
<lsl> // Simple Eventscanner for changed() // (C) 01/2011 ANSI Soderstrom
list CHANGE = [ 1, "CHANGED_INVENTORY",
2, "CHANGED_COLOR", 3, "CHANGED_SHAPE", 4, "CHANGED_SCALE", 5, "CHANGED_TEXTURE", 6, "CHANGED_LINK", 7, "CHANGED_ALLOWED_DROP", 8, "CHANGED_OWNER", 9, "CHANGED_REGION", 10, "CHANGED_TELEPORT", 11, "CHANGED_REGION_START", 12, "CHANGED_MEDIA" ];
integer shift(integer bit) {
return 1 << bit;
}
search(integer number) {
integer i; for(i=llGetListLength(CHANGE)/2-1;~i;--i) { if(number - shift(i) >= 0) { llOwnerSay("Change detected : " + llList2String(CHANGE,i*2+1)); number = number - shift(i); } }
}
default {
state_entry() { // your code here.... } changed(integer change) { search(change); if (change & (CHANGED_INVENTORY | CHANGED_OWNER)) { llResetScript(); }
}
}
</lsl>