Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Introduced in

Version:1.32

Description

Description:Normally, the light bulb (Objects / Scenery - furniture) will automatically turn itself on during night (6pm to 6am).

This behavior can be overridden either via the action menu (by pointing at it when nearby, and selecting the "Turn on" or "Turn off" action), or via a script.

Once a lamp has been switched manually, the automatic switching is terminated.

The light status can be checked via the lamp's getVariable "light",
which contains: [lightpoint,brightness,color,status], where status can be either "autoon" or "autooff" (if in auto-switching mode), or "on" or "off" (if manually switched).

To suppress manual switching set the lamp's setVariable "allowswitch" to false.

Syntax

Syntax:[bulb,mode,brightness,color] execVM "\vbs2\structures\Misc\data\scripts\lightswitch.sqf"
Parameters:
  • bulb: Object - Lightbulb object
  • mode: String - Possible values:
    • "init": creates a lightpoint, attached to the bulb, which turns itself on at night
    • "on"/"off": turns light on/off
    • "checkon": returns true if light is on
    • "checkoff": returns true if light is off
  • brightness: Number - Brightness of light (optional, default: .02)
  • color: Array - Light color [R,G,B] (optional, default: [1,1,1])
Return Value:Boolean - if called with mode "checkon" or "checkoff"

Examples

Examples:
_nul = [bulb,"on"] execVM "\vbs2\structures\Misc\data\scripts\lightswitch.sqf"
_status = [this,'checkon'] call compile preprocessfile '\vbs2\structures\Misc\data\scripts\lightswitch.sqf'

Additional Information

See also: 
Multiplayer: 
Problems: 

Notes