Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
|
02-24-2008 06:50
**Many thanks to all that replied!** Found an excellent anti idle script I use all the time and it works a good 98% of the time stopping my av from being logged out- I would like it to change textures instead of colors though, so if anyone can adjust the script just tell me what I owe you besides my thanks ... // Super simple stay awake HUD. Looks like an "8" when off (green) // and a lemniscate (infinity) when on (red) // Public Domain by Noland Brokken. // vector C0 = <0,0.4,0>; // Off Color vector C1 = <1,0.0,0>; // On Color vector C2 = <1,1,1>; // Triggered Color float timespan = 0.5; // time between checks float Volume = 1.0; // Volume for sound fx (0.0 - 1.0)
key OwnerKey; integer active; integer numsounds; string soundfile;
upd() { llSetLinkColor(ALL_SIDES,llList2Vector([C0,C1],active),ALL_SIDES); llSetTimerEvent(active * timespan); llSetRot(llEuler2Rot(<active * PI_BY_TWO,0,0>)); }
default { state_entry() { OwnerKey = llGetOwner(); active = FALSE; numsounds = llGetInventoryNumber(INVENTORY_SOUND); if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { llRequestPermissions(OwnerKey, PERMISSION_TRIGGER_ANIMATION); } upd(); } on_rez(integer r) { llOwnerSay("Click me to enable/disable. RED is on. GREEN is off."); } changed(integer change) { if(change & (128 | CHANGED_INVENTORY)) // You'd better put this in the // changed() event when you use llGetOwner { // by way of precaution. llResetScript(); } }
timer() { if (llGetAgentInfo(OwnerKey) & AGENT_AWAY) { llSetLinkColor(ALL_SIDES,C2,ALL_SIDES); do { llStopAnimation("away");} while (llGetAgentInfo(OwnerKey) & AGENT_AWAY); integer n = llFloor(llFrand((float)numsounds- .00001)); soundfile = llGetInventoryName(INVENTORY_SOUND, n); if (Volume > 0.0) if (llGetInventoryType(soundfile) != -1) llTriggerSound(soundfile, Volume); llSetLinkColor(ALL_SIDES,C1,ALL_SIDES); } } touch_start(integer n) { if (llDetectedKey(0) != OwnerKey) return; active = !active; upd(); } }
|
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
|
02-24-2008 08:59
Are there really multiple prims in this HUD? The script below assumes so, and you have to put the number of prims that are in the linkset in the constant NUMLINKS. (Unfortunately, setting textures in a linkset doesn't have the cool shortcut that setting colors does). This compiles and runs, but I didn't really test it. You need to put the 3 textures you want to use, named (TexOff, TexOn, and TexTriggered), into the HUD's inventory. Took me 10 minutes, let's see at $40/hour that's $6.66, or roughly 6 times what the original HUD probably cost!! Well, that's not going to happen, lol!! Anyway, here it is: // Super simple stay awake HUD. Looks like an "8" when off (green) // and a lemniscate (infinity) when on (red) // Public Domain by Noland Brokken. // Tweaked by Nika Talaj to switch textures instead of colors // integer NUMLINKS = <however many prims are in the linkset>; list TEXTURES = ["TexOff", "TexOn", "TexTriggered"]; float timespan = 0.5; // time between checks float Volume = 1.0; // Volume for sound fx (0.0 - 1.0)
key OwnerKey; integer active; integer numsounds; string soundfile;
upd() { set_textures(active); llSetTimerEvent(active * timespan); llSetRot(llEuler2Rot(<active * PI_BY_TWO,0,0>)); }
set_textures(integer index) { integer i;
for (i = 0; i < NUMLINKS; i++) { llSetLinkTexture(i,llList2String(TEXTURES,index),ALL_SIDES); } }
default { state_entry() { OwnerKey = llGetOwner(); active = FALSE; numsounds = llGetInventoryNumber(INVENTORY_SOUND); if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { llRequestPermissions(OwnerKey, PERMISSION_TRIGGER_ANIMATION); } upd(); } on_rez(integer r) { llOwnerSay("Click me to enable/disable. RED is on. GREEN is off."); }
changed(integer change) { if(change & (128 | CHANGED_INVENTORY)) // You'd better put this in the // changed() event when you use llGetOwner { // by way of precaution. llResetScript(); } }
timer() { if (llGetAgentInfo(OwnerKey) & AGENT_AWAY) { set_textures(2); do { llStopAnimation("away");} while (llGetAgentInfo(OwnerKey) & AGENT_AWAY); integer n = llFloor(llFrand((float)numsounds- .00001)); soundfile = llGetInventoryName(INVENTORY_SOUND, n); if (Volume > 0.0) if (llGetInventoryType(soundfile) != -1) llTriggerSound(soundfile, Volume); set_textures(1); } } touch_start(integer n) { if (llDetectedKey(0) != OwnerKey) return; active = !active; upd(); } }
|
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
|
02-24-2008 09:30
From: Nika Talaj Took me 10 minutes, let's see at $40/hour that's $6.66, or roughly 6 times what the original HUD probably cost!! Well, that's not going to happen, lol!! Anyway, here it is:
My thanks and payment on the way- nice meeting you
|