Jump to content

Rotation script for lever - elevator


You are about to reply to a thread that has been inactive for 2912 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

  • 2 weeks later...

I assume that one of the prims is the switch lever itself and the other is a decorative plate that the switch sits in.  If so, the only part that needs scripting is the switch lever.  Treat it the same way that you would treat a door or a box lid or anything else that is hinged.  There are three or four standard ways to script hinges, but perhaps the easiest is Void's >> https://community.secondlife.com/t5/LSL-Library/Simple-Hinge-Action/m-p/875331 .

How complicated the rest of the job is depends on what you mean.  If you simply mean, "How do I use a switch to signal the elevator to start or stop?", you can treat it like any toggle switch.  Define a global integer variable that will flip its value from 0 to 1 (TRUE to FALSE), and put it in a touch_start event:

touch_start(integer num){    gON = !gON;  // There's your switch    if (gON)    {        //Do "start" stuff    }    else    {        //Do "stop" stuff    }}

If you mean, "How do I make the elevator move?", that's a more complicated question.  It sounds like you may have that one covered, though.

 

Link to comment
Share on other sites

Thank you for steering me in the right direction for the lever.   My issue was combining the two scripts, one for the lever and one for the elevator.   Touch lever, lever rotates (hinge, thanks) elevator floor moves up or down when the lever moves.  In my mind and I am just a novice in this, it would seem the lever has to trigger the elevator script.  I have been searching but can not find a resource to help me see how to manipulate the script to do both. 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2912 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...