Jump to content

Recommended Posts

Hi all,

i have a question about coloured groupid's, i want to have color for the group id  in the teamswitch.
could someone help me on that ?


here is what i'm trying to do

Spoiler

//here is my text
_text = "here is my text";
 
//
//here is my coloured hint
_coloredtext = parseText format ["<t color='#1c7426'>%1</t>", _text];
 
_coloredhint = hint _coloredtext;
 
//
//now i want my grpid in green in teamswitchmenu
//doing it the same way (but wrong)
 
_normalgrpid = "here is my normal grpid";
 
player setGroupId [_normalgrpid];    //ok

 

_newgrpid = "here is my colored new grpid";
 
_colorednewgrpid = parseText format ["<t color='#1c7426'>%1</t>", _newgrpid];
 
player setGroupId [_colorednewgrpid];    // error
 
//_coloredhint is green and working
//_normalgrpid is working
//_colorednewgroupid give error type text, expected //string

 

 

screenshot of the thing

image 

 

thank you for your help

 

 

  • Like 1

Share this post


Link to post
Share on other sites
36 minutes ago, Subluminik said:

thank you for your help

 

Hello there Subluminik and welcome to Bis Forums  !

 

This is an example from my GF Units Map Markers and Symbols Scipt - Mod

 

https://community.bistudio.com/wiki/setGroupIconParams

clearGroupIcons (group _this);	
setGroupIconsVisible [ true, true ];
group _this addGroupIcon [_Symbol, [0,0.5]];	
_Display_Text = format["%1	[%2]", _name, getText(configFile>>"CfgVehicles">>typeOf vehicle _this>>"DisplayName")];
group _this setGroupIconParams [ side _this call BIS_fnc_sideColor,_Display_Text,1,true ];

 

If you want more to check here :

 

Thanks !

 

TIP : Click to follow your topic !

Share this post


Link to post
Share on other sites

Hello,

Welcome to the forum. You can't do that. Parsed text is OK for hint but not for setGroupId, waiting for a string as name format.

 

Anyway, if you want to color the unit lines in green, when in player's group, you can use :

 

fnc_teamSwitch = {
  disableSerialization;
  _ctrlDispl = _this;
  private _idc = ctrlIDC (_ctrlDispl select 0);
  private _selectedIndex = _ctrlDispl param [1];
  _displ = findDisplay 632;
  _ctrl101 = _displ displayCtrl 101;
  _cnt = (lbsize 101) -1;
  for "_i" from 0 to _cnt do {
    _selectedUnit = switchableUnits param [_i,objNull];
    _unit = vehicle _selectedUnit;
    if (group _unit == group player) then {
      lbSetColor [_idc, _i,[0.3,1,0.3,1]];
    };
  };
};
 
0 = [] spawn {
  while {true} do {
    waituntil {sleep 0.2; !isnull findDisplay 632};
  (findDisplay 632 displayCtrl 101) ctrlAddEventHandler ["LBSelChanged", "_this call fnc_teamSwitch"];
    waitUntil {sleep 0.2; isNull findDisplay 632};
  };
};

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Ahah thank you GEORGE FLOROS GR and PierreMGI that perfecly what i was looking for !

 

here is how i've apllied it to my example :

1549144800-error.png

 

Quote

//i want custom grp id in teamswitchmenu
 
_customgrpid = "customized grpid";
 
player setGroupId [_customgrpid];    //ok
 
//George Floros GR solution
_Symbol = "b_inf";   
 
clearGroupIcons (group player);   
setGroupIconsVisible [ true, true ];
group player addGroupIcon [_Symbol, [0,0.5]];   
_Display_Text = format["%1 [%2]", _customgrpid, getText(configFile>>"CfgVehicles">>typeOf vehicle player>>"DisplayName")];
group player setGroupiconParams [ side player call BIS_fnc_sideColor,_Display_Text,1,true ];
 
 
//Pierre MGI solution
 
fnc_teamSwitch = {
  disableSerialization;
  _ctrlDispl = _this;
  private _idc = ctrlIDC (_ctrlDispl select 0);
  private _selectedIndex = _ctrlDispl param [1];
  _displ = findDisplay 632;
  _ctrl101 = _displ displayCtrl 101;
  _cnt = (lbsize 101) -1;
  for "_i" from 0 to _cnt do {
    _selectedUnit = switchableUnits param [_i,objNull];
    _unit = vehicle _selectedUnit;
    if (group _unit == group player) then {
      lbSetColor [_idc, _i,side player call BIS_fnc_sideColor];
    };
  };
};
 
0 = [] spawn {
  while {true} do {
    waituntil {!isnull findDisplay 632};
  (findDisplay 632 displayCtrl 101) ctrlAddEventHandler ["LBSelChanged", "_this call fnc_teamSwitch"];
    waitUntil {sleep 0.2; isNull findDisplay 632};
  };
};

 

  • Like 1
  • Thanks 1

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

×