Jump to content
Sign in to follow this  
Rough Knight

Defining additional RscTitles in .hpp files outside of decription.ext?

Recommended Posts

Hi Guys,

I have two diaglogue\displays each which has its own definitions. I have been getting CTD's due to the "/RscTitles.RscTitles: Member already defined." error. I have seen a few different referenced to this error on the forums but still don't understand how I can have RscTitles defined in different .hpp files for different displays [i wanted it this way to keep them as almost seperate addons within the mission for easy transfer to tother missions later].

Here is what I have, I hope someone can help me,. it would be much appreciated [even just to confirm this can or can't be done]

Some options:

* Can I define additional RscTitles as something like "RscTitlesSw" for example?

Description.ext:

#define CT_STATIC 	0
#define ST_PICTURE 	48

#define ST_LEFT 	0
#define ST_FRAME 	64

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 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;
};

[color="#0000FF"]class RscTitles
{
#include "RN_stopwatch\stopwatch.hpp"
#include "RN_waterguage\waterguage.hpp"
};[/color]

stopwatch.hpp:

#define TIME_H 		10101
#define TIME_M 		10102
#define TIME_S 		10103
#define TIME_T	 	10104

class RscTitles
{
 //titles[] = {sw}; // optional

 class sw
 {	
   idd = -1;	
   movingEnable = false;
   duration = 500000;
   fadein = 0;
   name = "sw"; 
onLoad = "stopwatch_display = _this";
   controls[] = {"sw1","RN_TIMER1","RN_TIMER2","RN_TIMER3","RN_TIMER4"};

   class sw1: RscPicture
   {	
    x = 1.1;	//add these offsets to control properties
    y = 1.3;	//add these offsets to control properties
    w = 0.22;
    h = 0.215;
     text = "RN_stopwatch\stopwatch.paa";
   };

class RN_TIMER1 : RscText
 {
 	idc = TIME_H;
 	x = 1.14;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";
 };

   class RN_TIMER2 : RscText
 {
 	idc = TIME_M;
 	x = 1.1716;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";
 };

   class RN_TIMER3 : RscText
 {
 	idc = TIME_S;
 	x = 1.2015;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";
 };

   class RN_TIMER4 : RscText
 {
 	idc = TIME_T;
 	x = 1.235;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";

 };
};
};

waterguage.hpp:

#define PERCENT_D 		10201
#define LINE_D	 		10202

class RscTitles
{
 titles[] = {wg}; // optional

 class wg
 {	
   idd = -1;	
   movingEnable = false;
   duration = 500000;
   fadein = 0;
   name = "wg"; 
onLoad = "waterguage_display = _this";
   controls[] = {"wg1","RN_GUAGE1","RN_GUAGE2"};

   class wg1: RscPicture
   {	
    x = 1.1;	//add these offsets to control properties
    y = 1.3;	//add these offsets to control properties
    w = 0.22;
    h = 0.215;
     text = "RN_waterguage\waterguage.paa";
   };

class RN_GUAGE1 : RscText
 {
 	idc = PERCENT_D;
 	x = 1.14;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";
 };

   class RN_GUAGE2 : RscText
 {
 	idc = LINE_D;
 	x = 1.1716;
 	y = 1.38;
 	w = 0.2;
 	h = 0.04;
   font = "Bitstream";
   sizeEx = 0.04;
text = "";
 };
 };
};

Hopefully someone can help me out, thanks in advance as usual :)

Share this post


Link to post
Share on other sites

Just went over this very quickly, but you effectively seem to be declaring RscTitles inside itself.

Have you tried removing

[color="#FF0000"]class RscTitles 
{[/color]
...
[color="#FF0000"]};[/color]

from your two files?

Edited by BlackMamb

Share this post


Link to post
Share on other sites

You can only have 1 RscTitles declaration (at root level) in the mission and each addon in use, each of which can then contain various display class (i.e. 'wg' and 'sw') definitions.

So:

- keep your original description.ext

- remove the "class RscTitles {" and trailing "};" from both hpp files.

- remove the "titles[] = {...}" lines from both hpp files too.

==========

Once you get that working, get used to wrapping your control classes inside the main controls classes. Newer method.

Replace:

controlsBackground[] = {<control_titles>};
controls[] = {<control_titles>};
objects[] = {<control_titles>};

<actual full control classes>

With:

<reference classes> (eg: RscText, etc)

class objects
{
   <actual full control classes>
};
class controlsBackground
{
   <actual full control classes>
};
class controls
{
   <actual full control classes>
};

Saves time. See example 2 in the topic under section Dialogs: http://community.bistudio.com/wiki/Dialogs#Dialogs

Share this post


Link to post
Share on other sites

THanks guys, you where spot on.

I did'nt quite follow that second example Doc but I will definitely look into it now in more depth.

Now I get both displays showing up when they are supposed to and no more CTD's. Man that is annoying trying to fault find your displays, I wish BIS would fix that, why not just throw an error rather than bomb you out to desktoip requiring a new game start : P

Thanks heaps for your time guys, it certainly saved my pulling my hair out.

Share this post


Link to post
Share on other sites

Hi guys,

I have another question which I can't find a solution to. Is it possible to query if a display is active? For example I have these two different displays that operate on the same layer called by the following code.

5 cutRsc ["sw","PLAIN"];

or

5 cutRsc ["wg","PLAIN"];

both displays are closed by the command:

5 cutRsc ["DEFAULT","PLAIN"];

The problem lies in the fact that both displays could possibly be opened simultaneously. Idealy I would like to be able to check under certain circumstances if the display should be on but has been closed by another script, then open it back up if required?

Is anyone aware of if this is possible?

Thanks again

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  

×