Jump to content
Sign in to follow this  
Przemek_kondor

Permanent info HUD

Recommended Posts

Hi,

I want to create some permanent info HUD, which will display scores, time, etc (controls can change! ). So I need some dialog or RscTitles.

Dialog's disadvantage is that dialog blocks movement of player (movingEnable = true; doesn't work properly).

RscTitles disadvantage is that I don't know how to get handler of it for change text on it etc.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class RscTitles

{

 titles[] = {hud};

 class hud

 {

   idd = 100;

   movingEnable = true;

   duration = 120;

   fadein = 0;

   name = "hud";

   controls[] = {"image1"};

   class info1: RscText

   {

     idc = 101;

     (...)

     text = "text of info1";

   };

 };//hud

};//RscTitles

So how to get acces to hud display and info1 after calling:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

cutRsc["hud","PLAIN"];

?

Share this post


Link to post
Share on other sites

hi..

here is a example of my watersystem for the harrier.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class NUXWATER

{

idd = 701;

movingEnable = 1;

duration = 9999;

fadein = 0;

fadeout = 0;

name = "NUXWATER";

onLoad = "NUXWATER = (_this select 0)";

class controls

{

class NUXWEHBACKGROUND

{

idc = -1;

type = 0;

colorText[] = {1, 1, 1, 1};

font = "Bitstream";

colorBackground[] = {0, 0.55, 0, 0.4};

text =;

style = 128;

sizeEx = 0.015;

x = 0.77;

y = 0;

w = 0.23;

h = 0.2;

};

....

....

....

};

nb.. this are subclasses of class RscTitles

now. i call the titleRsc with titleRsc["NUXWATER", "PLAIN"];

assuming _blah has a idc

_blah = NUXWATER displayCtrl XXX;

you use command "ctrlSetXXXX" for "text|pos|color" or whatever on yor idc.. check the wiki out. for all ctrlSet commands

_blah ctrlSetText "my text";

then _blah ctrlCommit 0;

hope this was helpfull

Share this post


Link to post
Share on other sites

I have small problem:

I created a progressbar which I want to animate:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

while{ true }do

{

   titleRsc["hud", "plain"];

   _new_width = ...

   _progressbar ctrlSetPosition [x, y, _new_width, h];

   _progressbar ctrlCommit 2.0;

   waitUntil { ctrlCommited _progressbar };

};

But this animation always starts from original width (defined in description.ext) instead of previously calculated _new_width.

So my question is: how to create smooth progressbar animation?

edit: Propably it is caused by creating new instance of hud by calling titleRsc

Share this post


Link to post
Share on other sites

Last I read, progress bar controls aren't something that we as end-users can manipulate. Kind of like rscTree. I've tried to find alternative syntax for manipulating progress bar controls, but I haven't been successful.

Note: If this information is wrong, I apologize and look forward to the correct answer. Manipulating a progress bar control is something that would help me quite a bit.

Share this post


Link to post
Share on other sites

_progressbar in my case is static text :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#define CT_STATIC 0

...

 class Progressbar{

  type = CT_STATIC; //not true bis progressbar

  ...

 };

with no text - only red background which is resized

Share this post


Link to post
Share on other sites

its verry simple to make a progressbar.

i'll show you some code on howto do it later..

im at work now.. if no one else shows you.

you have to wait 10 Houers. smile_o.gif

Share this post


Link to post
Share on other sites

as I thought, problem was caused by calling new instance of hud in every step of while-loop.

The solution is create only one hud with long duration:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

titleRsc["hud", "plain"];

while{ true }do

{  

  _new_width = ...

  _progressbar ctrlSetPosition [x, y, _new_width, h];

  _progressbar ctrlCommit 2.0;

  waitUntil { ctrlCommited _progressbar };

};

and it now works properly

Share this post


Link to post
Share on other sites

That's a very interesting way to create a progress bar. I hadn't thought that far outside the box, very creative. smile_o.gif Nuxil, I look forward to seeing if you have another creative solution. This wasn't my thread, but it's been very helpful to me so far. Thanks!

Share this post


Link to post
Share on other sites

hey Przemek_kondor thats basicly the same way i do it.

so giving a example wount be nessesary..

however.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

while {true} do

{

scare me

};

you never know,

lest say titleText["blah", "PLAIN"] gets called.

you can then not commit the progressbar.

also you could do

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

titleRsc["hud", "plain"];

while {(!(isnull hud))} do

{

code..

};

sleep X; so you can read a titletext if one occures

_callmeagain = [yourparms] execvm "this-script.sqf";

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  

×