Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Push Object - Falls Over - Resets

Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
01-30-2008 04:50
Push Object - Falls Over - Resets Script

Hi --

I've written a few scripts but I don't even
know how to start this simple project idea.

Basically what I want to achieve is a scripted
object that if pushed or hit will fall over
like a domino and then after a few seconds
stands back up.

I've searched the forums and the oodles
of script examples I have but can't find
a good starting point.

Thanks for any help.

- Infrared
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-30-2008 15:50
I'll assume the object is physical, and take your domino example for usage....

I'd just institute a timer, trigger a state change on moving start, set the timer going, when it goes off, stop the timer, reset the position, and change back to your non moving state.

I would NOT recommend using moving_end for detecting anything with physical objects, since I've never seen it trigger (physical objects 'at rest' are actually vibrating in place)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
01-30-2008 21:16
Thanks Void, that makes sense.

If anyone could provide a chunk of example script it would be
much appreciated. I'm willing to pay a reasonable bounty.

What I want to do is set these "dominoes" up for cannon target
practice. Shoot them to knock them down and they stand back
up after let's say 15 seconds. I'm assuming it's a matter of
getting the initial rotation, and then reset the rotation based
on the timer.

I've seen some door scripts that come close...

Thanks again.

Infrared
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-31-2008 02:07
the literal interpretation of the script, good jumping off point
CODE

vector gPosSelf;
Rotation gRotSelf;

default{
state_entry(){
gPosSelf = llGetPos();
gRotSelf = llGetRot();
}

moving_start(){
state sMoved;
}
}

state sMoved{
state_entry(){
llSetTimerEvent( 10.0 );
}

timer(){
llSetPos( gPosSelf );
llSetRot( gRotSelf );
llSetTimerEvent( 0.0 );
state default;
}
}


in a non physical object a door script with the touch replaced by a collision event should work also
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -