# Script to Check Distance between Map Click and Markers

## Recommended Posts

So at a high level, I'm looking to create a script that when a player to opens up their map (which I can watch for with a repeatable trigger that launches the script when it sees visibleMap true) and 'clicks' anywhere on it, it does the following:

1. Calculate the distance between that click and a series of markers in an array
2. Returns which marker is the closest to the map click.
3. Once the closest marker has been determined, then match that up to a task that is related to that marker.
4. Open up the Task list and show that task without the player having to scroll through the list manually.
5. Repeat the process if the mouse is clicked at another location on the map.

Edit: Old Script/Code removed, see updated below.

I've got the first few steps worked out, but I could be going about this the completely wrong way, and if someone has an idea on how to handle this, any thoughts or ideas on how to start tackling controlling the GUI/menus on the map through script, I'd appreciate any help.

---------- Post added at 05:11 ---------- Previous post was at 03:13 ----------

Alright, so I've got something 'working', but it's not the best at the moment. Basically you can open up the map and it will check your mouse clicks against the list of task markers. If any are within 500m of your click, it'll display the task information as a hint. The hint is ugly as sin, and I'd really like to figure out a way to actually pull up the task description/info in the Task menu that's available in the top left of the map screen. At the very least, I need to clean up the hint output.

I've created a quick proof of concept mission and the script is below. If anyone has any thoughts or suggestions, I'd love to hear them...

// mapSelector Script by Meatball
// v 0.1
// This script allows your players to 'click' on their map and pull up the task
// information for the task marker closest to their click location without having to
// manually pull up the task list.
//
// This script setup _may_ interfere with other scripts that you may have that
// spawn or create actions based on single mouse clicks on the map and you may need
// to adjust the script(s) and trigger(s) accordingly.

// Setup:
// 1) Copy this script to your root folder of your mission.
//
// 2) Create an in game trigger with the following setting:
// Shape: Whatever you want
// Timer: Countdown or Timeout works, just set all values to 0
// Name: mapSelector
// Text: Map Selector Trigger
// Type and Activation : None
// Repeatedly
// Present
// Condition: visibleMap
// On Act.: nul = execVM "mapSelector.sqf";
//
// 3) Next, in the 'markerNames' array below, put in the names of all the markers related to your tasks.
// Note: Your marker names _must_ match the task name exactly for the related markers/task or the script will not work.
//

markerNum = count markerNames;  // Count the number of markers in the list
closestMarkName = "dummy";  // Set dummy values for the closest marker and closest distance
closestMarkDist = 1000000;

// Continuously check for mouse clicks while the map is open.
while {visibleMap} do {
onMapSingleClick {
// Create temporary marker to use for comparison to markers in array.
_tmpMark = createMarkerLocal ["tmpClick",_pos];

// Loop through each marker in markerNames array and check distance between it and the mouse click.
for [{_i=0},{_i<markerNum},{_i=_i+1}] do {
distBT = (getmarkerpos "tmpClick") distance (getmarkerpos (markerNames select _i));
// If the distance between this marker and closer than the current closest, set it to be the closest.
if (distBT <= closestMarkDist) then {
closestMarkName = (markerNames select _i);
closestMarkDist = distBT;
};
};

// Check to make sure that mouse click is at least within 500m of any marker before displaying Task info.
if (closestMarkDist <= 500) then {
};

// Reset marker info/variables for next click.
deletemarkerlocal "tmpClick";
closestMarkName = "dummy";
closestMarkDist = 1000000;
};
};


Edited by Meatball

##### Share on other sites

If you want mission-specific tasks you can use the strategic map. Im on ny phone atm so cant help you with athe script

##### Share on other sites

Thanks, but a strategic map won't work for me. I don't need the players to 'select' missions so much as I want them to just pull up the map, see what tasks are around them and easily pull the task info up. My script is a kludge, but it's working sorta.

I have found that if you have any type of code/links (marker name, etc) in your task it doesn't parse those as actual links and just dumps them out as text with all the code. I'm digging through all the functions to see if I can find anything that might work better, but a lot of the stuff doesn't have the best documentation, so it's hard to figure out what they do.

I think I'm going to have to dig into some GUI editing to create a new pop up box that parses the task header and description text correctly and paste it on the map GUI. Just stinks I can't figure out how open up the in game task list UI on the map to a specific task with scripting since that's exactly what it is. :)

