Using switches and buttons
This tutorial explains how to create basic buttons, switches, and levers.
First of all, you need to create a button: open the Object Hierarchy, navigate to Button (-448), hit Create, and place a button in the world.
There are a lot of different things that a button can affect, from physical things such as doors and lights to more complicated behind-the-scenes 'traps' for modifying quest variables and teleporting objects.
A perfect example of something that can be activated via buttons and
switches is an alarm, so create a MechRedAlarm (-1900)
and memorise its object number.
Now, select the button, and hit the 'Links'
button at the bottom-centre of the DromEd window.
Enter the object number of the button (displayed in the title bar of the Links window) into the From field, and the object number of the MechRedAlarm into the To field.
Now go into Game Mode and frob the button.
Note that no matter how many times you press the button,
it only ever turns the alarm on, never off.
Levers, on the other hand, use the StdLever script, which sends both 'On' and 'Off' signals; the former when the moving part of the lever (called the joint) reaches the end of its motion, and the latter when the joint returns to its starting position. That is to say, an 'On' signal is never sent if the lever does not reach the end of its motion; for example, if the player frobs it again before it has reached the 'on' position.
(You can create your own buttons by giving an object the StdButton script and the Engine Features->FrobInfo property, which must have its World Action set to Script. Creating custom levers is a fair bit harder, as it requires to the use of the Tweq->Joints property, the usage of which is far outside the scope of this tutorial.)
The procedure for creating a lever is practically the same as that of
creating a button.
Button and levers
are not the only things that can send ControlDevice