Jump to content
Sign in to follow this  
wok

Can the slider arrows be removed?

Recommended Posts

I am thinking about doing a progress bar, the easiest way I though was using a slider and sliderSetPosition, but I don't know how to remove or hide the slider arrows. Is that even possible?

I tried making the slider bigger than the background control box I have, but the overflow is not hidden as I though it would be.

Share this post


Link to post
Share on other sites

there is a dedicated progress bar control already, why reinvent the wheel?

Share this post


Link to post
Share on other sites

There is a progress bar control but there is no way to actually progress it, it can only be controlled by the engine.

Yes, you can remove the slider arrows by setting their color alpha to 0 IIRC but an easier solution would be to use a static rectangle and then resize it using ctrlSetPosition (don't forget to ctrlCommit).

Share this post


Link to post
Share on other sites
There is a progress bar control but there is no way to actually progress it, it can only be controlled by the engine.

Really? I must be doing something wrong, because I just created one and set it to progress 30% with progressSetPosition

http://killzonekid.com/etc/progress.jpg (129 kB)

Don't believe everything you read on wiki.

Share this post


Link to post
Share on other sites

I though I replied to this thread yesterday, sorry I may have forgot about pressing submit :P

there is a dedicated progress bar control already, why reinvent the wheel?

This is what I found about the progress bar control: http://community.bistudio.com/wiki/DialogControls-ProgressBar

Progress bars are handled by the engine internally. While it is technically possible to attach a progress bar to a dialog, there are no means to influence it (e.g. setting it's value). The progress bar will always stay at 0%.

So I didn't even tried it. I may look into it later if I have some time, since you show it really works. I used a simple background and changed the size, this is the code:

progressBar.hpp

class ProgressBar_Text {
x = 0;
y = 0;
h = 0.037;
w = 0.3;
type = 0;
style = 0;
shadow = 1;
colorShadow[] = {0, 0, 0, 0.5};
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
colorText[] = {1, 1, 1, 1.0};
colorBackground[] = {0, 0, 0, 0};
linespacing = 1;
};

class ProgressBar
{
name = "ProgressBar";
idd = 3400;
movingEnable = false;
enableSimulation = true;

class controlsBackground {

	class ProgressBarBackground : ProgressBar_Text {
		colorBackground[] = {0, 0, 0, 0.7};
		idc = -1;
		x = 0.1999 - 0.004;
		y = 0.074 - 0.004;
		w = 0.6 + 0.008;
		h = 0.05 + 0.008;
	};

	class ProgressBarFillBar : ProgressBar_Text {
		colorBackground[] = {
			"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", 
			"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", 
			"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 
			"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"
		};
		idc = 3401;
		x = 0.1999;
		y = 0.074;
		w = 0;
		h = 0.05;
	};

	class ProgressBarText : ProgressBar_Text {
		colorBackground[] = {0, 0, 0, 0};
		idc = 3402;
		x = 0.1999;
		y = 0.074;
		w = 0.6;
		h = 0.05;
	};

};
};

progressBar.sqf

progressBar_progress = {
private["_progress", "_progressBar", "_position"];
_progress = _this select 0;
_progressBar = (findDisplay 3400) displayCtrl 3401;
_position = ctrlPosition _progressBar;
_progressBar ctrlSetPosition [(_position select 0), (_position select 1), ( _progress / 100 ) * 0.6, 0.05];
_progressBar ctrlCommit 0;
};

progressBar_setText = {
private["_text"];
_text = _this select 0;
ctrlSetText [3402, _text];
};


progressBar_open = {
_progressBar = createDialog "ProgressBar";
};

progressBar_close = {
closeDialog 3402;
};

This is how it looks like:

AhUO8Ph.jpg

Share this post


Link to post
Share on other sites

I think what whoever wrote it meant was that there is no property to set it to some initial value. I know the description is very misleading many people won't even try it. Also to set it to initial value you can do it from onLoad property. This is how I did it

onload = "((_this select 0) displayCtrl [control_idc_goes_here_without_square_brackets]) progressSetPosition 0.3;";

Share this post


Link to post
Share on other sites
I think what whoever wrote it meant was that there is no property to set it to some initial value. I know the description is very misleading many people won't even try it. Also to set it to initial value you can do it from onLoad property. This is how I did it

onload = "((_this select 0) displayCtrl [control_idc_goes_here_without_square_brackets]) progressSetPosition 0.3;";

Whoever wrote that meant that there is no way to set the value at all, because there wasn't at that point. The command says it was introduced in A2 but I don't believe it actually worked, hence my reply. If it does now work the wiki page should be updated.

Share this post


Link to post
Share on other sites
Whoever wrote that meant that there is no way to set the value at all, because there wasn't at that point. The command says it was introduced in A2 but I don't believe it actually worked, hence my reply. If it does now work the wiki page should be updated.

progressSetPosition command is available since ArmA 1.0 http://community.bistudio.com/wiki/progressSetPosition so how is that relevant?

Share this post


Link to post
Share on other sites
progressSetPosition command is available since ArmA 1.0 http://community.bistudio.com/wiki/progressSetPosition so how is that relevant?

I was replying to your statement that whoever wrote it meant something else, he didn't, the command just didn't exist when it was written. I also suggested you update the page (it is a wiki) if you have some new information.

Edited by Deadfast

Share this post


Link to post
Share on other sites
I was replying to your statement that whoever wrote it meant something else, he didn't, the command just didn't exist when it was written. I also suggesting you update the page (it is a wiki) if you have some new information.

And I told you command existed always since the beginning of time, that is Arma 2 1.0 not ArmA 2 OA and not ArmA 3. It makes no sense why give control you cannot control, think about. Why are you trying to defend the idiot that made this stupid statement on wiki that puts people off even trying to use progress bar?

Also I have no access to wiki editing and neither I can register.

Edited by Killzone_Kid
kinda went overboard

Share this post


Link to post
Share on other sites

Hi there,

I am interested about this progress bar but i have no clue to add it to my support.sqf.

Maybe someone could help me out with that.

support.sqf:

_object = _this;

_type = typeOf _object;

x_reload_time_factor = 10.0;

_object setFuel 0;

_object setVehicleAmmo 1;

_object vehicleChat format ["Servicing %1... Please stand by...", _type];

_magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines");

if (count _magazines > 0) then {
_removed = [];
{
	if (!(_x in _removed)) then {
		_object removeMagazines _x;
		_removed = _removed + [_x];
	};
} forEach _magazines;
{
	_object vehicleChat format ["Reloading %1", _x];
	sleep x_reload_time_factor;
	_object addMagazine _x;
} forEach _magazines;
};

_count = count (configFile >> "CfgVehicles" >> _type >> "Turrets");

if (_count > 0) then {
for "_i" from 0 to (_count - 1) do {
	scopeName "xx_reload2_xx";
	_config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i;
	_magazines = getArray(_config >> "magazines");
	_removed = [];
	{
		if (!(_x in _removed)) then {
			_object removeMagazines _x;
			_removed = _removed + [_x];
		};
	} forEach _magazines;
	{
		_object vehicleChat format ["Reloading %1", _x];
		sleep x_reload_time_factor;
		_object addMagazine _x;
		sleep x_reload_time_factor;
	} forEach _magazines;
	_count_other = count (_config >> "Turrets");
	if (_count_other > 0) then {
		for "_i" from 0 to (_count_other - 1) do {
			_config2 = (_config >> "Turrets") select _i;
			_magazines = getArray(_config2 >> "magazines");
			_removed = [];
			{
				if (!(_x in _removed)) then {
					_object removeMagazines _x;
					_removed = _removed + [_x];
				};
			} forEach _magazines;
			{
				_object vehicleChat format ["Reloading %1", _x]; 
				sleep x_reload_time_factor;
				_object addMagazine _x;
				sleep x_reload_time_factor;
			} forEach _magazines;
		};
	};
};
};
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

sleep x_reload_time_factor;
_object vehicleChat "Repairing...";
_object setDamage 0;
sleep x_reload_time_factor;
_object vehicleChat "Refueling...";
while {fuel _object < 0.99} do {
//_object setFuel ((fuel _vehicle + 0.1) min 1);
_object setFuel 1;
sleep 0.01;
};
sleep x_reload_time_factor;
_object vehicleChat format ["%1 is ready...", _type];

if (true) exitWith {};

Thanks

anjan

Share this post


Link to post
Share on other sites

I really need a hand with a progress bar I'd like to incorporate into a new mission I'm making. I've tried a couple things on my own and haven't met with much success. I tried to use what wok posted above, but I can't get that to work either. Any help would be appreciated. I just want to create a relatively simple progress bar on screen and control its count to complete over a timed period.

Share this post


Link to post
Share on other sites

Sorry guys that I couldn't reply earlier, I had some personal issues that took me away from gaming for some time. You can find a working sample of the progress bar here: http://www.ahoyworld.co.uk/topic/1154-suggestion-refuelrepair-in-dialogbox/?hl=progressbar#entry5607

Check the sendspace link, it's a sample mission that contains all the code.

Edit: The download link is not working atm, I will need some time to find the files and upload them again.

Edit2: Here's the download link: http://www.sendspace.com/file/rme5dn, the files you want to check are ./misc/progressBar.hpp and ./misc/progressBar.sqf, then in the file rearmVehicle.sqf is where that code is used. Also in the file description.ext you have include the .hpp file with #include "misc\progressBar.hpp". This is how the progress bar is implemented in the rearmVehicle.sqf file:

/* open progress bar & set initial text */
[] call progressBar_open;
[format ["Repairing and refuelling %1. Stand by...", _vehType]] call progressBar_setText;
/*--------------------------------------*/

/* set initial % */
[format ["Repairing (%1", floor (100 - (_damage * 100))] + "%)..."] call progressBar_setText;
[100 - (_damage * 100)] call progressBar_progress;
/*---------------*/

/* this goes inside a loop to update the percentage and text of the bar */
/* update % in text & bar */
[format ["Repairing (%1", floor _percentage] + "%)..."] call progressBar_setText;
/*----------------------------------------------------------------------*/

/* close progress bar */
[] call progressBar_close;
/*--------------------*/

Edited by wok

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  

×