Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Lever State
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#1
RE: Lever State

If you're using the lever panel you're gonna need to use the multislider functions.

void OnStart()
{
SetMultiSliderCallback("lever_panel_1", "LeverStateChange1");
}

void LeverStateChange1(string &in EntityName, int alState)
{
if(alState == 1)
{
AddDebugMessage("DoorOpen", false);
}
}
03-29-2013, 04:14 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: Lever State

(03-29-2013, 05:56 PM)Robosprog Wrote:
(03-29-2013, 04:14 PM)ClayPigeon Wrote: If you're using the lever panel you're gonna need to use the multislider functions.

void OnStart()
{
SetMultiSliderCallback("lever_panel_1", "LeverStateChange1");
}

void LeverStateChange1(string &in EntityName, int alState)
{
if(alState == 1)
{
AddDebugMessage("DoorOpen", false);
}
}

I think it works now! However, it only works for 0 and 1 which are the same place apparently. Sad

Multisliders has no -1 state, their states are 0,1 and 2, unlike levers which have -1, 0 and 1.
03-29-2013, 06:30 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#3
RE: Lever State

If there's only one lever, then you use SetEntityConnectionStateChangeCallback. For example, if you want something to happen when the lever's state is 1, you write:
PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever_1""LeverStateChange");
}

void LeverStateChange(string &in entityint state)
{
    if(
state == 1) {
        
// Do stuff
    
}


In Ruins [WIP]
03-29-2013, 09:39 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#4
RE: Lever State

(03-29-2013, 09:27 PM)Robosprog Wrote:
(03-29-2013, 06:30 PM)ClayPigeon Wrote:
(03-29-2013, 05:56 PM)Robosprog Wrote:
(03-29-2013, 04:14 PM)ClayPigeon Wrote: If you're using the lever panel you're gonna need to use the multislider functions.

void OnStart()
{
SetMultiSliderCallback("lever_panel_1", "LeverStateChange1");
}

void LeverStateChange1(string &in EntityName, int alState)
{
if(alState == 1)
{
AddDebugMessage("DoorOpen", false);
}
}

I think it works now! However, it only works for 0 and 1 which are the same place apparently. Sad

Multisliders has no -1 state, their states are 0,1 and 2, unlike levers which have -1, 0 and 1.

Waait, there's only one lever in my thing, does that still require a multislider?

Is your lever model called "water_wheel_cog_panel" ?
If it is, the connectionstatechange callback won't work with it, and you need to use mutlisliders.

If you use any other lever, you can use SetEntityConnectionStateChangeCallback.
03-29-2013, 09:44 PM
Find




Users browsing this thread: 2 Guest(s)