User:Ezian Ecksol
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(); } }