Skip to content

Switch Action

Mike-MF edited this page Dec 30, 2022 · 7 revisions

This page will explain the usage of the Switch Action function.


/*
 * Author: Mike
 * Functionality for toggling switches, When "OFF" switch is red and power levels are 0, when "ON" switch is Green and power levels are either 1 or player defined.
 *
 * Default state is 0 (OFF) or 1 (ON)
 *
 * Can be checked by using getVariable on the object for switch state.
 * My_Switch getVariable ["TAC_Switched", false];
 *
 * Call from init.sqf
 *
 * Arguments:
 * 0: Switch <OBJECT>
 * 1: Left Voltage On <NUMBER> (default: 1)
 * 2: Right Voltage On <NUMBER> (default: 1)
 * 3: Default state <NUMBER> (default: 0)
 *
 * Return Value:
 * None
 *
 * Example:
 * [My_Switch] call MFUNC(switchAction)
 * [My_Switch, 0.5, 0.7] call MFUNC(switchAction)
 * [My_Switch, 0.5, 0.7, 1] call MFUNC(switchAction)
 */

Usage

This function is designed for the "Transfer Switch" (Land_TransferSwitch_01_F) object. It will increase/decrease levels on the object and switch light colours.

Switch can be checked via My_Switch getVariable ["TAC_Switched", false]; for usage elsewhere.

Call from init.sqf

Example:

[My_Switch, 0.5, 0.7] call MFUNC(switchAction);
Clone this wiki locally