Jump to content

script


D4N4E
 Share

You are about to reply to a thread that has been inactive for 1426 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi there,

~{NOTE}~
========
This script will make your object spin if you touch it once
and make it stop if you touch it again + it will respond to your commands only.
I hope this helps.

PS: u can modify the rotation speed by editing the speed variable.
cheers.

~{USER GUIDE}~
==============
1. right-click on the object.
2. edit.
3. choose the content tab.
4. click: new script.
5. open the script (called 'New Script').
6. paste the code below.
7. save.
8. left click on the object to trigger the script.

integer switch = 0;
float speed    = 3.14;
default
{
    touch_end(integer n)
    {
        key objOwnerKey   = llGetOwner();
        key objTriggerKey = llDetectedKey(0);
        if (objOwnerKey == objTriggerKey)
        {
            if (switch == 0)
            {
               llTargetOmega(llRot2Up(llGetLocalRot()), speed, 1.0);
               switch = 1;
            }
            else
            {
               llTargetOmega(llRot2Up(llGetLocalRot()), 0, 1.0);
               switch = 0;
            }
        }
    }
}

 

 

Edited by Eth3l
correction.
  • Like 1
Link to comment
Share on other sites

You can find "scrubber" scripts that remove prim properties such as this smooth rotation (llTargetOmega).

All you really need is a script that executes

llTargetOmega(ZERO_VECTOR, 0.0, 0.0);

in state_entry() to make it stop, then you can remove the script.

[ETA, just FYI: This isn't a bug or anything, it's a smart engineering decision to make these features controlled by script but not requiring a script to remain in the object for the feature to persist. It saves significant region resources when all the constant smooth rotation, texture animation, etc. keep working when scripts are removed -- as long as people remove the scripts. And, of course, it confuses the heck out of people the first time they encounter it.]

Edited by Qie Niangao
  • Like 3
Link to comment
Share on other sites

9 minutes ago, Fritigern Gothly said:

What?

What "what"?  It looks like your monitor has dropped off the deep end and locked you into dark mode.

Incidentally,  @D4N4E, it sounds like your script is spinning something with llTargetOmega. (Not "rotating", BTW, which is something else.) If so, you can't stop it easily,  That's a prim property.  It can only be started or stopped by a script, and it doesn't require a script to keep it going.  If you removed the script that was in it, the only way  you are likely to get the spinning to stop is to drop a new script in it to do the job.  A script like this:

default
{
    state_entry()
    {
        llTargetOmega(ZERO_VECTOR, 0.0,0.0);
        llRemoveInventory(llGetScriptName());
    }
}

That script should stop the spinning and then immediately remove itself.

EDIT:  Heh.  Qie got here first.  :)

Edited by Rolig Loon
  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1426 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...