OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.Peanut on 23 Jan 2006, 22:15:26

Title: progress bar
Post by: Mr.Peanut on 23 Jan 2006, 22:15:26
does anyone have a link to a tutorial, reference etc., that explains how to use the progress bar resource/dialogue?
Title: Re:progress bar
Post by: TKC_Hubertus on 24 Jan 2006, 00:07:06
Many people will say it is not possible to create a working status bar, thats why you cant find a tutorial.

I created a working statusbar for you:


description.ext
Code: [Select]
#define FontM "tahomaB36"
#define FontHTML "CourierNewB64"

#define ST_LEFT       0
#define ST_RIGHT      1
#define ST_CENTER     2
#define ST_FRAME      64

#define CT_STATIC     0
#define CT_BUTTON     1
#define CT_EDIT       2
#define CT_COMBO      4
#define CT_LISTBOX    5
#define CT_ACTIVETEXT 11

class RscText
{
        type = CT_STATIC;
        idc = -1;
        style = ST_LEFT;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1, 1, 1, 1};
        font = FontM;
        sizeEx = 0.04;
};





class Dlgstatus
{
  idd = -1;
  movingEnable = true;
  controlsBackground[] = { back, frame, status, statusbar, text };
  class back : RscText
  {
     colorBackground[] = {0.4, 0.4, 0.4, 0.75};
     text = ;
     x = 0.4;
     y = 0.2;
     w = 0.3;
     h = 0.35;
  };
class statusbar : RscText
  {
     colorBackground[] = {0, 0, 0.75, 0.75};
     text = ;
     x = 0.44;
     y = 0.3;
     w = statusx;
     h = 0.02;
  };
class status : RscText
  {
     colorBackground[] = {0.75, 0.75, 0.75, 0.75};
     text = ;
     x = 0.44;
     y = 0.3;
     w = 0.2;
     h = 0.02;
  };
class text : RscText
  {
     colorBackground[] = {0, 0, 0, 0.75};
     text = Closing OFP...;
     x = 0.44;
     y = 0.4;
     w = 0.2;
     h = 0.04;
  };
  class frame : RscText
  {
      idc = 103;
      style = ST_FRAME;
     colorText[] = {0, 0, 0, 1};
     text = " ";
     font = FontHTML;
     sizeEx = 0.025;
     x = 0.41;
     y = 0.21;
     w = 0.28;
     h = 0.33;
  };

  objects[] = { };
  controls[] = { };
 
 
};

init.sqs
Code: [Select]
statusx = 0



~3
dlg=createdialog "dlgstatus"
~2


#loop
? statusx >= 0.2: goto "done"
~0.005
closedialog 0
statusx = statusx + 0.001
dlg=createdialog "dlgstatus"
goto "loop"

#done
b="SmokeSource" camcreate [0,0,0];b setpos [10,10,10]
Title: Re:progress bar
Post by: General Barron on 24 Jan 2006, 11:36:36
Interesting... so are you saying it is possible to use global variables (changing in-mission) in the description.ext?

It looks to me like you are using a global variable for the length of one control; that global variable changes, and the dialog is re-loaded with the new value.

I had no idea you could do this. Very cool!
Title: Re:progress bar
Post by: TKC_Hubertus on 24 Jan 2006, 13:58:39
Yes, its possible to use variables in the description.ext. For example, you can use them to animate the background colour:


colorBackground[] = {r, g, b, 0.75};


r=0.75;g=0.75;b=0.75
#loop
?b<=0:Exit
~0.005
closedialog 0
? r<=0: g=g-0.01
? g<=0: b=b-0.01
r=r-0.01
dlg=createdialog "dlgstatus"
goto "loop"
Title: Re:progress bar
Post by: Mr.Peanut on 24 Jan 2006, 14:42:36
Very cool. Thank you.

What I was interested in doing was making a repair status bar, but I see this is a problem because the dialogue effectively disables user input.  What I wanted was a status bar that would display but would not interrupt the players' game. I guess another way to fake this would be by cycling through a few picture resources.
Title: Re:progress bar
Post by: Trapper on 24 Jan 2006, 18:08:41
There is a progress bar like you're looking for in the mission "When the World Ends", over at the beta testing board.
It shows the health of important targets every now and then. Player input isn't interrupted.

EDIT: Also there is a player health bar in the mission "Three kings" IIRC.
Title: Re:progress bar
Post by: 456820 on 24 Jan 2006, 22:17:24
and theres one in the mission Morning Dew a very good one may i add too.
It was entered in the BIS mission comp
Title: Re:progress bar
Post by: Tyger on 24 Jan 2006, 22:54:23
those all use titleRscs. Check General Barron's tute in the ED on how to make them. They are similar to dialogs, and don't intrupt the game. I'm not sure if you can do the above with them though...
Title: Re:progress bar
Post by: Mr.Peanut on 25 Jan 2006, 15:47:55
Many thanks.