Jump to content
Elite IV

override colorBar[] property in another script

Recommended Posts

Hello, 


I can't seem to find any reference that will help me with this, I want to set this "colorBar[]" property/member from CT_PROGRESS class in another script.

 

My goal is to change the bar's color depending on the level it's on, 100 being green, 60 being orange and 30 being red. How can i manipulate colorBar outside of it's class. I found "lbSetColor" and it takes in a param: index which is a number but I don't know if that index number colors colorBar as this might a seperate group / class it's apart of. I have been trying to find reference on this through the wiki but no luck, could someone point my in the right direction?

This is my code:

 

#define CONTROL(disp,ctrl) ((findDisplay ##disp) displayCtrl ##ctrl) //in another file that's included around the mission. Thought i would put it here so ya'll can see

private _thirstBar = CONTROL(500,513);


if (playerThirst > 60) then {
	_thirstBar lbSetColor [0, [0.9,0,0,1]]; //Green
};

 

Any help would be nice, I am trying to modify "colorBar[]" in a script that's run through a loop in the mission. Probably not the cleanest way but it's the way I know.

 

I just realized upon writing this that lb actually stands for listBox i believe and lbSetColor only manipulates Listbox / CT_LISTBOX and CT_COMBO controls. Which what I am doing is not part of the list boxes lol

What command could i use to manipulate the "colorBar[]" property?

 

Thanks everyone.


EDIT: i just found this: ctrlSetTextColor

 

Since Arma 3 v1.40 the fill color can be changed via the ctrlSetTextColor command. Prior to Arma 2 there were no means to manipulate a progress bar.

Sets text color of given control. Color is in format Color (RGBA). As of Arma 3 v1.40 this command can also be used to change fill-color of a CT_PROGRESS control. 

I might be on the money here, I'll update the thread with solution if I manage to work it out! 

 

still no luck, any help would be nice

Share this post


Link to post
Share on other sites

I'm not sure you can do that because the color is probably often updated in initial code. Overwriting it requires a loop to say the least. You should think about your own display. That could be less resource consuming.

  • Thanks 1

Share this post


Link to post
Share on other sites

You could create any other control and just manipulate its background (ctrlSetBackgroundColor) and width (and another one behind it for the bg/empty color). E.g. even RscText should work.

 

After all its just a colored rectangle, right.

  • 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

×