Jump to content
Steezy

Dialog encountered error with constants

Recommended Posts

Hi folks !

 

Today I encountered some errors with my dialogs.

 

I tried to split my stuff into different files to reorganize it.

 

In this way, I created hpp-files to define engine-related / custom constants (as it's suggested here). So I created 1 file by constant type : controls.hpp (for control types and styles), fonts.hpp (for... fonts) and colors.hpp (for...tadam... colors). I also declare my basic ressource classes (RscText, RscStructuredText, etc...) in dialogs.hpp. All these files are included in my description.ext .

 

This error appears when dialogs - including the color constants - are initialized (dialogs.hpp or CharactersList.h) :

15:33:34 Warning Message: File C:\Users\Steezy\Documents\Arma 3\missions\Test.Stratis\CharactersList.h, line 36: '/RscCharactersList/controlsBackground/MainTitle.': ';' encountered instead of '='

My game crashes if I try to preview the mission through the game editor or on dedicated server with the same error message.

 

 

These are parts of my scripts :

 

description.ext

...
// GUI constants and base classes
#include "controls.hpp"
#include "colors.hpp"
#include "fonts.hpp"
#include "dialogs.hpp"

// My dialogs
#include "CharactersList.h"

class RscTitles
{
    #include "playerHUD.h"
};

...

controls.hpp

// ## Control types ## \\
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_SLIDER 3
#define CT_COMBO 4
#define CT_LISTBOX 5
...

// ## Control styles ## \\
// Static styles
#define ST_POS 0x0F
#define ST_HPOS 0x03
#define ST_VPOS 0x0C
#define ST_LEFT 0x00
#define ST_RIGHT 0x01
#define ST_CENTER 0x02
#define ST_DOWN 0x04
...

colors.hpp (buggy script ?)

#define COLOR_SLD_PURERED {1,0,0,1};
#define COLOR_SLD_PUREGREEN {0,1,0,1};
#define COLOR_SLD_PUREBLUE {0,0,1,1};
#define COLOR_SLD_PUREWHITE {1,1,1,1};
#define COLOR_SLD_PUREBLACK {0,0,0,1};

#define COLOR_SLD_DARKRED {0.6,0.2,0.2,1};


#define COLOR_TRANSPARENT {0,0,0,0};
...
 

fonts.hpp

#define GUI_FONT_DEFAULT PuristaMedium
#define GUI_FONT_NORMAL PuristaMedium
#define GUI_FONT_BOLD PuristaSemibold
#define GUI_FONT_THIN PuristaLight
...

dialogs.hpp

class RscText
{
    idc = -1;
    type = CT_STATIC;
    style = ST_LEFT;
    x = 0;
    y = 0;
    h = 0.037;
    w = 0.3;
    sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
    font = GUI_FONT_NORMAL;
    colorText[] = COLOR_SLD_PUREWHITE;
    colorBackground[] = COLOR_TRANSPARENT;
    text = "";
    shadow = 0;
    tooltip = "";
    tooltipColorShade[] = {0,0,0,0.65};
    tooltipColorText[] = {1,1,1,1};
    tooltipColorBox[] = {1,1,1,1};

    deletable = 0;
    fade = 0;
    access = 0;
    fixedWidth = 0;
    colorShadow[] = {0,0,0,0.5};
    linespacing = 1;
};
...

CharactersList.h

class RscCharactersList
{
    idd=20003;
onLoad="uiNamespace setVariable ['RscCharactersList', _this select 0]";
onUnload="uiNamespace setVariable ['RscCharactersList', displayNull]";
movingEnable="false";
    enableSimulation="false";
    class controlsBackground
    {
        class Image: RscPicture
        {
            idc = 1200;
            text = "";
            x = 0.448438 * safezoneW + safezoneX;
            y = 0.148 * safezoneH + safezoneY;
            w = 0.0825 * safezoneW;
            h = 0.077 * safezoneH;
        };
        class BlackBackground: RscText
        {
            idc = 1000;
            x = 0.293751 * safezoneW + safezoneX;
            y = 0.225 * safezoneH + safezoneY;
            w = 0.4125 * safezoneW;
            h = 0.55 * safezoneH;
            colorBackground[] = {0,0,0,1};
        };
        class MainTitle: RscText
        {
            idc = 1001;
            text = "Choose your character"; //--- ToDo: Localize;
            x = 0.29375 * safezoneW + safezoneX;
            y = 0.225 * safezoneH + safezoneY;
            w = 0.4125 * safezoneW;
            h = 0.044 * safezoneH;
            colorBackground[] = COLOR_SLD_DARKRED;
            sizeEx = 0.8 * GUI_GRID_H;
        };
    };
    class controls
    {
        class RscCombo_2100: RscCombo
        {
            idc = 2100;
            text = ""; //--- ToDo: Localize;
            x = 0.304062 * safezoneW + safezoneX;
            y = 0.291 * safezoneH + safezoneY;
            w = 0.216563 * safezoneW;
            h = 0.022 * safezoneH;
            colorText[] = {0,0,0,1};
            colorBackground[] = {0.9,0.9,0.9,1};
        };
        class RscText_1003: RscText
        {
            idc = 1003;
            text = "Side :"; //--- ToDo: Localize;
            x = 0.402031 * safezoneW + safezoneX;
            y = 0.324 * safezoneH + safezoneY;
            w = 0.04125 * safezoneW;
            h = 0.055 * safezoneH;
        };
    };
};

I deliberately omit to change all the color propertie values of this script by constants to point on only one error.

 

What have I done wrong ?

 

Thx in advance :)

