Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.00

Description

Description:Draws a line on the map. This command must be called whenever the map is updated. This can be done using the onDraw event (for example, map ctrlSetEventHandler["draw", "(_this select 0) drawLine [position1, position2, Colour];"])

It does not seem to be possible to call a script from the event handler, and do the draw command in there. The commands have to be executed within the event handler's code section, or from within a function.

Syntax

Syntax:map drawLine [position1, position2, color]
Parameters:
Return Value:Nothing

Examples

Examples:Function to draw waypoint information on the editor map (for vehicle "UAV1")
// function to indicate a vehicle's waypoints via circles and lines
fn_showWPs = {
  private ["_waypoints","_center"];
  // get the waypoints for the tracked vehicle, and go through each of them
  _waypoints = waypoints (group _this);
  for "_i" from 0 to (count _waypoints)-1 do {
    // draw a circle around each waypoint
    _center = getWPPos (_waypoints select _i);
    map drawEllipse [_center, 50,50, 0, [1,0,0,1], ''];
    // up until the 2nd to last, draw an arrow from the current to the next WP
    if (_i<(count _waypoints)-1) then {
      map drawArrow [_center, getWPPos (_waypoints select _i+1), [0,0,1,1]];
    };
  };
};

// when the editor is loaded, an event handler is added to the map, which fires on every draw cycle
#include "\vbs2\headers\function_library.hpp"

["editorLoad","map ctrlSetEventHandler['draw','UAV1 call fn_showWPs']"] call fn_vbs_addSysEventHandler;

Additional Information

See also: drawArrow, drawEllipse, drawIcon, drawRectangle, drawPolygon, ctrlSetEventHandler
Multiplayer: 
Problems: 

Notes