Edited by Meatball

##### Share on other sites

Okay, I'm back on my computer. Is there any particular reason why you're using global variables across the board? Unless you're explicitly calling all these variables outside the function there's no need to make them global. Another question: Do you want to open the relevant task info in the "Task" Tab when the player clicks close to a task marker? That seems to be the most reasonable thing to do here honestly, but it appears as if you're using a hint.

##### Share on other sites

Hey there! Take a look at this command, I use it to great affect for determing the closest "thing". It looks like you're fairly competent when it comes to scripting - but I'm just going to assume you haven't heard any of this (So if you have, just ignore it :> )

The following is a simple way to use a pre-built in function to determine distance from several things in an array.

_Point = [bluforOwnedTownArray,_SpawnPoint] call BIS_fnc_nearestPosition;

_this select 0 is the array of items or markers, and _Spawnpoint is the point you want to see which of those items is closest to.

So, this example will spit out whatever marker in BluForOwnedTownArray is closest to _Spawnpoint.

As for displaying the information properly...I suppose you have a couple of options that I see.

You can create a dialog box that you can easily throw text into that get's displayed properly.

An in-game GUI editor is going to be your best friend if you want to create dialogs.

Go into the editor, place one unit down as a player, press Preview

Once in the mission, Press ESC -> F1 -> GUI (at the bottom right).

That's the built-in GUI Editor made by a BIS Developer (Gaia).

Press F1 in the GUI editor for the help.

It's not the best editor but it's better than doing it another way.

Or, you can use some fancy use of composeText, and cutText.

Also, Here is a terrible example of one of my dialog's I use for filling out buying/selling information. It might give you a better idea though :>

OpenWeaponDialog.sqf

closeDialog 0;
disableSerialization;

//Variable Chunk - For Defining All Variables + Private Array
//private [];
_classname = 0;_displayname = 0;_mass = 0;_picture = 0;_class = 0;_parents = 0;_cost = 0;
_weapondisplayname = 0;_weaponclassname = 0;_text = 0;_index = 0;_unit = 0;_cursel = 0;_dcost = 0;
_dmass = 0;_dpicture = 0;_dmoney = 0;_dmarkup = 0;_dPercent = 0;_unituniform = 0;_unitvest = 0;_unitbackpack = 0;

{
_classname = CfgWeaponsArray select 0;
_displayname = getText(configfile/"CfgWeapons"/_classname/"displayname");
_mass = getNumber(configfile/"CfgWeapons"/_classname/"WeaponSlotsInfo"/"mass");
_picture = getText(configfile/"CfgWeapons"/_classname/"picture");
_cost = 0;
_class = [_classname] call BIS_fnc_classWeapon;
_parents = [_class,true] call BIS_fnc_returnParents;
if ("Rifle_Base_F" in _parents) then {_cost = (floor((Weapon_Rifle_Cost)+(Weapon_Rifle_Cost*randomN)));};
if ("Rifle_Long_Base_F" in _parents) then {_cost = (floor((Weapon_RifleLong_Cost)+(Weapon_RifleLong_Cost*randomN)));};
if ("SMG_01_Base" in _parents) then {_cost = (floor((Weapon_SMG01_Cost)+(Weapon_SMG01_Cost*randomN)));};
if ("SMG_02_base_F" in _parents) then {_cost = (floor((Weapon_SMG02_Cost)+(Weapon_SMG02_Cost*randomN)));};
if ("Pistol_Base_F" in _parents) then {_cost = (floor((Weapon_Pistol_Cost)+(Weapon_Pistol_Cost*randomN)));};
if ("Launcher_Base_F" in _parents) then {_cost = (floor((Weapon_Launcher_Cost)+(Weapon_Launcher_Cost*randomN)));};
CfgWeaponsArray set [0, "delete_me"];
CfgWeaponsArray = CfgWeaponsArray - ["delete_me"];
} forEach CfgWeaponsArray;

