Difference between revisions of "User:Ezian Ecksol"
Ezian Ecksol (talk | contribs) |
Ezian Ecksol (talk | contribs) |
||
Line 1: | Line 1: | ||
== Some Scripts == | |||
'''1-Prim Digiclock''' | '''1-Prim Digiclock''' | ||
Line 99: | Line 103: | ||
}</lsl> | }</lsl> | ||
---- | ---- | ||
'''Cam Lock/Follow''' | '''Cam Lock/Follow''' |
Revision as of 02:06, 23 September 2008
Some Scripts
1-Prim Digiclock
<lsl>// 1-Prim Digiclock // (c) Ezian Ecksol, open source, keep credits // // put to object description the GMT offset in hours, e.g 2.5 // touch to turn on/off
list faces = [3,2.05,.6, 7,.795,0., 4,-11.5,-0.73, 6,.795,0., 1,2.05,-0.6]; key tx = "2b43c7d6-c96a-b5d9-7210-8bc15451252f"; float tx_step = 0.0625; float tx_step_2; float tx_base; integer presence0; float gmt_offset; float clock_cycle; float clock_time; integer clock_mode = TRUE;
list construct_face(integer f, integer z) {
integer i = f*3; return [PRIM_TEXTURE, llList2Integer(faces,i), tx, <llList2Float(faces,i+1), tx_step, 0.0>, <llList2Float(faces,i+2), tx_base-(float)z*tx_step, 0.0>, 0.0];
}
setprim(integer z1, integer z2, integer z3, integer z4, integer z5) {
llSetPrimitiveParams( construct_face(0,z1)+construct_face(1,z2)+ construct_face(2,z3)+construct_face(3,z4)+ construct_face(4,z5));
}
clock() {
clock_time = llGetGMTclock() + gmt_offset*3600.0; integer s = (integer) clock_time; integer h = (s / 3600) % 24; integer m = s % 3600; m = m / 60; setprim(h/10,h%10,10,m/10,m%10); llResetTime();
integer w1 = (integer) (clock_time / clock_cycle); float w2 = clock_time - (float)w1 * clock_cycle; llSetTimerEvent(clock_cycle-w2);
}
default {
state_entry() { integer f; integer i; list j; gmt_offset = (float)llGetObjectDesc(); tx_step_2 = tx_step / 2.; tx_base = 0.5 - tx_step_2; clock_cycle = 60.0; setprim(11,11,11,11,11); for (i=0; i<15; i+=3) { f = llList2Integer(faces,i); j += [PRIM_GLOW,f,.01, PRIM_COLOR, f, <0., 0., 1.>, 1.]; } llSetPrimitiveParams([ PRIM_TYPE, PRIM_TYPE_PRISM, 1, <0.2, 0.8, 0.0>, 0.7, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, PRIM_SIZE, <0.01, 1.777, 0.577>, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, <0., 0., 1.>, 0.] + j); clock(); } on_rez(integer p) { llResetScript(); }
touch_start(integer total_number) { if (llGetOwner() == llDetectedKey(0)) { clock_mode = !clock_mode; if (clock_mode) { clock(); } else { llSetTimerEvent(0.); setprim(15,15,15,15,15); } } } timer() { clock(); }
}</lsl>
Cam Lock/Follow
<lsl>
// Camstyle, (c) Ezian Ecksol, feel free to copy, steal, modify
// Put script into prim, attach it. // usage: position your camera where you like. // enter in chan: // /1 camstyle follow <-- camera is fixed, but follows your av // /1 camstyle lock <-- camera is completly locked // /1 camstyle <-- releases cam again
integer chan = 1;
key owner; list keywords = ["lock", "follow"];
cam_style(integer cs) {
llRequestPermissions(owner, PERMISSION_CONTROL_CAMERA | PERMISSION_TRACK_CAMERA); llClearCameraParams(); if (!cs) return; vector cpos = llGetCameraPos(); list params = [CAMERA_ACTIVE, TRUE, CAMERA_POSITION_LOCKED, TRUE, CAMERA_POSITION_THRESHOLD, 0.5, CAMERA_FOCUS_THRESHOLD, 0.5, CAMERA_POSITION, cpos]; if (cs == 1) params += [ CAMERA_DISTANCE, .5, // ( 0.5 to 10) meters CAMERA_BEHINDNESS_LAG, 0.1, // (0 to 3) seconds CAMERA_PITCH, 10.0, // (-45 to 80) degrees CAMERA_FOCUS, cpos + llRot2Fwd(llGetCameraRot()), // region-relative position CAMERA_FOCUS_LAG, 0.1, // (0 to 3) seconds CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_POSITION_LAG, 1.0 // (0 to 3) seconds ]; else if (cs == 2) params += [ CAMERA_FOCUS_LAG, 0.0, // (0 to 3) seconds CAMERA_BEHINDNESS_LAG, 0.5 // (0 to 3) seconds
]; llSetCameraParams(params);
}
default {
state_entry() { owner = llGetOwner(); llListen(chan, "", owner, ""); } listen(integer channel, string name, key id, string msg) { msg = llToLower(msg); list m = llParseString2List(msg, [" "], []); if (llList2String(m, 0) == "camstyle") cam_style(llListFindList(keywords, [llList2String(m, 1)]) + 1); }
changed(integer c) { if (c & CHANGED_OWNER) llResetScript(); }
} </lsl>