Jump to content
Sign in to follow this  
mindstorm

Multiple buttons problem with IDC

Recommended Posts

I created a button and I'd like to use this button for a couple of actions.

	class BtnAction : MyButton
	{
		idc = 5000;
		text = "Vote";
		onButtonClick = "";
		x = 0.1; y = 0.1;
		w = 0.20;
		h = 0.04;
	};

So the idea is I have a list of action and I want to create an button for each action. The thing is that my script will be used by others so the amount of actions can vary. Is there a way (script) to create multiple buttons on a display with a different "setting" so you can distinguish them upon the buttonclick?

So I sorta want this:

_actions = [["Spawn unit","call fncSpawnUnit;"],
["Spawn vehicle","call fncSpawnVehicle"],
["",""]];

_i = 0;
{
  (findDisplay 46) createDisplay "BtnAction";
  _theCreatedButton = ????
  _pos = ctrlPosition _theCreatedButton;
  _newPos = [_pos select 0, (_pos select 1 + (_pos select 3 + 0.02) * _i), _pos select 2, _pos select 3];
  _theCreatedButton ctrlSetPosition _newPos;
  ctrlSetText [_theCreatedButton, _x select 0];
  _theCreatedButton ctrlAddEventHandler ["onButtonClick",_x select 1];
  _i = _i +1;
} foreach _actions;

There's probably more then one thing wrong with this code but if anyone could help me in the right direction I would really appreciate that. I used this tutorial for reference but it's really outdated (at least that's the general idea I get out of it).

Also another question, what is the IDC of the MAP? I'd like to create the display on top of the map (you get the idea). This way I don't have to open/close the display each time the map is opened/closed (at least that is how I think it works).

Share this post


Link to post
Share on other sites

I hate to bump but I'd really like to get an answer on this one.

Also Is there way to find out IDC's of current display? I'd like to "hide" the stance display if possible.

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
Sign in to follow this  

×