Garage Door Script

Creating scripts
Post Reply
User avatar
Greg McCray
Posts: 3
Joined: Sat Jan 05, 2019 2:50 pm
Has thanked: 5 times
Been thanked: 3 times

Garage Door Script

Post 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
These users thanked the author Greg McCray for the post:
Ilan Tochner
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Garage Door Script

Post 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
These users thanked the author John Mela for the post (total 3):
Greg McCrayZed deTremontChris Namaste
Olivier Vandebroucke
Posts: 2
Joined: Sun Jun 30, 2019 2:53 pm
Has thanked: 0
Been thanked: 1 time

Re: Garage Door Script

Post by Olivier Vandebroucke »

I've tried John Hopkin's script, it works just fine, thanks!
Post Reply