Home   Help Search Login Register  

Author Topic: progress bar  (Read 1735 times)

0 Members and 2 Guests are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
progress bar
« 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?
« Last Edit: 23 Jan 2006, 22:18:04 by Mr.Peanut »
urp!

TKC_Hubertus

  • Guest
Re:progress bar
« Reply #1 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]
« Last Edit: 24 Jan 2006, 13:47:43 by TKC_Hubertus »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:progress bar
« Reply #2 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!
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

TKC_Hubertus

  • Guest
Re:progress bar
« Reply #3 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"

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:progress bar
« Reply #4 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.
« Last Edit: 24 Jan 2006, 14:57:11 by Mr.Peanut »
urp!

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re:progress bar
« Reply #5 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.
« Last Edit: 24 Jan 2006, 18:10:03 by Trapper »

Offline 456820

  • Contributing Member
  • **
Re:progress bar
« Reply #6 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

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:progress bar
« Reply #7 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...
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:progress bar
« Reply #8 on: 25 Jan 2006, 15:47:55 »
Many thanks.
urp!