/*
***** Warning: untested code *****
Assuming only two levers are present in map.
First lever name: "lever_1"
Second lever name: "lever_2"
Assuming global script variables "lever_1_state" and "lever_2_state" have been defined.
*/
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_1", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_2", "StoreCheckLeverState");
}
void CheckLeverStates()
{
if (GetLocalVarInt("lever_1") == lever_1_state
&& GetLocalVarInt("lever_2") == lever_2_state)
{
PerformLeverTaskCompleted();
}
}
void PerformLeverTaskCompleted()
{
// Do something...
}
void StoreCheckLeverState(string &in entity, int state)
{
SetLocalVarInt(entity, state);
CheckLeverStates();
}