integer r=FALSE; key s; key t; key p=NULL_KEY; string a=""; integer b=FALSE; c(key d,string n) { p=d; a=n; llRequestPermissions(d,PERMISSION_TAKE_CONTROLS); } q(){ if(b) { p=NULL_KEY; b=FALSE; llReleaseControls(); } } f(vector g) { llSetRot(llEuler2Rot(llRot2Euler(llGetRot())+g*DEG_TO_RAD)); } default { on_rez(integer h) { llResetScript(); llSetStatus(STATUS_PHANTOM,TRUE) ; llVolumeDetect(FALSE); t=llGetOwner(); } state_entry() { llSitTarget(<0.0,0.0,1.0>,<0.0,0.0,0.0,1.0>); //you can adpt this llSetCameraEyeOffset(<-5.0,0.0,2.0>); llSetCameraAtOffset(<0.0,0.0,2.0>); } touch(integer j) { if(llDetectedKey(0)) { c(llDetectedKey(0),llDetectedName(0)); } } changed(integer u) { s=llAvatarOnSitTarget(); if(u&CHANGED_LINK) { if((s==p)&&(r)) { llReleaseControls(); r=FALSE; } else if(!r) { t=llAvatarOnSitTarget(); r=TRUE; llRequestPermissions(t,PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION); // llSetAlpha(0.0,ALL_SIDES); } } } control(key n,integer l,integer e) { if(l&CONTROL_FWD){llSetRegionPos(llGetPos()+(<0.05,0,0>)*llGetRot()); llModifyLand(LAND_LEVEL, LAND_SMALL_BRUSH); //llModifyLand(LAND_SMOOTH, LAND_SMALL_BRUSH); } if(l&CONTROL_BACK){llSetRegionPos(llGetPos()+(<-0.05,0,0>)*llGetRot()); } if(l&CONTROL_LEFT||l&CONTROL_ROT_LEFT){f(<0,0,2.0>); } if(l&CONTROL_RIGHT||l&CONTROL_ROT_RIGHT){f(<0,0,-2.0>); } if(l&CONTROL_UP){llSetRegionPos(llGetPos()+(<0,0,0.05>)*llGetRot()); } if(l&CONTROL_DOWN){llSetRegionPos(llGetPos()+(<0,0,-0.05>)*llGetRot()); llModifyLand(LAND_LOWER, LAND_SMALL_BRUSH); } } run_time_permissions(integer k) { if(k&PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_FWD|CONTROL_BACK|CONTROL_LEFT| CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT| CONTROL_UP|CONTROL_DOWN,TRUE,FALSE); b=TRUE; } if(k & PERMISSION_TRIGGER_ANIMATION) { // llStartAnimation("dz"); //llStopAnimation("sit"); } else { q(); } } }