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
| Signature | Description |
|---|---|
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
| Property | Type | Description |
|---|---|---|
CurrentState | string | Current preset name |
Count | int | Registered preset count |
RedOn / OrangeOn / GreenOn / BlueOn | bool | Color states |
BuzzerOn | bool | Buzzer state |
IsExistBlueLampIO / IsExistBuzzerIo | bool | Hardware presence |
RedLampIoName / OrangeLampIoName / GreenLampIoName / BlueLampIoName / BuzzerIoName | string | Mapped 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/IsExistBuzzerIofirst. - Use
BeepYes()/BeepNo()for consistent user-touch feedback.