I have this old script and the original creator is no longer around. I just cant figure out how to create an anchor point for this noose to tather on or hook on too for my old-school penal colony sim. Can some help create an anchor script for me??? I would much appreciated I have zero knowladge on scripting, just got into it a few days ago, picked up a few things here and there so im hoping to learn more from this as well. Im also hoping I picked the right scrip, forgive this Noob if I didnt, the darn thing came with a few scripts Im still trying to figure out so I picked the one that said "string" and "Anchor" hoping it was the right one =XP
string anchor="smf.gallows anchor";
integer listenhandle;
integer pos_chan;
float rope_length = 15;
float rope_length_remember = 15;
float add_length = 0.3;
float dampening = 0.2;
float bouncing = 0.001;
float constant = 10.0;
vector vel;
float velz;
key target;
vector ropecolor = <1,0,0>;
list rope_effect = [];
vector i_pos;
vector u_pos;
integer Key2Chan(key ID)
{
return 0x80000000 | (integer)("0x"+(string)ID);
}
default
{
state_entry()
{
llListenRemove(listenhandle);
llSleep(2.0); // wait for SCR.reset
rope_length = 15; // crazy long, so you don't get pulled up immediately
rope_length_remember = 15;
llSetStatus(STATUS_PHYSICS, TRUE); // make gravity active
llSensorRepeat(anchor, NULL_KEY , PASSIVE|ACTIVE, 10.0, PI,4); //scan a full sphere with a diameter of 10m every 4 seconds
}
no_sensor()
{
llResetScript();
}
sensor( integer num_detected )
{
pos_chan= Key2Chan(llDetectedKey(0)); // determines an unique communication channel
llListenRemove(listenhandle);
listenhandle = llListen(pos_chan, anchor, llDetectedKey(0), ""); //the name of the thing you listen to is 'anchor'
}
link_message(integer source, integer num, string msg, key id)
{
if (num == 1) rope_length = rope_length_remember;
if (msg == "start") // this is the first message SCR.dialog sends
{
rope_length = 4.2;
rope_length_remember = rope_length;
}
if (msg == "start pos")
{
rope_length = 4.2;
rope_length_remember = rope_length;
vector target_pos = u_pos + <0,0,-2.2>;
llMoveToTarget(target_pos,0.05);
llSleep(4.0);
llMoveToTarget(target_pos,0.0);
}
else if (msg == "short drop")
{
rope_length =1.8+ llFrand(0.3);
rope_length_remember = rope_length;
}
else if (msg == "medium drop")
{
rope_length = 2.1 + llFrand(0.3);
rope_length_remember = rope_length;
}
else if (msg == "long drop")
{
rope_length =3.7;;
rope_length_remember = rope_length;
}
else if (msg == "pull up")
{
rope_length = 0.7+ llFrand(0.3);
rope_length_remember = rope_length;
}
}
listen(integer chan, string name, key id, string msg)
{
if (chan == pos_chan) //only listen to the right anchor
{
i_pos = llGetPos(); //determine your own position
u_pos = (vector)msg; //determine the position of the anchor
if (llVecMag(u_pos-i_pos)>rope_length) //determine of the distance between you and the anchor exceeds the rope length
{
llSetForce(constant*llGetMass()*llVecNorm(u_pos-i_pos)*(llVecMag(u_pos-i_pos)- rope_length),FALSE);
llApplyImpulse( llGetMass() * llGetVel() * dampening * -1.0 , FALSE );
vector wrongway = llVecNorm(i_pos - u_pos);
float wrongmag = ( llGetVel() - llDetectedVel(0) ) * wrongway;
if ( wrongmag > 0.0 )
{
llApplyImpulse( llGetMass() * ( ( -1.0 - bouncing ) * ( wrongway * wrongmag ) ) , FALSE );
}
}
else
{
llApplyImpulse(-llGetMass()*llGetVel()*0.05,TRUE);
llSetForce( ZERO_VECTOR, TRUE );
llSetAngularVelocity(<0,0,0>,TRUE);
}
}
}
}