Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripting objects within objects ... can it be done?

Six Dosei
Second Lifer
Join date: 10 Sep 2006
Posts: 18
02-26-2007 08:25
Hi all!

Six Dosei here and I have a question concerning scripts and objects within objects. I'm trying to make a small two-prim object (diamond) spin inside another, larger two-prim object while making the larger prim spin in the opposite direction. Hopefully my crudely drawn image will help you get a visual of what I mean?

I'm trying to make the smaller diamond move in a clockwise direction while having the larger diamond move in the opposite direction. I know that I have to link the two smaller prims together and from there put my spin scipt in it but how do I get the larger diamond shape to spin in the opposite direction? I have no problem linking the larger diamond pieces together and getting them to spin in the opposite direction but when I try to link both sets of diamonds together, the diamond pieces come apart and spin in different directions. How do I fix this?

I want to have both spinning objects going at the same time in different directions, but it isn't looking like I'll be able to manage this unless someone else more knowledgable with scripts can help me. I've looked in the forums for "scipting multiple objects" but nothing came up that discussed this particular problem but if anyone here is able to point me in the right direction to solving this puzzle; I'd be very appreciative! Heck, I'll even give you the object I'm trying to make ^_^!

Thank you for helping me out on this one ^_^!

OH YEAH!

this is the script that is currently inside the smaller diamond:

default
{
state_entry()
{
llTargetOmega(<0,0,2.5>, 3, 3);
}
}


and this is the script in the larger diamond:

default
{
state_entry()
{
llTargetOmega(<0,0,2.5>, -3, 3);
}
}


Maybe I need to use a completely different script for this proj
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
multiple scripts
02-26-2007 09:55
From: Six Dosei
Hi all!

Six Dosei here and I have a question concerning scripts and objects within objects. I'm trying to make a small two-prim object (diamond) spin inside another, larger two-prim object while making the larger prim spin in the opposite direction. Hopefully my crudely drawn image will help you get a visual of what I mean?

I'm trying to make the smaller diamond move in a clockwise direction while having the larger diamond move in the opposite direction. I know that I have to link the two smaller prims together and from there put my spin scipt in it but how do I get the larger diamond shape to spin in the opposite direction? I have no problem linking the larger diamond pieces together and getting them to spin in the opposite direction but when I try to link both sets of diamonds together, the diamond pieces come apart and spin in different directions. How do I fix this?

I want to have both spinning objects going at the same time in different directions, but it isn't looking like I'll be able to manage this unless someone else more knowledgable with scripts can help me. I've looked in the forums for "scipting multiple objects" but nothing came up that discussed this particular problem but if anyone here is able to point me in the right direction to solving this puzzle; I'd be very appreciative! Heck, I'll even give you the object I'm trying to make ^_^!

Thank you for helping me out on this one ^_^!

OH YEAH!

this is the script that is currently inside the smaller diamond:

default
{
state_entry()
{
llTargetOmega(<0,0,2.5>, 3, 3);
}
}


and this is the script in the larger diamond:

default
{
state_entry()
{
llTargetOmega(<0,0,2.5>, -3, 3);
}
}


Maybe I need to use a completely different script for this proj


Sure, go right ahead and drop multiple scripts in multiple objects, also, you can drop multiple scripts into a single object as well. Just remember, when linking multiple scripted objects together to select one of the scripted objects last, otherwise, all the prims will not run their scripts.
Carlisse Midnight
Registered User
Join date: 17 May 2003
Posts: 11
02-27-2007 08:36
a spin script in a child prim spins just the child prim. a spin script in a root prim spins all linked prims.

So you need to have both those prims be child prims to spin opposite directions, I think. make the root prim a 3rd prim.

you might need to put a script in the root prim per above too - it could stop/start the spinning, or it could just do nothing much but be there :)
Imhic Schlegal
Registered User
Join date: 11 Nov 2006
Posts: 3
02-27-2007 22:27
There's a few ways you can go about this, but if one is centered inside the other, you could double the rotation of the child prim, which would make up for the opposite rotation of the root prim. However, if the child prim is not centered inside the root prim, and the prims aren't going to be relocating after being rez'd, you could just have one prim rez the other prim. If it's going to be moving around, then the previous post is probably your best bet, add another prim and make it the root prim. Hope that helps, good luck.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-28-2007 00:43
Adding to Imhic's idea you could always send the rezzed prim a die message if the main prim is moved and rez a new one when the movement stops.