Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Removing Touch to Start

Persian Chevalier
Registered User
Join date: 8 Jan 2007
Posts: 68
04-12-2008 16:23
I have made changes to this open source script to stop it from being a touch to start. Here is the script with the changes I made, but it's not working. Any help would be appreciated. I love the script, just want it to be running on rez. Thanks.

php
float distance = .25
;
float timetotake = 2.4;
float speed;
rotation backrot;
rotation forerot;
rotation stoprot;

startSwing()
{
vector vDir;

speed = distance / timetotake;
// llOwnerSay("Speed = " + (string)speed + " at start";);
llSetTimerEvent(timetotake);
vDir = llRot2Up(llGetRot());
llSetRot(stoprot);
llTargetOmega( vDir, -distance / ( 2 * timetotake ), 1.0 );
}

swingchange()
{
vector vDir = llRot2Up(llGetRot());

// llOwnerSay("timer(): gain=" + (string)gain);
// llTargetOmega( <0,0,0>, speed, 1.0 );
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 );

// vector vrot = llRot2Euler( llGetRot() );
// vrot.z = (distance/2);//2 * speed;
// backrot = llEuler2Rot( vrot );
// vrot.z = -(distance/2);//-2 * speed;
// forerot = llEuler2Rot( vrot );
llTargetOmega(<0,0,0>, 0, 0.0);
swinging = 1;
// vrot.z = 0;
// stoprot = llEuler2Rot( vrot );
// llSetRot( stoprot );
// llOwnerSay("Backrot: " + (string)backrot + ", forerot: " + (string)forerot);
}

timer()
{
swingchange();
}

touch_start(integer vNull)

(I added the null, it was total_number, and the state sMoving and commented the swinging info.)

{
state sMoving;
}
}
state sMoving{

//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();

(took out }
} here)


moving_end()
{
llSleep(2.0);
llResetScript();

}
}

/php
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-12-2008 22:56
CODE

//Created by Sandeo Goodman. Free to use as long as credit remains :-)
//Modded by Johan Laurasia, now swings on state_entry

float distance = .25;
float timetotake = 2.4;
float speed;
rotation backrot;
rotation forerot;
rotation stoprot;
integer swinging = 0;

startSwing()
{
vector vDir;
speed = distance / timetotake;
// llOwnerSay("Speed = " + (string)speed + " at start");
llSetTimerEvent(timetotake);
vDir = llRot2Up(llGetRot());
llSetRot(stoprot);
llTargetOmega( vDir, -distance / ( 2 * timetotake ), 1.0 );
}

swingchange()
{
vector vDir = llRot2Up(llGetRot());
// llOwnerSay("timer(): gain=" + (string)gain);
// llTargetOmega( <0,0,0>, speed, 1.0 );
if( speed < 0 )
{
llSetRot(backrot);
}
else
{
llSetRot(forerot);
}
llTargetOmega( vDir, speed, 1.0 );
speed = 0 - speed;
}



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 );
// vector vrot = llRot2Euler( llGetRot() );
// vrot.z = (distance/2);//2 * speed;
// backrot = llEuler2Rot( vrot );
// vrot.z = -(distance/2);//-2 * speed;
// forerot = llEuler2Rot( vrot );
llTargetOmega(<0,0,0>, 0, 0.0);
swinging = 0;
// vrot.z = 0;
// stoprot = llEuler2Rot( vrot );
// llSetRot( stoprot );
// llOwnerSay("Backrot: " + (string)backrot + ", forerot: " + (string)forerot);
swinging = 1;
startSwing();
}

timer()
{
swingchange();
}

moving_end()
{
llSleep(2.0);
llResetScript();
}
}

Bitsy Melson
Registered User
Join date: 2 Feb 2008
Posts: 10
can you help me Josh?
04-12-2008 23:36
Josh - I have no idea what this thread is about - I'm not that savy on the computer - all I want is to be able to run SL from my flashdrive (as I did with the last version) - instead of installing it on my computer (I have limited permission). Would YOU know how to do that?
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
04-13-2008 00:20
Sorry, Josh has left the building.
_____________________
There are no stupid questions, just stupid people.
Bitsy Melson
Registered User
Join date: 2 Feb 2008
Posts: 10
Can you help me?
04-13-2008 00:27
can you tell me step by step (I am so computer illiterate) how to do this? as in - go to start - go to c drive - or whatever I need to do?
http://ets.tlt.psu.edu/gaming/SLOnAFlashDrive
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-13-2008 01:29
From: Bitsy Melson
can you tell me step by step (I am so computer illiterate) how to do this? as in - go to start - go to c drive - or whatever I need to do?
http://ets.tlt.psu.edu/gaming/SLOnAFlashDrive


You should start a separate thread, you're completely off topic and in the wrong forum, try asking in resident answers.
Bitsy Melson
Registered User
Join date: 2 Feb 2008
Posts: 10
thanks
04-13-2008 01:31
Thank you - I did - should I delete all my posts from here?