XScript Manual · Chapter 15

title: "TOWERLAMP — signal tower & buzzer" chapter: 15

TOWERLAMP — signal tower & buzzer

TOWERLAMP is the global object for driving the signal tower (Red / Orange / Green / Blue) and the buzzer as one unit. Each state (INIT, RUN, STOP, ERROR, …) is preconfigured in the TowerLamp Editor as an IO combination.

Basic example

TOWERLAMP.SetLamp("INIT");
Sleep(1000);
 
if (TOWERLAMP.CurrentState == "INIT")
{
    TOWERLAMP.SetLamp("STOP");
}
else
{
    TOWERLAMP.BeepNo();
}

Real-world — system event hooks

FUNCTION OnSystemStart()
{
    TOWERLAMP.SetLamp("RUN");
    return true;
}
 
FUNCTION OnSystemStop()
{
    TOWERLAMP.SetLamp("STOP");
    return true;
}
 
FUNCTION OnSystemError()
{
    TOWERLAMP.SetLamp("ERROR");
    TOWERLAMP.BeepNo();
}
 
FUNCTION OnSystemReset()
{
    if (SYS.IsRunning)
    {
        TOWERLAMP.SetLamp("RUN");
    }
    else
    {
        TOWERLAMP.SetLamp("STOP");
    }
}

Methods

SignatureDescription
bool SetLamp(string state)Switch to a registered preset
bool SetBuzzer(bool on)Buzzer on/off
bool Contains(string lampState)Preset exists
void Stop(void)Stop all output
void BeepInitCompleteSound(void)Init-complete tune
void BeepYes(void)Confirm beep
void BeepNo(void)Reject / error beep
void Beep(void)Single beep
string ToString(void)Summary string

Properties

PropertyTypeDescription
CurrentStatestringCurrent preset name
CountintRegistered preset count
RedOn / OrangeOn / GreenOn / BlueOnboolColor states
BuzzerOnboolBuzzer state
IsExistBlueLampIO / IsExistBuzzerIoboolHardware presence
RedLampIoName / OrangeLampIoName / GreenLampIoName / BlueLampIoName / BuzzerIoNamestringMapped IO names

Tips

  • Register presets once in the TowerLamp Editor; scripts reference them by name only.
  • On machines without a blue lamp or buzzer, check IsExistBlueLampIO / IsExistBuzzerIo first.
  • Use BeepYes() / BeepNo() for consistent user-touch feedback.