OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: klavan on 02 Nov 2005, 20:57:26
-
class RscTextD
{
type = CT_STATIC;
idc = -1;
style = ST_LEFT;
colorBackground[] = {0, 0, 0, 0};
colorText[] = {1, 1, 1, 1};
font = FontS;
sizeEx = 0.04;
};
class RscButtonD
{
type = CT_BUTTON;
idc = -1;
style = ST_CENTER;
colorText[] = {0, 0, 1, 1};
font = FontHTML;
sizeEx = 0.025;
soundPush[] = {, 0.2, 1};
soundClick[] = {"ui\ui_ok", 0.2, 1};
soundEscape[] = {"ui\ui_cc", 0.2, 1};
default = false;
};
class Info1
{
idd = -1;
movingEnable = true;
controlsBackground[] = {BACKGROUND,FRAME};
objects[] = { };
controls[] = {EXIT,TEXT};
class BACKGROUND : RscTextD
{
colorBackground[] = {0, 0, 0, 1};
text = ;
x = 0.1;
y = 0.1;
w = 0.8;
h = 0.8;
};
class FRAME : RscTextD
{
idc = 100;
style = ST_FRAME;
colorText[] = {1, 1, 1, 1};
text = "Info Sheet 1";
sizeEx = 0.02;
x = 0.108;
y = 0.105;
w = 0.78;
h = 0.78;
};
class EXIT : RscButtonD
{
idc = 101;
x = 0.43;
y = 0.84;
w = 0.17;
h = 0.037;
text = "Exit";
action = "closedialog 0";
};
class TEXT : RscTextD
{
style="0.5";
lineSpacing=0.5;
text=$STRN_In1;
x=0.14;
y=0.05;
w=0.7;
h=0.7;
colorText[]={1,1,1,1};
font="tahomaB36";
size=0.8;
};
This dialog works, but my problem is that I can't display the text ($STRN_In1 defined in the .csv) the way I want, because:
-1 My attempts in moving upside the box that contains the text always fails (if i'm not wrong it should be defined by the y value in the class TEXT resource).
-2 When displayed, even by using the "\n" command to start a new line, the text is not interrupted.
Example
"TESTLINE\nTESTLINE"
instead of
"TESTLINE
TESTLINE"
I've checked some dialogs made by others missionmakers but I can't find a solution and that's why I ask for your help.
Thanks in advance
Klavan
-
The x and y values define the top left corner of the box.
The w and h values define the width and height of the box.
Planck
-
@Planck
I was already quite sure of that, but even decreasing the y value the text appears always in the same position, about in the middle of the screen.
Klavan
-
Have you tried:
x=0
y=0
I think this should start the text box at the top left of the screen.........maybe ::)
Planck
-
That damned dialog is kidding me!
By decreasing both x and y to 0.0 the text is moved on the left of the screen but remains in the middle!
Uffffhhh.....
Klavan
-
OK.........what you need to do I think is reduce h.
h=0.04
try that. ;D
These values are percentage of screen.
1 would be full height for h
Edit: I just noticed your:
style= "0.5"
I have never seen this style.
Try: style= 2;
Planck
-
Here is a list of style types I have:
#define ST_HPOS 0x0F
#define ST_LEFT 0
#define ST_RIGHT 1
#define ST_CENTER 2
#define ST_UP 3
#define ST_DOWN 4
#define ST_VCENTER 5
#define ST_TYPE 0xF0
#define ST_SINGLE 0
#define ST_MULTI 16
#define ST_TITLE_BAR 32
#define ST_PICTURE 48
#define ST_FRAME 64
#define ST_BACKGROUND 80
#define ST_GROUP_BOX 96
#define ST_GROUP_BOX2 112
#define ST_HUD_BACKGROUND 128
#define ST_TILE_PICTURE 144
#define ST_WITH_RECT 160
#define ST_LINE 176
#define ST_SHADOW 256
#define ST_NO_RECT 512
#define ST_TITLE ST_TITLE_BAR + ST_CENTER
Planck
-
Ok thank you Planck, now the text is moved where I need.
Now I've to solve the second problem. I've attached an image to better explaining what I mean with the "\n" problem.
klavan
PS
I'm takin' in consideration the opportunity to replace the dialog with an hintc if I will not able to solve this problem quickly......
-
I'm not even sure you can do this, I've never tried.
Is it '\n' or is it '/n'.......I can never remember.
Planck
-
By taking a look at some other dialogs I've found that \n (this is the right sintax) works........Maybe it's only a matter of style.
I will try something else.....
Klavan
-
Yes.....Experiment with the styles.
ST_MULTI 16
Maybe.........I'm not sure.
Planck
-
You can't use the "\n" command in dialogs, even if you call a script and change the text of a given idc using ctrlSetText.
(example) :
call format ["ctrlsettext [120,""%1's Stick Status : (%2 active)""]",name player,count units group player]
The following code does NOT work :
call format ["ctrlsettext [120,""%1's Stick Status : \n(%2 active)""]",name player,count units group player]
So what you have to do is define another class, with another idc (better), laid out lower in the screen :).
-
@Igor
Do you mean that if i want to put in the dialog a text that looks somewhat like the following:
Today is a bad day
I hope that tomorrow will be better
But can't believe it will be so
I need to create three different text boxes to display it?
In this case I will switch to the hintc immediately.......
Klavan
-
Yes, you'd need to create three different RSCs.
But then, don't switch off to hintC yet !! Dialogs are so powerful, and I so much wish they were more used by the community... :-[
-
@Igor
Well, after all I'm forced to continue with the dialog: the hintc simply can't contains enough text for my pourpouse........
Tomorrow will be a long editing day.
Thank you for your help.
Goodnight.
Klavan
-
You can put the text in a listbox.
--Ben
-
Do you mean that if i want to put in the dialog a text that looks somewhat like the following:
Today is a bad day
I hope that tomorrow will be better
But can't believe it will be so
I need to create three different text boxes to display it?
In this case I will switch to the hintc immediately.......
Klavan
Yup, I have never been able to get \n to work in a dialog either. Such a pity, since they are the best way of displaying lots of text. But anyway, in the past I've got around the problem by just using a bunch of spaces, to force the text down onto the next line. Takes some trial and error, but it works if you aren't changing what you are displaying.
Dialogs rock! I'm with Igor--I wish they were more widely used!
-
It's quite a long job, but the result isn't so bad as you can see from the picture attached below.
Klavan
-
BTW, if you are going to be displaying lots of text (which it looks like you are), then you might find it easiest to put that text in an external .txt file, and then use the 'loadfile' command to put its contents into the dialog. Again, just speaking from experience.
-
Maybe, but since I'm making an english and italian version of the displayed text how can I avoid to use a .csv?
Klavan
-
Yes, Dialogs and titleRscs are quite amazing. I've used several in my most recent missions. Also, why didn't anyone use them with v1.46 and lower, since they were still compatible? ???