{
_weapondisplayname = _x select 0;
_weaponclassname = _x select 1;
_text = _weapondisplayname;

while {!IsNull (FindDisplay 3000)} do
{
_unit = player;
_cursel = lbCurSel 1500;
if (lbcursel 1500 <= -1) then {_dcost = 0;_dmass = 0;_dpicture = "";} else {
_dcost = ((BuyWeaponArray select _cursel) select 2);
_dmass = ((BuyWeaponArray select _cursel) select 3);
_dpicture = ((BuyWeaponArray select _cursel) select 4);
};
_dmoney = _unit getVariable "RS_Money";
_dmarkup = randomN;
ctrlSetText [493, format ["%1",_dmoney]];
ctrlSetText [495, format ["%1",_dcost]];
ctrlSetText [497, format ["%1",((_dmoney) - (_dcost))]];
_dPercent = "%";
ctrlSetText [499, format ["%1 %2", (floor((_dmarkup)*100)),_dPercent]];
ctrlSetText [501, format ["%1",_dmass]];
ctrlSetText [506, format ["%1",_dpicture]];

_unituniform = uniform _unit;
_unitvest = vest _unit;
_unitbackpack = backpack _unit;
_uniformcapacity = 0;
_vestcapacity = 0;
_backpackcapacity = 0;
if !(_unituniform == "") then {
_uniformcapacity = getText (configFile/"CfgWeapons"/_unituniform/"ItemInfo"/"containerclass");
else {_uniformcapacity = 0;_uniformload = 0;};
if !(_unitvest == "") then {
_vestcapacity = getText (configFile/"CfgWeapons"/_unitvest/"ItemInfo"/"containerclass");
else {_vestcapacity = 0;_vestload = 0;};
if !(_unitbackpack == "") then {
switch (_uniformcapacity) do {
A LOT OF RANDOM BULLOCKS
};
switch (_vestcapacity) do {
A LOT OF RANDOM BULLOCKS
};
sleep 0.05;
};



class BuyWeaponDialog
{
idd = 3000;
movingEnable = true;
class Controls
{
{
idc = 2000;
x = 2.23517e-008;
y = 0.12;
w = 0.9;
h = 0.76;
colorText[] = {0.33,0.55,0.25,0.4};
colorBackground[] = {0.33,0.55,0.25,0.4};
colorActive[] = {0.33,0.55,0.25,0.4};
};
{
idc = 2001;
text = "Black Market - - - Weapons"; //--- ToDo: Localize;
x = 0.05;
y = 0.16;
w = 0.5;
h = 0.04;
colorText[] = {0,0,0,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = ""; //--- ToDo: Localize;
};
{
idc = 1500;
x = 0.0499999;
y = 0.24;
w = 0.575;
h = 0.56;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.8};
};
{
idc = 492;
text = "Wallet:"; //--- ToDo: Localize;
x = 0.65;
y = 0.24;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 493;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.24;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents how many dollars you have."; //--- ToDo: Localize;
};
{
idc = 494;
text = "Cost:"; //--- ToDo: Localize;
x = 0.65;
y = 0.28;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 495;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.28;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents the cost of the item selected in dollars."; //--- ToDo: Localize;
};
{
idc = 496;
text = "Total:"; //--- ToDo: Localize;
x = 0.65;
y = 0.32;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 497;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.32;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents much money you would have left if you purchased the item selected."; //--- ToDo: Localize;
};
{
idc = 498;
text = "Markup:"; //--- ToDo: Localize;
x = 0.65;
y = 0.36;
w = 0.0885;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 499;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.36;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents how much over base price you will be charged as a percentage."; //--- ToDo: Localize;
};
{
idc = 500;
text = "IMass:"; //--- ToDo: Localize;
x = 0.65;
y = 0.40;
w = 0.0880;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 501;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.40;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents how much mass the currently selected item has."; //--- ToDo: Localize;
};
{
idc = 502;
text = "CMass:"; //--- ToDo: Localize;
x = 0.65;
y = 0.44;
w = 0.0880;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 503;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.44;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents how much mass you are currently carrying between your uniform, vest, and backpack."; //--- ToDo: Localize;
};
{
idc = 504;
text = "TMass:"; //--- ToDo: Localize;
x = 0.65;
y = 0.48;
w = 0.0880;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
};
{
idc = 505;
text = ""; //--- ToDo: Localize;
x = 0.75;
y = 0.48;
w = 0.0875;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This number represents how much mass in total you can carry between your uniform, vest, and backpack."; //--- ToDo: Localize;
};
{
idc = 506;
type = CT_STATIC;
style = ST_PICTURE;
fixedWidth = 1;
text = ""; //--- ToDo: Localize;
x = 0.65;
y = 0.52;
w = 0.1750;
h = 0.12;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This image represents what the item will look like."; //--- ToDo: Localize;
};
{
idc = 507;
type = CT_STATIC;
style = ST_FRAME;
text = ""; //--- ToDo: Localize;
x = 0.65;
y = 0.52;
w = 0.1750;
h = 0.12;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0};
colorActive[] = {0.33,0.55,0.25,0};
tooltip = "This image represents what the item will look like."; //--- ToDo: Localize;
};
{
idc = 1002;
text = "Weapons"; //--- ToDo: Localize;
x = 0.05;
y = 0.2;
w = 0.1125;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
tooltip = "Display Weapons."; //--- ToDo: Localize;
};
{
idc = 1003;
text = "Magazines"; //--- ToDo: Localize;
x = 0.175;
y = 0.2;
w = 0.125;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
tooltip = "Display Magazines"; //--- ToDo: Localize;
};
{
idc = 1004;
text = "Attachments"; //--- ToDo: Localize;
x = 0.3125;
y = 0.2;
w = 0.1625;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
tooltip = "Display Attachments"; //--- ToDo: Localize;
};
{
idc = 1005;
text = "Equipment"; //--- ToDo: Localize;
x = 0.4875;
y = 0.2;
w = 0.125;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
tooltip = "Display Equipment."; //--- ToDo: Localize;
};
{
idc = 1001;
text = "Buy"; //--- ToDo: Localize;
x = 0.65;
y = 0.76;
w = 0.05;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
tooltip = "Buys the currently selected item."; //--- ToDo: Localize;
};
{
idc = 1000;
text = "Exit"; //--- ToDo: Localize;
x = 0.7875;
y = 0.76;
w = 0.05;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0.33,0.55,0.25,0.6};
colorActive[] = {0.33,0.55,0.25,0.6};
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 3000);";
tooltip = "Exits the Black Market."; //--- ToDo: Localize;
};
};
};

DialogDefines.hpp - For base classes


///////////////////////////////////////////////////////////////////////////
/// Base Classes
///////////////////////////////////////////////////////////////////////////
{
access = 0;
type = 0;
idc = -1;
colorBackground[] =
{
0,
0,
0,
0
};
colorText[] =
{
1,
1,
1,
1
};
text = "";
fixedWidth = 0;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
style = 0;
{
0,
0,
0,
0.5
};
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
linespacing = 1;
};
{
access = 0;
type = 13;
idc = -1;
style = 0;
colorText[] =
{
1,
1,
1,
1
};
class Attributes
{
font = "PuristaMedium";
color = "#ffffff";
align = "left";
};
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
{
access = 0;
type = 0;
idc = -1;
style = 48;
colorBackground[] =
{
0,
0,
0,
0
};
colorText[] =
{
1,
1,
1,
1
};
font = "TahomaB";
sizeEx = 0;
lineSpacing = 0;
text = "";
fixedWidth = 0;
x = 0;
y = 0;
w = 0.2;
h = 0.15;
};
{
access = 0;
type = 2;
x = 0;
y = 0;
h = 0.04;
w = 0.2;
colorBackground[] =
{
0,
0,
0,
1
};
colorText[] =
{
0.95,
0.95,
0.95,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
colorSelection[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
1
};
autocomplete = "";
text = "";
size = 0.2;
style = "0x00 + 0x40";
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
canModify = 1;
};
{
access = 0;
type = 4;
colorSelect[] =
{
0,
0,
0,
1
};
colorText[] =
{
0.95,
0.95,
0.95,
1
};
colorBackground[] =
{
0,
0,
0,
1
};
colorScrollbar[] =
{
1,
0,
0,
1
};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscCombo\soundSelect",
0.1,
1
};
soundExpand[] =
{
"\A3\ui_f\data\sound\RscCombo\soundExpand",
0.1,
1
};
soundCollapse[] =
{
"\A3\ui_f\data\sound\RscCombo\soundCollapse",
0.1,
1
};
maxHistoryDelay = 1;
class ScrollBar
{
color[] =
{
1,
1,
1,
0.6
};
colorActive[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.3
};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
};
style = 16;
x = 0;
y = 0;
w = 0.12;
h = 0.035;
colorSelectBackground[] =
{
1,
1,
1,
0.7
};
arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa";
arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa";
wholeHeight = 0.45;
color[] =
{
1,
1,
1,
1
};
colorActive[] =
{
1,
0,
0,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
{
access = 0;
type = 5;
w = 0.4;
h = 0.4;
rowHeight = 0;
colorText[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
colorScrollbar[] =
{
1,
0,
0,
0
};
colorSelect[] =
{
0,
0,
0,
1
};
colorSelect2[] =
{
0,
0,
0,
1
};
colorSelectBackground[] =
{
0.95,
0.95,
0.95,
1
};
colorSelectBackground2[] =
{
1,
1,
1,
0.5
};
colorBackground[] =
{
0,
0,
0,
0.3
};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
class ScrollBar
{
color[] =
{
1,
1,
1,
0.6
};
colorActive[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.3
};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
};
style = 16;
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
{
0,
0,
0,
0.5
};
color[] =
{
1,
1,
1,
1
};
period = 1.2;
maxHistoryDelay = 1;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
};
{
access = 0;
type = 1;
text = "";
colorText[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
0.4,
0.4,
0.4,
1
};
colorBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
0.7
};
colorBackgroundDisabled[] =
{
0.95,
0.95,
0.95,
1
};
colorBackgroundActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
1
};
colorFocused[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
1
};
{
0,
0,
0,
1
};
colorBorder[] =
{
0,
0,
0,
1
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
style = 2;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
offsetX = 0.003;
offsetY = 0.003;
offsetPressedX = 0.002;
offsetPressedY = 0.002;
borderSize = 0;
};
{
type = 16;
x = 0.1;
y = 0.1;
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0;
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
class TextPos
{
left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0;
};
shortcuts[] =
{
};
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
color[] =
{
1,
1,
1,
1
};
color2[] =
{
0.95,
0.95,
0.95,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
colorBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
1
};
colorBackground2[] =
{
1,
1,
1,
1
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
class Attributes
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
};
idc = -1;
style = 0;
default = 0;
w = 0.183825;
h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
periodFocus = 1.2;
periodOver = 0.8;
period = 0.4;
font = "PuristaMedium";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
action = "";
class AttributesImage
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
};
};
{
idc = -1;
style = 0;
default = 0;
w = 0.313726;
h = 0.104575;
color[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0.0145;
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2) * (3/4)";
h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
};
class TextPos
{
left = "(((safezoneW / safezoneH) min 1.2) / 32) * 1.5";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)*2 - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
right = 0.005;
bottom = 0;
};
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
period = 0.5;
font = "PuristaMedium";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
text = "";
action = "";
class Attributes
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
};
class AttributesImage
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "false";
};
};
{
type = 0;
idc = -1;
style = 64;
colorBackground[] =
{
0,
0,
0,
0
};
colorText[] =
{
1,
1,
1,
1
};
font = "PuristaMedium";
sizeEx = 0.02;
text = "";
};
{
access = 0;
type = 3;
style = 1024;
w = 0.3;
color[] =
{
1,
1,
1,
0.8
};
colorActive[] =
{
1,
1,
1,
1
};
h = 0.025;
};
{
type = 0;
idc = 124;
style = 128;
text = "";
colorText[] =
{
0,
0,
0,
0
};
font = "PuristaMedium";
sizeEx = 0;
x = 0.1;
y = 0.1;
w = 0.1;
h = 0.1;
colorbackground[] =
{
"(profilenamespace getvariable ['IGUI_BCG_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_BCG_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_BCG_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_BCG_RGB_A',0.8])"
};
};
{
idc = -1;
type = 7;
style = 0;
x = "LINE_X(XVAL)";
y = "LINE_Y";
w = "LINE_W(WVAL)";
h = 0.029412;
colorText[] =
{
1,
0,
0,
1
};
color[] =
{
0,
0,
0,
0
};
colorBackground[] =
{
0,
0,
1,
1
};
colorTextSelect[] =
{
0,
0.8,
0,
1
};
colorSelectedBg[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",
1
};
colorSelect[] =
{
0,
0,
0,
1
};
colorTextDisable[] =
{
0.4,
0.4,
0.4,
1
};
colorDisable[] =
{
0.4,
0.4,
0.4,
1
};
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
rows = 1;
columns = 1;
strings[] =
{
"UNCHECKED"
};
checked_strings[] =
{
"CHECKED"
};
};
{
idc = -1;
type = 16;
style = "0x02 + 0xC0";
default = 0;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,0.5)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
colorBackground[] =
{
0,
0,
0,
0.8
};
colorBackground2[] =
{
1,
1,
1,
0.5
};
color[] =
{
1,
1,
1,
1
};
color2[] =
{
1,
1,
1,
1
};
colorText[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.25
};
period = 1.2;
periodFocus = 1.2;
periodOver = 1.2;
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
class TextPos
{
left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0;
};
class Attributes
{
font = "PuristaLight";
color = "#E5E5E5";
align = "left";
};
class ShortcutPos
{
left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
top = 0.005;
w = 0.0225;
h = 0.03;
};
soundEnter[] =
{
0.09,
1
};
soundPush[] =
{
0.09,
1
};
soundClick[] =
{
0.09,
1
};
soundEscape[] =
{
0.09,
1
};
};
{
idc = 1;
shortcuts[] =
{
"0x00050000 + 0",
28,
57,
156
};
default = 1;
text = "OK";
soundPush[] =
{
0.09,
1
};
};
{
idc = 2;
shortcuts[] =
{
"0x00050000 + 1"
};
text = "Cancel";
};
{
class VScrollbar
{
color[] =
{
1,
1,
1,
1
};
width = 0.021;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
};
class HScrollbar
{
color[] =
{
1,
1,
1,
1
};
height = 0.028;
};
class ScrollBar
{
color[] =
{
1,
1,
1,
0.6
};
colorActive[] =
{
1,
1,
1,
1
};
colorDisabled[] =
{
1,
1,
1,
0.3
};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
};
class Controls
{
};
type = 15;
idc = -1;
x = 0;
y = 0;
w = 1;
h = 1;
style = 16;
};

