Difference between revisions of "User:Jana Kamachi/Tp2Cam"

From Second Life Wiki
Jump to navigation Jump to search
(New page: '''NOTE:''' This can be tricky to setup. If you alter the script, you have to drop the prim on the ground and then attach it again. It must be put in a physical prim on the ground, and the...)
 
 
Line 1: Line 1:
{{Jana}}
'''NOTE:''' This can be tricky to setup. If you alter the script, you have to drop the prim on the ground and then attach it again. It must be put in a physical prim on the ground, and then attached. If you reset the script, drop and attach. Ect, ect.
'''NOTE:''' This can be tricky to setup. If you alter the script, you have to drop the prim on the ground and then attach it again. It must be put in a physical prim on the ground, and then attached. If you reset the script, drop and attach. Ect, ect.
<pre>
<pre>

Latest revision as of 17:24, 19 November 2007

If you like this script, or any script I've released, please post on my Talk page, or I'll most likely never see it o: If you want to improve a script, just go for it!


NOTE: This can be tricky to setup. If you alter the script, you have to drop the prim on the ground and then attach it again. It must be put in a physical prim on the ground, and then attached. If you reset the script, drop and attach. Ect, ect.

integer i=0;
//Channels
integer MOVE_TO =   7000;
vector  target  =   <0,0,0>;
integer move_target=0;
default
{
    state_entry(){
        llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA);
    }

    touch(integer total_number){
        llMessageLinked(LINK_SET,7000,(string)llGetCameraPos(),"");
    }
    
    link_message(integer sn, integer c, string msg, key id){
        if(c==MOVE_TO){
            target = (vector)msg;
            if(target.x > 0 && target.x < 256){
                move_target = llTarget(target,0.001);
                llSetTimerEvent(0.0001);
            }
        }
    }
    
    timer(){
        llMoveToTarget(target,0.0444444444444);
        llApplyImpulse((target - llGetPos()) * llVecDist(target,llGetPos()),FALSE);
        i++;
        if(i>100){
            llOwnerSay("Timed out");
            llTargetRemove(move_target);
            llSetTimerEvent(0);
            llStopMoveToTarget();
            i = 0;
            return;
        }
    }
    
    at_target(integer tnum, vector targetpos, vector ourpos){
        llApplyImpulse(-llGetVel(),FALSE);
        llTargetRemove(tnum);
        llSetTimerEvent(0);
        //llOwnerSay("Target " + (string)target + ":: Location: " + (string)llGetPos());
        llStopMoveToTarget();
    }
}