Jump to content
wingnutwn

GUI Teleport Menu with Map

Recommended Posts

Looking for some advice on my GUI which I always seem to have problems understanding.   I have created a GUI for a teleport script, I have a listbox that all the possible places to teleport to has below that teleport button and so on with a map inside the screen.   what I would like to do is when I click on say the HQ in the listbox the map moves to the position.

 

Spoiler

createDialog "wn_teleport_menu";


//player listbox
_ctrl = (findDisplay 7140) displayCtrl 1500;

teleportarraylist = [];
_teleportnames = [];

{
    if (_x != player) then
        {
            teleportarraylist pushback _x;
            _name = name _x;
            lbAdd [1500, _name];
        };
} forEach allplayers;

{
    if (_x != player) then
        {
            teleportarraylist pushback _x;
            _name = name _x;
            lbAdd [1500, _name];
        };
} forEach units group player;

{
    if (typeOf _x == "Flag_US_F") then 
        {
            _name = vehicleVarName _x;
            teleportarraylist pushback _x;
            lbAdd [1500, _name];
        };
} forEach allMissionObjects "all";


_fobMarkers = allMapMarkers select {toUpper _x find "FOBFLAG" >= 0};
{
    _flagpos = getMarkerPos _x nearestObject "Flag_NATO_F";
    _name = MarkerText _x;
    teleportarraylist pushback _flagpos;
    lbAdd [1500, _name];
} forEach _fobMarkers;

{
    if ("MHQ" in vehicleVarName _x) then 
        {
            _mhqarray = format ["%1_INFO",_x];
            _mhqarray = missionNameSpace getVariable [_mhqarray,[]];
            _deployed = _mhqarray select 3;
            if (_deployed) then 
                {
                    teleportarraylist pushBack _x;
                    lbAdd [1500, str _x];
                };
        };
} forEach vehicles;


lbSetCurSel [1500, 0];

 

 

 

Spoiler

class wn_teleport_menu
{
    idd = 7140;
    class controls
    {
        class wn_teleport_picture: RscPicture
        {
            idc = 1200;
            text = "#(argb,8,8,3)color(1,1,1,1)";
            x = 0.298904 * safezoneW + safezoneX;
            y = 0.236 * safezoneH + safezoneY;
            w = 0.402187 * safezoneW;
            h = 0.396 * safezoneH;
            colorText[] = {0,0,0,0.8};
            colorBackground[] = {0,0,0,0.8};
            colorActive[] = {0,0,0,0.8};
            sizeEx = 0.028;
        };
        class wn_teleport_activemap: RscMapControl
        {
            idc = 900;
//            text = "#(argb,8,8,3)color(1,1,1,1)";
            x = 0.386565 * safezoneW + safezoneX;
            y = 0.269 * safezoneH + safezoneY;
            w = 0.3092 * safezoneW;
            h = 0.326 * safezoneH;
            colorText[] = {0,0,0,0.8};
            colorBackground[] = {0,0,0,0.8};
            colorActive[] = {0,0,0,0.8};
            sizeEx = 0.028;
        };        
        class wn_teleport_frame: RscFrame
        {
            idc = 1800;
            text = "WN TELEPORT SYSTEM"; //--- ToDo: Localize;
            x = 0.298905 * safezoneW + safezoneX;
            y = 0.236 * safezoneH + safezoneY;
            w = 0.402187 * safezoneW;
            h = 0.396 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,1};
            sizeEx = 0.028;
        };
        class wn_teleport_teleport: RscListbox
        {
            idc = 1500;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.269 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.165 * safezoneH;
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,1};
            sizeEx = 0.028;
        };
        class wn_teleport: RscButton
        {
            idc = 1600;
            text = "TELEPORT"; //--- ToDo: Localize;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.445 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,0.5};
            sizeEx = 0.028;
            action = "execVM 'menus\wn_teleportplayer.sqf'";
        };
        class wn_teleport_map_solo: RscButton
        {
            idc = 1601;
            text = "MAP (SOLO)"; //--- ToDo: Localize;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.478 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,0.5};
            sizeEx = 0.028;
            action = "closeDialog 1; execVM 'menus\wn_mapteleportsolo.sqf'";
        };
        class wn_teleport_map_group: RscButton
        {
            idc = 1602;
            text = "MAP (TEAM)"; //--- ToDo: Localize;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.511 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,0.5};
            sizeEx = 0.028;
            action = "closeDialog 1; execVM 'menus\wn_mapteleportgrp.sqf'";
        };
        class wn_teleport_halo: RscButton
        {
            idc = 1603;
            text = "HALO (SOLO)"; //--- ToDo: Localize;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.544 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,0.5};
            sizeEx = 0.028;
            action = "closeDialog 1; [player] execVM 'menus\wn_halosolo.sqf'"
        };
        class wn_teleport_halo_grp: RscButton
        {
            idc = 1604;
            text = "HALO (TEAM)"; //--- ToDo: Localize;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.577 * safezoneH + safezoneY;
            w = 0.0670312 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,1};
            colorActive[] = {0,0,0,0.5};
            sizeEx = 0.028;
            action = "closeDialog 1; [player] execVM 'menus\wn_halogrp.sqf'"
        };
    };
};

 

Share this post


Link to post
Share on other sites

Thanks 7erra, I think this one might be out of my range to figure out which is ok.   I've played with a bunch of lines to see what happens.   Started with the basics simple hint when lbselchanged not sure how to send that information to IDC 900 - maybe call a function?   Anyways thanks for putting me in a direction. 

 

 

Share this post


Link to post
Share on other sites

The LBSelChanged EH passes the control as a parameter. we can use that to get the display from which we can then get the map control again:

params ["_ctrlList", "_index"];
// Somehow get position fron the entry...
private _display = ctrlParent _ctrlList;
private _ctrlMap = _display displayCtrl 900;
_ctrlMap ctrlMapAnimAdd [0, 0.25, _pos];
_ctrlMap ctrlMapAnimCommit 0;

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×