Of course, that is if you wanted to take the time to create a dialog that opens, and not a simple little pop-up menu

Edited by Genesis92x

##### Share on other sites
Okay, I'm back on my computer. Is there any particular reason why you're using global variables across the board? Unless you're explicitly calling all these variables outside the function there's no need to make them global. Another question: Do you want to open the relevant task info in the "Task" Tab when the player clicks close to a task marker? That seems to be the most reasonable thing to do here honestly, but it appears as if you're using a hint.

Using global because I wasn't able to use local variables once I fired up that while loop and the embedded for loop and reference back to them outside of the scopes of those loops.

And as for your second question, absolutely! That's exactly what I want and I don't want to use a hint, but I've yet to figure out how to pull up the 'Task Tab' through script commands once I have the correct task name/ID.

---------- Post added at 17:41 ---------- Previous post was at 17:39 ----------

Hey there! Take a look at this command, I use it to great affect for determing the closest "thing". It looks like you're fairly competent when it comes to scripting - but I'm just going to assume you haven't heard any of this (So if you have, just ignore it :> ) ... Of course, that is if you wanted to take the time to create a dialog that opens, and not a simple little pop-up menu

Thanks!

##### Share on other sites

You can always reference variables outside loops aslong as these are already defined outside loops. In your case referencing _markerNames should work across the board as it is defined in the main scope and not in a loop scope. As for pulling up the task menu, I'm fairly sure there was a way. I can't really remember right now though, but I'll get back to you once I find something.

