Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need Help

Almarea Lumiere
Registered User
Join date: 6 May 2004
Posts: 258
07-10-2004 14:04
I'll bet one of you really smart people out there can help me.

I'm making this rotating/sound effects/particle thingie which has several linked components, some invisible. Oh, and it's all phantom. No physics.

I wanted to occasionally be able to see the invisible parts so I added a listen with show/hide commands, and scripted the components to change texture based on link messages.

Here's the root prim code (codes 1 and 2 in the llMessageLinked call turn on and off sound effects in other linked prims).

CODE

integer rotating = 0;
default
{
state_entry()
{
llListen(0, "", NULL_KEY, "");
}
touch_start(integer total_number)
{
if (rotating)
{
llTargetOmega(<0,0,1>, 0.0, 1.0);
llMessageLinked(LINK_SET, 1, "", NULL_KEY);
rotating = 0;
}
else
{
llTargetOmega(<0,0,1>, .3, 1.0);
llMessageLinked(LINK_SET, 2, "", NULL_KEY);
rotating = 1;
}
}
listen(integer channel, string name, key id, string message)
{
if (message == "HideRotator")
{
llMessageLinked(LINK_SET, 9, "", NULL_KEY);
}
else if (message == "ShowRotator")
{
llMessageLinked(LINK_SET, 10, "", NULL_KEY);
}
}
link_message(integer sender, integer num, string str, key id)
{
if (num == 9)
{
llSetTexture("Invisible", ALL_SIDES);
}
else if (num == 10)
{
llSetTexture("Visible", ALL_SIDES);
}
}
}
After this change it started to go funny. Now I could click and drag it around as if it had physics on (it didn't -- I checked three times), and llTargetOmega stopped working consistently (I know the llTargetOmega statement was being executed because the sounds went on and off in response to the link messages which were sent out at the same time).

Every now and then I could get it to start or stop rotating (as it was supposed to) by touching it, but most of the time it wouldn't start (or wouldn't stop if it was going). However, when I clicked and dragged it the rotation stopped or started. Showing or hiding it also seemed to help.

Maybe the server is not telling the client about the llTargetOmega call until it has something else to say as well. I relogged, and it didn't help, and other objects sitting right next to it don't behave this way.

Shall I just throw it out and start over?

Help!

--Almarea
Ezhar Fairlight
professional slacker
Join date: 30 Jun 2003
Posts: 310
07-11-2004 05:30
You stumbled across several LSL quirks/bugs here.

1) It's normal that you can drag non-physical objects if, and only if they have a touch object. This is for llDetectedGrab to make any sense.

2) llSetTargetOmega does not properly resend the data to the client when the speed was changed. To force an update, change something else about the prim, for example the color (llSetColor). This is an (ancient) bug.

3) When selecting or touching an object that has llSetTargetOmega rotation, the object will stop rotating until you deselect it. This is supposedly a feature.
_____________________
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
07-11-2004 07:47
Remember, if you want to make something rotate with llTargetOmega, but you don't want other residents to be able to click on it, just enclose the thing with a box, then apply a 100% alpha texture to it. Put the "click on this" script on THAT.

Note that while you can link them, the parent must not contain an llTargetOmega Script. If it does, the entire linkset will rotate. Unfortunately, as we don't have hierarchical linking yet, llTargetOmega can only work on independent prims in a linkset. You can't have a linkset comprised of three prims, and have the two child objects rotate together. Also, if you do link them, clicking on or selecting the entire linkset will stop the rotating object.

If I haven't been clear enough here, check out the information booth I have at my store at Chartreuse 128,196. (Click View > Highlight Transparent to see what I'm talking about.)
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog