Thanks Billie! Sadly, it's a lil' choppy, and is the same one I'm using now... I DO have one, and will glady share it. It's very smooth, and does exactly what I want it to, the only problem is, I'm trying to get it to listen on a certain channel, to start and stop it from swinging, but not having much luck getting that to work... Funny tho, I've made every other script work in this manner... Thought I was gettin' prett good at it haha...
Any way, here's the un altered smooth swing script...
Code:
float distance = 1.6;
float timetotake = 3.8;
float speed;
rotation backrot;
rotation forerot;
rotation stoprot;
startSwing()
{
vector vDir;
speed = distance / timetotake;
llSetTimerEvent(timetotake);
vDir = llRot2Up(llGetRot());
llSetRot(stoprot);
llTargetOmega( vDir, -distance / ( 2 * timetotake ), 1.0 );
}
swingchange()
{
vector vDir = llRot2Up(llGetRot());
if( speed < 0 ) {
llSetRot(backrot);
} else {
llSetRot(forerot);
}
llTargetOmega( vDir, speed, 1.0 );
speed = 0 - speed;
}
integer swinging = 0;
default
{
on_rez(integer sp)
{
llResetScript();
}
state_entry()
{
rotation rrot = llGetRot();
vector vrot = llRot2Euler( rrot );
stoprot = rrot;
vrot.z += distance/2;
backrot = llEuler2Rot( vrot );
vrot.z -= distance;
forerot = llEuler2Rot( vrot );
llTargetOmega(<0,0,0>, 0, 0.0);
swinging = 0;
}
timer()
{
swingchange();
}
touch_start(integer total_number)
{
if( swinging > 0 ) {
swinging = 0;
llSetTimerEvent(0.0);
llTargetOmega(<0,0,0>, 0, 0.0 );
llSetRot(stoprot);
llTargetOmega(<0,0,0>, 0, 0.0 );
} else {
swinging = 1;
startSwing();
}
}
moving_end()
{
llSleep(2.0);
llResetScript();
}
}
If anyone wants to try to make it listen for certain messages to make it start and stop via another prim (remote) here's what has worked so many times in the past...
Trying to add this type of code to it...
Code:
llListen(666610, "", NULL_KEY, "" );
Code:
listen(integer number, string name, key id, string message)
Code:
if(message=="swing")
{
swing=1;
}
{ if(message=="stop")
swing=0;
Any ideas how to make that type system work on this script? It's just basic stuff really, but that's what I need, listen for a message on a certain channel to start/stop.
Anyway, have fun if you can use the script, may need adjusting as it's a script from SL. And thanks in advance if you can get it to do what I need!