Jump to content
Sign in to follow this  
Rough Knight

Dialogue\Display problem...Display as background object ?

Recommended Posts

Hi guys,

Hopefully there is no bis_fnc_stopwatch or something because I have spent too much time on this problem :eek:

I am trying to make a stopwatch that appears as a non-interactive object on the players screen [ ie they keep playing while the display is active] and this is what I have so far.

* Stopwatch .paa file which pops up on screen when I call the dialogue.

* Working counter in seconds on the display. Further scripting will be added later to add hours, minutes, seconds and hundreds of seconds.

The problem I have is whenever I call the script the stopwatch pops up fine, but so does the mouse icon so I can not keep playing until I close the dialogue ie it is more an interactive control than a display?

I have enableSimulation = true; which lets the game carry on while the display is up...but still the mouse icon is active to my player can not move until I close the display.

stopwatch.hpp

#define CT_STATIC 0
#define ST_PICTURE 48

#define ST_LEFT 0
#define ST_FRAME 64

#define RACE_TIME 10100

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


class RscPicture
{
       type = CT_STATIC;
       idc = -1;
       style = ST_PICTURE;
       colorBackground[] = {0, 0, 0, 0};
       colorText[] = {1, 1, 1, 1};
       font = "Bitstream";
       sizeEx = 0.04;
};


class dialoguestopwatch
{
 idd = fro_stopwatch;
 movingEnable = false;
 enableSimulation = true;

 controlsBackground[] = {ST_BACKGROUND};
 class ST_BACKGROUND : RscPicture
 {
    colorBackground[] = {0, 0.2, 0.4, 0};
    text = "fro_timer\stopwatch.paa";
 moving = true;
    sizeEx = 0.015;
    x = 0.0;
    y = 0.0;
    w = 0.22;
    h = 0.215;
 };

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

 class FRO_TIMER : RscText
 {
 	idc = RACE_TIME;
 	x = 0.09;
 	y = 0.08;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.05;
text = "";
 };
};

Then my calling script [only total time in seconds ATM]:

private ["_n", "_time1", "_time2"];

RACE_TIME = 10100;

n = 2;
_n = 0;

_ok = createDialog "dialoguestopwatch";
if (!_ok) then {hint "Problem creating stopwatch!"};

_time1	= time;
_time2	= 0;

while {true} do         //controls to be added later
{
  if (true) then        //controls to be added later
  {
         _time2 = time - _time1;
        _n = round (_time2 * (10 ^ n)) / (10 ^ n);    //time rounded to two decimal points.
        ctrlSetText [RACE_TIME, format["%1", _n]];

        sleep 0.033;	
  };
sleep 0.1;
};

I am hoping there is a dialogue control that allows for a non-interactive display. Can anyone advise me on how to achieve this? Is this the diference between createDialogue and createDisplay?

I hope I haven't been barking up the wrong tree. Thanks heaps.

Rough Knight

Edited by Rough Knight

Share this post


Link to post
Share on other sites

Thanks guys,

I got it working using the cutRsc method. Thanks heaps both of you.

I didn't quite follow that example Carlos, it was a little over my head but I will go back and experiment once I have perfected a few more things.

I am glad for the example because I saw this::D

5 cutRsc ["DEFAULT","PLAIN"]; //Removes it as a display

I couldn't work out how to kill the display until I saw that. :yay:

Thanks

ROugh Knight

Share this post


Link to post
Share on other sites

You should use "" (empty string) instead of "DEFAULT". Pretty sure the latter will produce an error in RPT (Resource not found).

Share this post


Link to post
Share on other sites

This should help you with the time script as well. I dont remember where I got this from but it was a real old time script, I edited it slightly for my needs. Should work for you as well.

while {true} do {
   _seconds = time;

   _hours = floor(_seconds / 3600);
   _seconds = _seconds - (_hours * 3600);
   _tensOfMinutes = floor(_seconds / 600);
   _seconds = _seconds - (_tensOfMinutes * 600);
   _minutes = floor(_seconds / 60);
   _seconds = _seconds - (_minutes * 60);
   _tensOfSeconds = floor(_seconds / 10);
   _wholeSeconds = floor(_seconds - (_tensOfSeconds * 10));
   _elapsed ="";


   _elapsed = format ["%1:%2%3:%4%5", _hours, _tensOfMinutes, _minutes,_tensOfSeconds, _wholeSeconds];


   ctrlSetText [1072, _elapsed];



   sleep 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
Sign in to follow this  

×