bingbangboom Bixby
Registered User
Join date: 17 Aug 2004
Posts: 92
|
07-01-2005 05:23
I wanted to make my own hammock and was wondering if there was a free script cause I've never made something that moves. Might use it for various projects too. Just think it is interesting.
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
07-01-2005 06:30
Heres what I use, I bet with a bit of modification here and there it should work pretty well. integer SW_OPEN = FALSE; integer SW_CLOSE = TRUE; integer SW_NORMAL = FALSE; integer SW_REVERSE = TRUE; key gfOwnerKey; integer gfDoorClosed; integer gfDoorSwing;
gmInitFields() { gfOwnerKey = llGetOwner(); gfDoorClosed = TRUE; gfDoorSwing = SW_NORMAL; return; } gmSwingDoor(integer direction) { rotation rot; rotation delta; float piVal; if (direction == SW_OPEN) { piVal = PI/4; if (gfDoorSwing == SW_REVERSE) { piVal = -PI/4; } } else { piVal = -PI/4; if (gfDoorSwing == SW_REVERSE) { piVal = PI/4; } } rot = llGetRot(); delta = llEuler2Rot(<0,0,piVal> ); rot = delta * rot; llSetRot(rot); llSleep(0.05); rot = delta * rot; llSetRot(rot); return; } gmCloseDoor() { if (gfDoorClosed == TRUE) { llSay (0, "This door is already closed."); return; } gmSwingDoor(SW_CLOSE); gfDoorClosed = TRUE; return; } gmOpenDoor() { if (gfDoorClosed == FALSE) { llSay (0, "This door is already open."); return; } gmSwingDoor(SW_OPEN); gfDoorClosed = FALSE; return; } integer open = 0; default { state_entry() { gmInitFields(); llSetTimerEvent(.05); } timer() { llSetTimerEvent(0); gmOpenDoor(); gmCloseDoor(); llResetScript(); } }
|
bingbangboom Bixby
Registered User
Join date: 17 Aug 2004
Posts: 92
|
07-01-2005 14:15
Thanks. I am not good at scripting but I will play around with it. Is there a way to add a touch command, so when you do touch it it will start the swing motion?
|