User:ANSI Soderstrom/Event Scanner CHANGED
Jump to navigation
Jump to search
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); } }
}
ResetMe() {
ClearPrimMemory(); llResetScript();
}
ClearPrimMemory() {
llSetSitText(""); llSetTouchText(""); llParticleSystem([]); llSetText("",ZERO_VECTOR,1.0 ); llTargetOmega(ZERO_VECTOR,0,0 ); llSetCameraAtOffset(ZERO_VECTOR); llSetCameraEyeOffset(ZERO_VECTOR); llSitTarget(ZERO_VECTOR,ZERO_ROTATION); llSetTextureAnim(FALSE,ALL_SIDES,1,1,0,0,0.0); llStopSound(); llResetTime();
}
default {
state_entry() { // your code here.... } on_rez(integer i) { ResetMe(); } attach(key id) { ResetMe(); } changed(integer change) { search(change); if (change & (CHANGED_INVENTORY | CHANGED_OWNER)) { ResetMe(); }
}
}
</lsl>