setWaypointStatements: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added another example with this and thislist)
mNo edit summary
 
(71 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= ofpe
|version1= 1.00


|1.00|= Game version
|game2= arma1
____________________________________________________________________________________________
|version2= 1.00


| The waypoint is done only when the condition is fulfilled. When the waypoint is done, the statement expression is executed.
|game3= arma2
|version3= 1.00


|game4= arma2oa
|version4= 1.50
|game5= tkoh
|version5= 1.00
|game6= arma3
|version6= 0.50
|gr1= Waypoints
|descr= The waypoint is done only when the condition is fulfilled. When the waypoint is done, the statement expression is executed.<br>
Within the Condition & Statement code string:
Within the Condition & Statement code string:
* [[this]] refers to the group leader
* [[Magic Variables#this_2|this]] refers to the group leader
* [[this#thislist|thislist]] refers to an array containing each unit in the group
* [[Magic Variables#thisList|thisList]] refers to the group's units
|= Description
{{Feature | important | The '''Condition''' code is evaluated on the [[groupOwner|group owner]]'s machine. When condition returns [[true]], for some strange reason, the condition is evaluated one more time. The '''OnActivation''' code is executed '''[[Multiplayer Scripting#Locality|globally]]''', a.k.a on every client! See [[Waypoints]].}}
____________________________________________________________________________________________


| waypoint '''setWaypointStatements''' [condition, statement] |= Syntax
|s1= waypoint [[setWaypointStatements]] [condition, statement]


|p1= waypoint: [[Array]] - format [[Waypoint]] |= Parameter 1
|p1= waypoint: [[Array]] format [[Waypoint]]
|p2= [condition, statement]: [[Array]] |= Parameter 2
|p3= condition: [[String]] |= Parameter 3
|p4= statement: [[String]] |= Parameter 4


| [[Nothing]] |= Return value
|p2= condition: [[String]]
____________________________________________________________________________________________
 
|x1= <pre>new_wp setWaypointStatements ["true", "hint 'hello'; hint 'goodbye'"];</pre> |= Example 1
|x2= <pre>new_wp setWaypointStatements ["true", "diag_log ['GroupLeader: ',this]; diag_log ['Units: ',thislist]"];</pre> |= Example 2
____________________________________________________________________________________________


| [[addWaypoint]], [[waypointStatements]], [[waypointStatements (VBS2)]] |= See also
|p3= statement: [[String]]


}}
|r1= [[Nothing]]


<h3 style="display:none">Notes</h3>
|x1= <sqf>_waypoint setWaypointStatements ["true", "hint 'hello'; hint 'goodbye'"];</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
If you want to use a string within the condition or statement fields, you can either use ' or "" to mark quotes within a string. For example:


'''[_grp, 2] setWaypointStatements ["true", "nul = [_unit] execVM ""myscript.sqf"";"]'''
|x2= <sqf>_waypoint setWaypointStatements ["true", "diag_log ['GroupLeader: ', this]; diag_log ['Units: ', thislist]"];</sqf>


or
|seealso= [[waypointStatements]]
}}


'''[_grp, 2] setWaypointStatements ["true", "hint 'The unit has reached the destination';"]'''
{{Note
|user= SilentSpike
|timestamp= 20160521161900
|text= Within the completion statement [[currentWaypoint]] will give the index of the waypoint being completed (as opposed to the following one).<br><br>
This is particularly useful if you need a self deleting waypoint:
<sqf>_waypoint setWaypointStatements ["true", "deleteWaypoint [group this, currentWaypoint group this]"]</sqf>
}}


<!-- Note Section END -->
{{Note
</dl>
|user= RHfront
 
|timestamp= 20170509163500
<h3 style="display:none">Bottom Section</h3>
|text= The condition block carries the same rules as functions which return a value.
[[Category:Scripting Commands|SETWAYPOINTSTATEMENTS]]
The return value must be a [[Boolean]].
[[Category:Scripting Commands OFP Elite |SETWAYPOINTSTATEMENTS]]
One can bypass the use of triggers in this manner:
[[Category:Scripting Commands ArmA|SETWAYPOINTSTATEMENTS]]
<sqf>_waypoint setWaypointStatements ["code code code; _returnBool", "onActivation block;"];</sqf>
[[Category:Command_Group:_Waypoints|SETWAYPOINTSTATEMENTS]]
}}
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands VBS2|{{uc:{{PAGENAME}}}}]]

Latest revision as of 21:36, 26 September 2024

Hover & click on the images for description

Description

Description:
The waypoint is done only when the condition is fulfilled. When the waypoint is done, the statement expression is executed.
Within the Condition & Statement code string:
  • this refers to the group leader
  • thisList refers to the group's units
The Condition code is evaluated on the group owner's machine. When condition returns true, for some strange reason, the condition is evaluated one more time. The OnActivation code is executed globally, a.k.a on every client! See Waypoints.
Groups:
Waypoints

Syntax

Syntax:
waypoint setWaypointStatements [condition, statement]
Parameters:
waypoint: Array format Waypoint
condition: String
statement: String
Return Value:
Nothing

Examples

Example 1:
_waypoint setWaypointStatements ["true", "hint 'hello'; hint 'goodbye'"];
Example 2:
_waypoint setWaypointStatements ["true", "diag_log ['GroupLeader: ', this]; diag_log ['Units: ', thislist]"];

Additional Information

See also:
waypointStatements

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
SilentSpike - c
Posted on May 21, 2016 - 16:19 (UTC)
Within the completion statement currentWaypoint will give the index of the waypoint being completed (as opposed to the following one).

This is particularly useful if you need a self deleting waypoint:
_waypoint setWaypointStatements ["true", "deleteWaypoint [group this, currentWaypoint group this]"]
RHfront - c
Posted on May 09, 2017 - 16:35 (UTC)
The condition block carries the same rules as functions which return a value. The return value must be a Boolean. One can bypass the use of triggers in this manner:
_waypoint setWaypointStatements ["code code code; _returnBool", "onActivation block;"];