Skip to content

Simple Door Script, with three states

This simple door script uses three states — “default”, to set the initial rotation, and “open” and “closed” to switch to that status. Note that the prim for the door needs to have Path Cut Begin at 0.375 and end at 0.875 for this to work.

It’s part of a series of LSL scripts I’m using for give some training courses on LSL :)

rotation rotInitial;

default
{
    state_entry()
    {
        rotInitial = llGetRot();
        state closed;
    }
}

state closed
{
    touch_start(integer total_number)
    {
        llSetRot(rotInitial * llEuler2Rot(<0, 0, PI_BY_TWO>));
        state open;
    }
}

state open
{
    touch_start(integer total_number)
    {
        llSetRot(rotInitial);
        state closed;
    }
}

Related Posts

Readers who viewed this page, also viewed:

Comments

  1. Ciaran Laval February 7, 2009

    Thank you, been looking at door scripts for ages and this one works a treat, I still don’t like the path cut business but hey it works so thanks :)

Trackbacks

There are no trackbacks on this entry.

blog comments powered by Disqus

Status Updates

My images

Second Anniversary of Locus AmoenusLocus Amoenus Anniversary CeremonyPolitics doesn't need to be taken so serious...Preview of current work at the Lisbon 1755 projectKaseido Quandry at the Representative MeetingWind-blown on the Sun Castle
Gwyneth Llewelyn is offline in Second Life.
Digg! Listed on BlogShares Site Meter EgoSurf for Gwyneth Llewelyn