|
Niles Todd
Registered User
Join date: 20 Jul 2006
Posts: 17
|
10-26-2006 23:43
I need a script that can move 4 prims in sync at one touch and then move them back to there org position. The item in question is a cord/chain that you pull. So when you pull it it returns to where it should be in it closed state if you like.
The script needs to be full permission so I can use it in my build with no fuss.
I hope one of you cleaver people out there can help!
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
10-27-2006 02:34
If the four prims are linked and move as one object than you need only add a script to the root prim with something like the following: vector starting_pos = <128,128,50>; vector ending_pos = <128,128,55>;
default { state_entry() { llSetPos(starting_pos); }
touch_start(integer x) { llSetPos(ending_pos); llSetTimer(1.0); // how long before we return to the other position }
timer() { llSetPos(starting_pos); llSetTimer(0.0); // clear timer, so it doesn't re-trigger every 1 second } }
Of course this is an over-simplified script and perhaps you need rotations or the 4 prims you referred to cannot be linked / behave differently, please elaborate so that the friendly people of the Scripting tips forum can help. Alternatively you could post in products wanted for a scripter to do the work for you.
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|
|
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
|
10-27-2006 08:49
Nand, that would move the whole object, which I don't think is the desired result given the description (and why use a timer when you could just use a llSleep?). What you're going to need is a script in the cord that sends a link message (llMessageLinked) to all prims in the set (LINK_ALL_OTHERS) in a touch_start event. You'll then need scripts in the prims you want moving that will move them on a message_linked event. So, for the cord: default { touch_start(integer num) { llMessageLinked(LINK_ALL_OTHERS,0,"anim1",""); llSleep(1.0); //whatever the total delay is in the prim scripts (0.2+delay+0.2=total). this is to prevent buffer problems. } } and the prims: default { link_message(integer sender, integer num, string str, key id) { if (str=="anim1") { llSetPos(<0,0,1>); //set the offset as you like llSleep(1.0); //set sleeptime as you wish. Keep in mind there's an automatic 0.2 second sleep after llSetPos, so this would actually come to 1.2 seconds. llSetPos(<0,0,1>); //whatever the original position was } }
} that should do it.
|
|
Gwaland Golem
Registered User
Join date: 1 Nov 2005
Posts: 9
|
Correct me if I'm wrong
10-27-2006 09:22
Wouldn't this leave the original prim that you touched in place though?
Since it did not get moved it only called the linked message. Since you used LINK_ALL_OTHERS instead of LINK_SET even if you put the second script in the original object to be touched it would not move while the others did. The goal in this I thought was to move the chord when touched/pulled.
|