Change font size
It is currently Thu Nov 22, 2018 6:25 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 4 posts ]
Author Message
 Post subject: Start and Stop Spin Script
PostPosted: Fri May 16, 2008 3:05 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
{L_CODE}:
integer Switch = FALSE;

default
{
    state_entry()
    {
        llTargetOmega(<0,0,1>,0,1.0); // stop spinning
    }
        touch_start(integer total_number)
    {
        if(Switch == FALSE)
        {
            Switch = TRUE;
            llSay(0, "On");
            llTargetOmega(<0,0,1>,PI,1.0); //start spinning
        }
        else
        {
            Switch = FALSE;
            llSay(0, "Off");
            llTargetOmega(<0,0,1>,0,1.0); // stop spinning
        }
    }
}


Top
 Profile  
 
 Post subject: Re: Start and Stop Spin Script
PostPosted: Sat Jan 02, 2010 3:22 pm 
Furious Typer

Joined: Wed May 20, 2009 9:36 am
Posts: 90
Perfect, just what I was looking for... Is there a way, to have it start by touch, but shut off after a determined time?

Like say, I was using this for a carousel... People could touch it to start it, it would run for say, 30 secs or whatever, then automatically stop spinning...

That would rock if you could help me out with that...


Top
 Profile  
 
 Post subject: Re: Start and Stop Spin Script
PostPosted: Sat Jan 02, 2010 3:40 pm 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
Here you go Will,

{L_CODE}:
integer Switch = FALSE;

StopSpin()
{
    Switch = FALSE;
    llWhisper(0, "Spinning Off");
    llTargetOmega(<0,0,1>,0,1.0); // stop spinning
}
StartSpin()
{
    Switch = TRUE;
    llSetTimerEvent(30.0); // change to whatever value you wish
    llWhisper(0, "Spinning On");
    llTargetOmega(<0,0,1>,PI,1.0); //start spinning
}

default
{
    state_entry()
    {
        llTargetOmega(<0,0,1>,0,1.0); // stop spinning
    }
    touch_start(integer total_number)
    {
        if(Switch == FALSE)
        {
            StartSpin();
        }
        else
        {
            StopSpin();
        }
    }
    timer()
    {
        llSetTimerEvent(0.0); // kills Timer Event
        if(Switch) StopSpin();  // it is true so stopspin
    }
}


_________________
No further support of any kind, for any of my materials. Use as/is whereis.
PLEASE UNSTICKY Any Stickied Posting by myself.


Top
 Profile  
 
 Post subject: Re: Start and Stop Spin Script
PostPosted: Sat Jan 02, 2010 5:09 pm 
Furious Typer

Joined: Wed May 20, 2009 9:36 am
Posts: 90
Thanks WhiteStar! Going to try it out now! Working on something for the next OSG B-day Celebration, and this script is rather vital to my project!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 4 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net