Workable lever

Workable Lever
This is a custom function, that when placed in the OnUsed of a lever, will play it's animation and return a TRUE (ON) or FALSE (OFF) state to the script. You can either add it to a include file, or simply add it to the top of your void main script as in the example.

When useing a lever, be sure to set it's "Initial State" to "Deactivated"

/////////////////////////////////////////////////////// // Place the Lever and set it State to "Deactivated" // Use in the OnUsed of a Lever or switch /////////////////////////////////////////////////////// int FlipSwitch(object oLever = OBJECT_SELF) {   //lever animation if (GetLocalInt(OBJECT_SELF,"nToggle") == 0) {       PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,1.0); SetLocalInt(OBJECT_SELF,"nToggle",1);//set "ON" return TRUE; }   else {       PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE,1.0,1.0); SetLocalInt(OBJECT_SELF,"nToggle",0);//set "OFF" return FALSE; }   //end level anaimation } void main {   if(FlipSwitch) {       // Add code for ON state }   else {       // Add code for OFF state, if you wish } }