##### Share on other sites

Yeah, I'm sure there is a way to pull up that task menu, I just can't for the life of me figure out how to do it.

I'd be happy enough with the hintC output as well if it would correctly handle/parse the 'marker links' that you can embed in task descriptions.

---------- Post added at 20:07 ---------- Previous post was at 19:57 ----------

Here's a good picture of showing the difference between what I'd like to do, and what I've been able to do.

Up top you'll see the top left default menu that contains normal map/mission information inclucing "Tasks" if there are any assigned to the player, you can click on that and see all the associated tasks, and then if you click on the individual task, it will give you the Task name and full description. You'll also notice the 'test link for a marker' shows grey because it's actually a link to the map marker associated with the task by setting the task description up like this:

"Task 1 Stuff.  Here's a <marker name = "task1">test link for a marker</marker>.

If you click on that link, the map will take you right to the associated marker and target it on the map, which you can see by the blue box surrounding the Task 1 marker.

On the bottom is the output of my script that finds the closest marker to the map click and then grabs the task name/description using BIS_fnc_taskDescription. Then it uses HintC showing that same task name and description and you'll see it doesn't handle the marker name/marker xml. If I do hintC parsetext, it just completely strips out everything between the marker name/marker tags, including the tags.

I'd love it if I could code-wise just pull up the default task box (the top right dark grey box) that you can get to from the menu. :)

