Page 1 of 1

Garage Door Script

Posted: Fri Jun 14, 2019 10:56 am
by Greg McCray
Hi All,

I am looking for a garage door script. A simple swing open on touch. I have a door script now here is the script.

//door script

vector gPos;

default {
state_entry() {
llSetRot(llEuler2Rot(<0,0,0>));
}

touch_start(integer total_number) {
gPos = llGetPos();
llSetRot(llEuler2Rot(<0,0,PI/2>));
llSetTimerEvent(4.0);
}
timer() {
llResetScript();
llSetPos(gPos);
}
}

When I rotate this prim 90 degrees and then click it the door returns to the upright position.
If anyone knows where I can find a garage door script (I have looked on Outworlds, and Opensim Forums) or if this script an can be changed to work I would really appreciate it

Thanks Greg :D

Re: Garage Door Script

Posted: Fri Jun 14, 2019 3:15 pm
by John Mela
Hi Greg.

At a glance, there are a couple of things very wrong with this script.

I've made a couple of changes that may help, but I've not tested it:

Code: Select all

//door script

vector gPos;
rotation gRot;

default {
	touch_start(integer total_number) {
		gPos = llGetPos();
		gRot = llGetRot();
		llSetRot(llEuler2Rot(<0.0, 0.0, PI_BY_TWO>));
		llSetTimerEvent(4.0);
	}
	timer() {
		llSetTimerEvent(0.0);
		llSetPos(gPos);
		llSetRot(gRot);
	}
}
EDIT: A couple more lines added

Re: Garage Door Script

Posted: Sun Jun 30, 2019 6:31 pm
by Olivier Vandebroucke
I've tried John Hopkin's script, it works just fine, thanks!