BIS fnc switchLamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
(Created page with "{{Function|= ____________________________________________________________________________________________ |Arma3|= Game |DEV|= Game Version (number surrounded by NO SPACES)...")
Line 1: Line 1:
{{Function|=
____________________________________________________________________________________________
|Arma3|= Game


{{Function|= Comments
|DEV|= Game Version (number surrounded by NO SPACES)
____________________________________________________________________________________________


| arma3 |= Game name
|arg= global |= Multiplayer Arguments


|1.00|= Game version
|eff= global |= Multiplayer Effects
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>/*
| Switch streetlamp on/off |= Description
Author: Karel Moricky
____________________________________________________________________________________________


Description:
| [_object, _state] [[call]] '''BIS_fnc_switchLamp'''; |= Syntax
Switch streetlamp on/off


Parameter(s):
| [[Nothing]] |= RETURNVALUE
0: OBJECT
1: BOOL - true to turn the light on


Returns:
|p1= [[Object]] - Street Lamp |= Parameter 1
NOTHING
*/


|p2= [[Bool]] - State: True to turn lamp on, false to turn it off|= Parameter 2


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_switchLamp]]; --> |= Syntax
|x1= <code>
|p1= |= Parameter 1
{
      [_x,[[true]]] call '''BIS_fnc_switchLamp''';
      [[false]];  
} [[count]] [[nearestObjects]] [ [[player]],["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],200]
</code> |= Example 1


| |= Return value
____________________________________________________________________________________________


|x1= <code></code> |=  
|x1= <code>
{
      [_x,[[false]]] call '''BIS_fnc_switchLamp''';
      [[false]];
} [[count]] [[nearestObjects]] [ [[player]],["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],200];//Switches all lamps in a radius of 200 off
</code> |= Example 1
 
|x2= <code>
[[spawn]] {
private _lamp = [[param]] [0, [[objNull]],[ [[objNull]] ]];
[[while]] {[[player]] [[distance]] _lamp < 200} [[do]]
{
[_lamp,[[selectRandom]] [ [[true]] , [[false]] ] [[call]] '''BIS_fnc_switchLamp''';
[[sleep]] 0.1 + [[random]] 0.5;
};//Simulates a damaged street light
};
</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| SEEALSO |= See Also


}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- BEGIN Note Section -->
 
<!-- For example:
<!-- Note Section END -->
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
<dt class="note">'''[[User:User Name|User Name]]'''</dt>
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
-->
<!-- END Note Section -->
</dl>
</dl>


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Objects|{{uc:switchLamp}}]]
<!-- Appropriate categories go here -->
[[Category:Functions|{{uc:switchLamp}}]]
[[Category:Arma 3: Functions|{{uc:{{PAGENAME}}}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:switchLamp}}]]

Revision as of 20:01, 4 August 2016

Hover & click on the images for description

Description

Description:
Switch streetlamp on/off
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[_object, _state] call BIS_fnc_switchLamp;
Parameters:
Object - Street Lamp
Bool - State: True to turn lamp on, false to turn it off
Return Value:
Nothing

Examples

Example 1:
{ [_x,false] call BIS_fnc_switchLamp; false; } count nearestObjects [ player,["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],200];//Switches all lamps in a radius of 200 off
Example 2:
spawn { private _lamp = param [0, objNull,[ objNull ]]; while {player distance _lamp < 200} do { [_lamp,selectRandom [ true , false ] call BIS_fnc_switchLamp; sleep 0.1 + random 0.5; };//Simulates a damaged street light };

Additional Information

See also:
SEEALSO

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Bottom Section