Edited by Meatball

##### Share on other sites

Well, spent a lot of time over the last day or so and can't seem to find any way to open that top right box directly from a script call. If anyone has any thoughts/ideas, I have cookies. :)

##### Share on other sites

processDiaryLink createDiaryLink ["Tasks", ["tsk1",player] call bis_fnc_taskreal, ""];

Where "tsk1" is the name you gave the task when you created it e.g

[west, "tsk1", ["Infiltrate.", "Destroy", "DestroyDefences"], (getMarkerPos "obj1"), true] spawn BIS_fnc_taskCreate;

##### Share on other sites

Holy guacomole Larrow...that's it! How many cookies you want? :)

---------- Post added at 21:47 ---------- Previous post was at 21:28 ----------

Hmm, definitely the right track. My test mission it works fine, but my bigger mission(s) I'm using SHK's taskmaster to create tasks for the players and it looks like it uses createsimpletask to create the tasks for the player during init.sqf. I wonder if I need to format that processDiaryLink line differently.

##### Share on other sites

I have never used SHK's taskMaster so im not 100% sure of Shuko's formatting but i've just had a quick browse of his script and it looks like you will need to check SHK_Taskmaster_TasksLocal to find the task variable.

Something along the lines of....

_task = "tsk1"; //the task name to find
{
if (_x select 0 == _task) exitWith {
{
if (_x in simpleTasks player) exitWith {
};
}forEach (_x select 2);
};

processDiaryLink createDiaryLink ["Tasks", _task, ""];

Again not checked and i didnt install taskMaster to make sure i have referenced the right index but should point you in the right direction.

##### Share on other sites

That did the trick! Thanks again! In case anyone is trying to do this without using Taskmaster, here's the script you should be able to use with normally created tasks.

// mapSelector Script by Meatball
// v 0.2
// Additional Credits to tryteyker, Genesis92x and Larrow
//
// This script allows your players to 'click' on their map and pull up the task
// information for the closest mark to their click location without having to
// manually pull up the task list.
//
// This script setup _may_ interfere with other scripts that you may have that
// spawn or create actions based on single mouse clicks on the map and you may need
// to adjust the script(s) and trigger(s) accordingly.

// Setup:
// 1) Copy this script to your root folder of your mission.
//
// 2) Create an in game trigger with the following setting:
// Shape: Whatever you want
// Timer: Countdown or Timeout works, just set all values to 0
// Name: mapSelector
// Text: Map Selector Trigger
// Type and Activation : None
// Repeatedly
// Present
// Condition: visibleMap
// On Act.: nul = execVM "mapSelector.sqf";
//
// 3) Next, in the 'markerNames' array below, put in the names of all the markers related to your tasks.
// Note: Your marker names _must_ match the task name exactly for the related markers/task or the script will not work.
//

markerNum = count markerNames;  // Count the number of markers in the list
closestMarkName = "dummy";  // Set dummy values for the closest marker and closest distance
closestMarkDist = 1000000;

// Reset Map to default view when opening

// Continuously check for mouse clicks while the map is open.
while {visibleMap} do {
onMapSingleClick {
// Create temporary marker to use for comparison to markers in array.
_tmpMark = createMarkerLocal ["tmpClick",_pos];

// Loop through each marker in markerNames array and check distance between it and the mouse click.
for [{_i=0},{_i<markerNum},{_i=_i+1}] do {
distBT = (getmarkerpos "tmpClick") distance (getmarkerpos (markerNames select _i));
// If the distance between this marker and closer than the current closest, set it to be the closest.
if (distBT <= closestMarkDist) then {
closestMarkName = (markerNames select _i);
closestMarkDist = distBT;
};
};

// Check to make sure that mouse click is at least within 500m of any marker before displaying Task info.
if (closestMarkDist <= 500) then {
};

// Reset marker info/variables for next click.
deletemarkerlocal "tmpClick";
closestMarkName = "dummy";
closestMarkDist = 1000000;
sleep 0.5;
};
};


Edited by Meatball

##### Share on other sites

Old thread, and I'm not sure if you're still following this post Larrow, but do you know of any more documentation on processDiaryLink? Not much on the biki and I'm looking for a way to simply force open the Briefing -> Situation diary note when a mission starts and dumps you into the briefing screen.

##### Share on other sites

Maybe selectDiarySubject could do what you want?

Haven't done much with the diary yet since I'm still struggling to find a way to create subjects within each other but it might do the trick.

##### Share on other sites

Yeah, I've been trying that as well, but having trouble figuring out the syntax.

##### Share on other sites
Yeah, I've been trying that as well, but having trouble figuring out the syntax.

From what I know so far it would be easier to just create a small GUI for that,

since I can't recall having played a single mission that had multiple diary subjects within each other.

##### Share on other sites
From what I know so far it would be easier to just create a small GUI for that,

since I can't recall having played a single mission that had multiple diary subjects within each other.

Well, you'll have subheadings under Tasks, Briefings, etc. I just want to pull up one of the subjects that was created under the Briefing section.

##### Share on other sites
Old thread, and I'm not sure if you're still following this post Larrow,
Hey, still around just been working away from home for the last couple of months. This is the first time ive been able to get around to opening ARMA since January :(
do you know of any more documentation on processDiaryLink?
No i just looked at all the commands on the Wiki for the diary and experimented.
I'm looking for a way to simply force open the Briefing -> Situation diary note when a mission starts and dumps you into the briefing screen.

ProcessDairyLinks does not seem to work here. The briefing screen is actually a different display to the usual in game map screen for example running this from a missions init

h = [] spawn {

disableSerialization;

systemChat format ["display 52 : %1",str (findDisplay 52)];
systemChat format ["display 12 : %1",str (findDisplay 12)];
systemChat format ["display ui : %1",str (uiNamespace getVariable "rscDiary")];

};

sleep 1;

waitUntil{visibleMap};
systemChat format ["display 52 : %1",str (findDisplay 52)];
systemChat format ["display 12 : %1",str (findDisplay 12)];
systemChat format ["display ui : %1",str (uiNamespace getVariable "rscDiary")];

Will show you that although they are both known to uiNamespace as "rscDiary" but one has an IDD of 52 and the other of 12.

To open a specific record under "Briefing" during the briefing display (findDisplay 52), you need to force select the listBox item..

briefing.sqf

player createDiaryRecord ["Diary", ["Extraction", "Reach the designated landing zone and hold it until Extraction."]];

player createDiaryRecord ["Diary", ["Destroy Munitions", "Destroy any weapons and ammunition found on site."]];

player createDiaryRecord ["Diary", ["Secure the Depot", "Eliminate Defences at the Depot."]];

player createDiaryRecord ["Diary", ["Operation Blunt", "This is a mission to destroy the enemies munition supplies. You will be dropped off shore, complete the objectives and get to the extraction site."]];

((findDisplay 52) displayCtrl 1001) lbSetCurSel 1;
//noset = Players
//0 = map
//1 = briefing
//2 = team
//3 = players
//4 =

((findDisplay 52) displayCtrl 1002) lbSetCurSel 1;
//selects 0 based index of (briefing, team, players etc)

//remember records added to the briefing are in reverse order e.g
//Operation Blunt = 0
//Secure the Depot = 1
//Destroy Munitions =  2
//Extraction = 3

______________________

EDIT

Just to cover both situations, If you need to do the same from the in game Map screen

briefing.sqf

brief3 = player createDiaryRecord ["Diary", ["Extraction", "Reach the designated landing zone and hold it until Extraction."]];

brief2 = player createDiaryRecord ["Diary", ["Destroy Munitions", "Destroy any weapons and ammunition found on site."]];

brief1 = player createDiaryRecord ["Diary", ["Secure the Depot", "Eliminate Defences at the Depot."]];

brief0 = player createDiaryRecord ["Diary", ["Operation Blunt", "This is a mission to destroy the enemies munition supplies. You will be dropped off shore, complete the objectives and get to the extraction site."]];

init.sqf (or where ever)

processDiaryLink (createDiaryLink ["Diary", brief2, ""]);

Edited by Larrow