Share this post


Link to post
Share on other sites

Hey killzone_kid !

 

As you may know, there are 3 positioning modes in GUI editor : absolute, safezone and GUI_GRID.

You did some tutorials about it  :P

 

Even if I use the safezone mode, font size is always product of grid height (GUI_GRID_H).

So I consider this constant is defined somewhere in Arma cfg's and dialogs inherit.

 

But I think it's not the problem.

The error appears only when I use constants for the color properties (like colorBackground[], colorText[], etc...). All other constants are ok : font, type/style and GUI_GRID constants work correctly (tested without the color ones).

Share this post


Link to post
Share on other sites

 

Even if I use the safezone mode, font size is always product of grid height (GUI_GRID_H).

So I consider this constant is defined somewhere in Arma cfg's and dialogs inherit.

 

GUI_GRID_H is not a global var, and unless you have 

#define GUI_GRID_H <somevalue> 

somewhere in files you include or explicitly defined in your config that is also included, it is undefined. This is why I asked you where. It is not in any of your attached files. Also the error is pointing to this block

 

 

 

class MainTitle: RscText

        {

            idc = 1001;

            text = "Choose your character"; //--- ToDo: Localize;

            x = 0.29375 * safezoneW + safezoneX;

            y = 0.225 * safezoneH + safezoneY;

            w = 0.4125 * safezoneW;

            h = 0.044 * safezoneH;

            colorBackground[] = COLOR_SLD_DARKRED;

            sizeEx = 0.8 * GUI_GRID_H;

        };

Share this post


Link to post
Share on other sites

Indeed GUI_GRID 'constant' doesn't seem to be defined anywhere. However, that's not a blocking problem.

If GUI_GRID_H is not defined and used with sizeEx propertie : the font won't be displayed on the dialog.
 
My problem is the error message that is generated and that points to my color variables.
 
I'll come back to you with custom mission scripts to prove you that the real problem is my color variables.
But you can easily reproduce the error by defining global color variables and trying to insert them to color properties of a dialog.

Share this post


Link to post
Share on other sites

If GUI_GRID_H is not defined then 

 

sizeEx = 0.8 * GUI_GRID_H;

 

for the engine would look like this:

 

sizeEx = 0.8 * ;

 

Have you tried to define it just before or remove it from sizeEx together with multiplication sign?

Share this post


Link to post
Share on other sites

Remove the ; from your colour defines.

Plus as KK says you will need your grid defines somewhere.

Share this post


Link to post
Share on other sites

Hey there !

 

@larrow: Thank you man! You saved my life! That was the problem... I don't know how I couldn't see it earlier.

 

@KK: Thanks for the help, advise and tutorial  ;)

 

I'm not totally used with defines and dialogs are still a hard part for me. I'm trying to improve!

Share this post


Link to post
Share on other sites

I'm not totally used with defines and dialogs are still a hard part for me. I'm trying to improve!

Dialogs and defines are completely separate things, it looks like you're just having an issue with the preprocessor and specifically the #define command. When you define something, the preprocessor goes through the script and replaces the keyword with your definition no matter what it is. So this:

#define COLOR_SLD_DARKRED {0.6,0.2,0.2,1};
class MainTitle: RscText
{
   idc = 1001;
   text = "Choose your character"; //--- ToDo: Localize;
   x = 0.29375 * safezoneW + safezoneX;
   y = 0.225 * safezoneH + safezoneY;
   w = 0.4125 * safezoneW;
   h = 0.044 * safezoneH;
   colorBackground[] = COLOR_SLD_DARKRED;
   sizeEx = 0.8 * GUI_GRID_H;
};

ends up looking like this:

class MainTitle: RscText
{
   idc = 1001;
   text = "Choose your character"; //--- ToDo: Localize;
   x = 0.29375 * safezoneW + safezoneX;
   y = 0.225 * safezoneH + safezoneY;
   w = 0.4125 * safezoneW;
   h = 0.044 * safezoneH;
   colorBackground[] = {0.6,0.2,0.2,1};;
   sizeEx = 0.8 * GUI_GRID_H;
};

Notice you have 2 semicolons on one line, but I guess after a semicolon the game is expecting either another member definition or the end of the class, thus it is checking for an =. The game cannot compile these files because of unexpected input and to prevent any possible damage to your computer it shuts down, removing any way of running the files.

Share this post


Link to post
Share on other sites

Many thanks for clarification guys !

 

Now I understood my mistakes in detail  :)

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

×