Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripts in worn objects

Winter Torgeson
Addicted
Join date: 1 Jun 2004
Posts: 9
04-12-2005 09:51
Hey yall!

I want to create a watch for people to wear. When they click on the watch, I want it to open, like one of those old timey watches. So I made a test. I took an object and put in a script that rotates the object when clicked (Touched). It works when rezzed on the ground. It did not work when worn.

How do I get a object to rotate when worn?

Thank you guys!
Winter
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-12-2005 10:37
Hello fellow resident of hell in summer.

Attachments cannot rotate. You'll need to create two frames, then animate between them. You can use several commands to do this. Among them, you can use:

http://secondlife.com/badgeo/wakka.php?wakka=touch_start
http://secondlife.com/badgeo/wakka.php?wakka=llMessageLinked
http://secondlife.com/badgeo/wakka.php?wakka=link_message
http://secondlife.com/badgeo/wakka.php?wakka=llSetAlpha
http://secondlife.com/badgeo/wakka.php?wakka=llSetLinkAlpha
_____________________
---
Winter Torgeson
Addicted
Join date: 1 Jun 2004
Posts: 9
04-12-2005 11:16
From: Jeffrey Gomez
Hello fellow resident of hell in summer.



Yeah its hot and humid as can be in August. But the rest of the year its a paradise most people can only dream of. I laugh at those poor soles in Chicago in January. haha.

I live in the pennbroke pines area. (I had something else on my mind when I wrote that originally lol).
Winter Torgeson
Addicted
Join date: 1 Jun 2004
Posts: 9
04-12-2005 11:23


Ok what do you mean "frames". Do you mean separate objects that will rez or die on command?
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
04-12-2005 13:04
From: Winter Torgeson
Ok what do you mean "frames". Do you mean separate objects that will rez or die on command?


I think "frames" here is being used in the animation sense. Make a series of objects, each of which is positioned where one frame of the animation should be located. The simplest example for a pocket watch would be two frames, one with the lid open, one with it closed. You could also add intermediate frames with the watch in various states between fully opened and fully closed if you want.

Instead of rezzing and de-rezzing the objects, simply make some of the frames invisible. You can use llSetAlpha and llSetLinkAlpha to turn an object completely transparent, and therefore hide it from view. Do this in sequence to the objects that make up your animation, making each frame visible in turn, and you can make it look like the watch is opening and closing. It's not a perfect illusion, but it makes it possible to make something look like it's rotating when attached.
_____________________
Come visit the In Effect main store and café
Drawbridge (160, 81)
Particle effects, fashion, accessories, and coffee!
On the Web at SL Exchange and SL Boutique
Kiefer Beckett
Confused
Join date: 22 Jun 2004
Posts: 106
04-12-2005 13:18
From: Chandra Page
I think "frames" here is being used in the animation sense. Make a series of objects, each of which is positioned where one frame of the animation should be located. The simplest example for a pocket watch would be two frames, one with the lid open, one with it closed. You could also add intermediate frames with the watch in various states between fully opened and fully closed if you want.

Instead of rezzing and de-rezzing the objects, simply make some of the frames invisible. You can use llSetAlpha and llSetLinkAlpha to turn an object completely transparent, and therefore hide it from view. Do this in sequence to the objects that make up your animation, making each frame visible in turn, and you can make it look like the watch is opening and closing. It's not a perfect illusion, but it makes it possible to make something look like it's rotating when attached.



Thank you Chandra. I understand now. More work with prims than I expected but thats ok.
_____________________
A tired mind become a shape shifter
Everybody need a mood lifter
[Rush - Vital Signs]
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
04-12-2005 13:18
hehe, I hate it when my objects wear out. makes the scripts do funny things.
_____________________
Michael Psaltery
Registered User
Join date: 6 Jun 2004
Posts: 57
04-12-2005 22:24
From: Chandra Page
I think "frames" here is being used in the animation sense. Make a series of objects, each of which is positioned where one frame of the animation should be located. The simplest example for a pocket watch would be two frames, one with the lid open, one with it closed. You could also add intermediate frames with the watch in various states between fully opened and fully closed if you want.

Instead of rezzing and de-rezzing the objects, simply make some of the frames invisible. You can use llSetAlpha and llSetLinkAlpha to turn an object completely transparent, and therefore hide it from view. Do this in sequence to the objects that make up your animation, making each frame visible in turn, and you can make it look like the watch is opening and closing. It's not a perfect illusion, but it makes it possible to make something look like it's rotating when attached.


I think that's a great idea, but I've noticed since the 1.6 upgrade that very often, when I set the alpha on an object to turn it from transparent to visible, it becomes visible, then briefly flashes invisible, then turns visible again. Submitted a bug report on this, but I still see it happen on occasion. Has anyone else noticed this kind of behavior? A simple way to test this would be something like:

default
{
on_rez()
{
llSleep(5);
llSetAlpha(0, ALL_SIDES);
llSleep(5);
llSetAlpha(1.0, ALL_SIDES);
}
}

You should see the object for 5 seconds, then it should turn invisible for 5 seconds, then it should turn visible again. What I'm seeing is that it does turn visible again, then disappears for a second, before finally becoming and staying visible. This will totally RUIN any effects that depend on smooth transitions of alpha.