Jump to content
Sign in to follow this  
thecoolsideofthepillow

Where do I Paste GUI Editor Information?

Recommended Posts

I've constructed a dialogue window with the built in GUI editor. I've looked through the wiki and understand it enough to make the dialogue box manually, except...

Where do I put the information? For example if I "export as script," it doesn't create anything, it just gives me this block of code in my clipboard to paste somewhere:

////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by PillowTalk, v1.063, #Zokosy)
////////////////////////////////////////////////////////

class RscPicture_1200: RscPicture
{
idc = 1200;
text = "#(argb,8,8,3)color(1,1,1,1)";
x = 29 * GUI_GRID_W + GUI_GRID_X;
y = 1 * GUI_GRID_H + GUI_GRID_Y;
w = 10 * GUI_GRID_W;
h = 12.5 * GUI_GRID_H;
};
class But_VeryEasy: RscButton
{
idc = 1600;
text = "Grizzled Veteran"; //--- ToDo: Localize;
x = 2 * GUI_GRID_W + GUI_GRID_X;
y = 1 * GUI_GRID_H + GUI_GRID_Y;
w = 7.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Very Easy"; //--- ToDo: Localize;
};
class But_Easy: RscButton
{
idc = 1601;
text = "Ex-SWAT"; //--- ToDo: Localize;
x = 2 * GUI_GRID_W + GUI_GRID_X;
y = 3.5 * GUI_GRID_H + GUI_GRID_Y;
w = 7.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Easy"; //--- ToDo: Localize;
};
class But_Normal: RscButton
{
idc = 1602;
text = "Lone Wolf"; //--- ToDo: Localize;
x = 2 * GUI_GRID_W + GUI_GRID_X;
y = 6 * GUI_GRID_H + GUI_GRID_Y;
w = 7.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Normal"; //--- ToDo: Localize;
};
class But_Hard: RscButton
{
idc = 1603;
text = "Escaped Convict"; //--- ToDo: Localize;
x = 2 * GUI_GRID_W + GUI_GRID_X;
y = 8.5 * GUI_GRID_H + GUI_GRID_Y;
w = 7.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Hard"; //--- ToDo: Localize;
};
class But_Insane: RscButton
{
idc = 1604;
text = "Dead Meat"; //--- ToDo: Localize;
x = 2 * GUI_GRID_W + GUI_GRID_X;
y = 11 * GUI_GRID_H + GUI_GRID_Y;
w = 7.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Naked (And Insane)"; //--- ToDo: Localize;
};
class Frame_ClassSelect: RscFrame
{
idc = 1800;
text = "Choose your Class/Difficulty"; //--- ToDo: Localize;
x = 1 * GUI_GRID_W + GUI_GRID_X;
y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
w = 39 * GUI_GRID_W;
h = 24 * GUI_GRID_H;
};
class Text_ClassSelect: RscText
{
idc = 1000;
text = "Insert Class Information Here with Script"; //--- ToDo: Localize;
x = 10.5 * GUI_GRID_W + GUI_GRID_X;
y = 1 * GUI_GRID_H + GUI_GRID_Y;
w = 18 * GUI_GRID_W;
h = 12 * GUI_GRID_H;
};
class But_Start: RscButton
{
idc = 1605;
text = "START"; //--- ToDo: Localize;
x = 15 * GUI_GRID_W + GUI_GRID_X;
y = 17 * GUI_GRID_H + GUI_GRID_Y;
w = 8.5 * GUI_GRID_W;
h = 5 * GUI_GRID_H;
tooltip = "Start the Game"; //--- ToDo: Localize;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////

I've tried simply saving the above as an SQF and used various methods of executing the script; but I get no dialogue box in-game when running it that way.

The wiki explains what the export buttons do; it just does not explain where the code should be pasted.

Share this post


Link to post
Share on other sites

Yea I agree with iceman, I read his tut and It helped me a lot <3 Iceman

Share this post


Link to post
Share on other sites

Try out this Tutorial:

http://forums.bistudio.com/showthread.php?144954-Dialog-Tutorial-For-Noobs-By-A-Noob

Should explain most everything you need to get going. It says for Arma 2, but everything is relevant to A3

You'll end up pasting that info into a file like, 'Dialogs.hpp', and including it in your description.ext. That info alone wont get your dialog going, you'll need the defines too (but the tutorial explains that too)

--

haha, im late on the reply button again! Nice tutorial choice iceman :D

Share this post


Link to post
Share on other sites

Thanks. I wrote the guide while I was actually learning my way through the quagmire that is dialogs. I assumed the reader knew nothing (outside of navigating directories etc)... just like me! I may redo / update the guide explicitly for Arma3, also to maybe include some more streamlined methods, cutRsc (for HUD elements), and a more 'complex' dialog at the end.

Share this post


Link to post
Share on other sites

You are most likley using GUI_GRID you need to go back through and make it Safezone

Share this post


Link to post
Share on other sites

Or Export Grid Proportions ( Ctrl - Shift - P )

that will put the GUIGRID defines in your clipboard, and you would just add them to the top of your other definitions. no more errors on that front

Share this post


Link to post
Share on other sites

Do you guys know if I can define global variables to use in the dialog controls?

I am trying to have pressing the buttons change some text and set a variable, but I get a variable not defined error in the script debugger. If I put a simple variable declaration in the dialogs.hpp, it will crash. If I put it in defines.hpp or description.ext, it still gives me the undefined variable error.

Share this post


Link to post
Share on other sites

Define an action for your button. Towards the end of the tutorial, it shows how to utilize action.

action = "_nul = [1000, name player] execVM 'myScript.sqf';";

myScript.sqf

myVariable = 9000;

// Do other stuff ...

_ctrl = _this select 0;
_text = _this select 1;
((uiNamespace getVariable "myDialog") displayCtrl _ctrl) ctrlSetText format ["%1", _text];

//Do more things . . .

Edited by Iceman77

Share this post


Link to post
Share on other sites

I understand the action line; but when I declare the variable somewhere above it before it's used, it crashes when I load the mission in the editor.

Unless you mean to say I must execute an additional script to carry my values; in which case I must ask if I am able to use the same script for each button that merely changes the value of the variable I want to change? I would hate to have to run 5 different scripts just to change a single variable.

For example:

Clicking button 1 would do

action = "ctrlsettext [426, ""Random errata here""] && _Handle execVM 'class_select.sqf' && Sel_Class = 1;"

Button 2 would do

action = "ctrlsettext [426, ""More Random errata here""] && _Handle execVM 'class_select.sqf' && Sel_Class = 2;"

and then my script (class_select.sqf) could just be

Sel_Class = 0;

With everything that needs "Sel_Class" there after?

Edited by TheCoolSideofthePillow

Share this post


Link to post
Share on other sites

Idk exactly what you're up to. In any case, don't define any variables in your dialog.hpp / .ext (if that's what you're doing). Define the variable(s) in .sqf files to avoid the CTD. Run an script upon button action that defines your variable(s). No need to run 5 different scripts. But, the variables need to be defined somewhere regardless. In one file is okay...

Share this post


Link to post
Share on other sites
Idk exactly what you're up to.

If it will help, my goal for this dialog is thus:

Mission starts, screen fades black, dialog opens.

The dialog has 6 buttons: 5 are for each class the player can choose, and 1 to accept their choice.

When the player presses 1 of the selection buttons, a text resource will display information about that class, and set a variable that, when the ready button is pressed, will respawn the player as the class they selected, and change the AI difficulty. I've figured out how to turn the buttons into radial type inputs with the ctrlEnable command and can change the text to display correctly, as well as get the dialog to close and repsawn my guy; but when I started putting the variables to use is when I hit the wall I am up against at the moment.

Since the dialog is opening in my init.sqf, and the script doesn't end until the dialog is closed, I think I could slap the variables I need in there, as well as the other functions for the dialog. Correct me if I am wrong.

Share this post


Link to post
Share on other sites
With everything that needs "Sel_Class" there after?

Yeah you can define the Sel_Class whenever you like to change it.

Share this post


Link to post
Share on other sites
action = "_nul = [1000, name player] execVM 'myScript.sqf';";

BTW, when I try a similar declaration of an array followed by executing a script like that

action = "_ClassSelArray [false, true, false, false, false] execVM '/cfg/ClassDifficulty.sqf'";

I get the same damn error about _ClassSelArray not being declared.

EDIT: And as soon as I paste the code I see the problem. Forgot an "=." FML.

Share this post


Link to post
Share on other sites

At last! The fruits of my effort are complete.

In finishing this menu, everything else I need to do seems just tedious by comparison. XD

And, to show that I am not as daft as you probably think I am, here is the finished product:

Dialogs.hpp

//Difficulty selection Dialogue start
class Diag_Selection
{
idd = -1;
movingenable = false;

class Controls
{
class PILLBOX: BOX
{
idc = -1;
colorBackground[] = {0.23137254901960784313725490196078, 0.23137254901960784313725490196078, 0.23137254901960784313725490196078, 1};
text = ""; //--- ToDo: Localize;
x = 0.28 * safezoneW + safezoneX;
y = 0.247099 * safezoneH + safezoneY;
w = 0.4355 * safezoneW;
h = 0.5 * safezoneH;
};
class frm_selection: RscFrame
{
idc = -1;
text = "Choose Your Fate"; //--- ToDo: Localize;
x = 0.288021 * safezoneW + safezoneX;
y = 0.247099 * safezoneH + safezoneY;
w = 0.423958 * safezoneW;
h = 0.494807 * safezoneH;
};
class img_selectionprev: RscPicture
{
idc = 420;
text = "Ganjacat128.paa";
x = 0.563021 * safezoneW + safezoneX;
y = 0.26909 * safezoneH + safezoneY;
w = 0.1375 * safezoneW;
h = 0.318876 * safezoneH;
};
class btn_veasy: RscButton
{
idc = 421;
colorBackground[] = { 0, 1, 0, 1 };
colorText[] = { 1, 1 ,1 , 1 };
text = "Grizzled Veteran"; //--- ToDo: Localize;
x = 0.29375 * safezoneW + safezoneX;
y = 0.26909 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Very Easy"; //--- ToDo: Localize;
action = "_nul = [true, false, false, false, false, false] execVM 'ClassDifficulty.sqf'";
};
class btn_easy: RscButton
{
idc = 422;
colorBackground[] = { 0, 0.50196078431372549019607843137255, 0, 1 };
colorText[] = { 1, 1 ,1 , 1 };
text = "Ex-SWAT"; //--- ToDo: Localize;
x = 0.29375 * safezoneW + safezoneX;
y = 0.335064 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Easy"; //--- ToDo: Localize;
action = "_nul = [false, true, false, false, false, false] execVM 'ClassDifficulty.sqf'";
};
class btn_norm: RscButton
{
idc = 423;
colorBackground[] = { 1, 1, 0, 1 };
colorText[] = { 0, 0 ,0 , 1 };
text = "Lone Wolf"; //--- ToDo: Localize;
x = 0.29375 * safezoneW + safezoneX;
y = 0.401039 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Normal"; //--- ToDo: Localize;
action = "_nul = [false, false, true, false, false, false] execVM 'ClassDifficulty.sqf'";
};
class btn_hard: RscButton
{
idc = 424;
colorBackground[] = { 1, 0.50196078431372549019607843137255, 0, 1 };
colorText[] = { 0, 0 ,0 , 1 };
text = "Escaped Convict"; //--- ToDo: Localize;
x = 0.29375 * safezoneW + safezoneX;
y = 0.467013 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Hard"; //--- ToDo: Localize;
action = "_nul = [false, false, false, true, false, false] execVM 'ClassDifficulty.sqf'";
};
class btn_vhard: RscButton
{
idc = 425;
colorBackground[] = { 1, 0, 0, 1 };
colorText[] = { 0, 0 ,1 , 1 };
text = "Deat Meat"; //--- ToDo: Localize;
x = 0.29375 * safezoneW + safezoneX;
y = 0.532987 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Naked and Insane"; //--- ToDo: Localize;
action = "_nul = [false, false, false, false, true, false] execVM 'ClassDifficulty.sqf'";
};
class txt_selectioninfo: RscText
{
idc = 426;
type = CT_STATIC;
font = "LucidaConsoleB";
style = ST_MULTI;
sizeEx = 0.03;
lineSpacing = 1;
colorText[] = { 1, 1 ,1 , 1 };
text = ""; //--- ToDo: Localize;
x = 0.408333 * safezoneW + safezoneX;
y = 0.26909 * safezoneH + safezoneY;
w = 0.143229 * safezoneW;
h = 0.318876 * safezoneH;
};
class btn_start: RscButton
{
idc = 427;
text = "Enter the Wastes"; //--- ToDo: Localize;
x = 0.442708 * safezoneW + safezoneX;
y = 0.65394 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.0549786 * safezoneH;
tooltip = "Begin Playing"; //--- ToDo: Localize;
};
};
};

init.sqf:

///////////////////////////////////////////////////////////////
//Script to Define the Player's Class and Difficulty Selection
///////////////////////////////////////////////////////////////

//Debugging
_Debug = true;

//Fade to black and open dialog
cutText ["","BLACK"];
sleep 1;
_Diag = createDialog "Diag_Selection";
sleep 1;
ctrlEnable [427, false];
ctrlShow [427, false];

ClassDifficulty.sqf:

_veasy = (_this select 0);
_easy = (_this select 1);
_norm = (_this select 2);
_hard = (_this select 3);
_vhard = (_this select 4);
_Started = (_this select 5);

//Not so Covert Operations
if (_veasy or _easy or _norm or _hard or _vhard) then
{
ctrlEnable [427, true];
ctrlShow [427, true];
buttonSetAction [427, "closeDialog 0;_Executor = execVM ""respawn.sqf"""];
}
else
{
ctrlEnable [427, false];
ctrlShow [427, false];
};
if (_veasy and !_easy and !_norm and !_hard and !_vhard) then
{
Class_Current = 1;
ctrlEnable [421, false];
ctrlEnable [422, true];
ctrlEnable [423, true];
ctrlEnable [424, true];
ctrlEnable [425, true];
ctrlSetText [426, "You were serving in the military when the plague devastated the planet. Using your superior training, weapons, and resources you survive. But will you rebuild? STARTING EQUIPMENT: Rifle, Sidearm, 3x Mags for each, 5 food, 5 water, 5 Toilet Paper, 5 Medkits, 2 Repair Tools, camouflage fatigues, vest, backpack, NVGs, and 1500 RC. Very Easy Difficulty."];
};
if (!_veasy and _easy and !_norm and !_hard and !_vhard) then
{
Class_Current = 2;
ctrlEnable [421, true];
ctrlEnable [422, false];
ctrlEnable [423, true];
ctrlEnable [424, true];
ctrlEnable [425, true];
ctrlSetText [426, "Before the collapse of society, you were a SWAT officer. Now, using your police training, and appropriated gear, you set off to survive. STARTING EQUIPMENT: SMG, Sidearm, 3x mags for each, 3 food, 3 water, 3 toilet paper, police uniform, utility belt, backpack. 500 RC. Easy Difficulty"];
};
if (!_veasy and !_easy and _norm and !_hard and !_vhard) then
{
Class_Current = 3;
ctrlEnable [421, true];
ctrlEnable [422, true];
ctrlEnable [423, false];
ctrlEnable [424, true];
ctrlEnable [425, true];

ctrlSetText [426, "Where once you were but an average person surviving society, now you are an above average person surviving a plague infested wasteland. You must use your wits and resources to continue your struggle for survival, or rebuild civilization in your own image. STARTING EQUIPMENT: Sidearm, 2x mags of ammo, 2 food, 2 water, 2 toilet paper, civ clothes, backpack. 500 RC. Normal Difficulty"];
};
if (!_veasy and !_easy and !_norm and _hard and !_vhard) then
{
Class_Current = 4;
ctrlEnable [421, true];
ctrlEnable [422, true];
ctrlEnable [423, true];
ctrlEnable [424, false];
ctrlEnable [425, true];
ctrlSetText [426, "The plague struck while you were awaiting execution on death row at a maximum security prison. You managed to escape in the riots when the disease swept into the prison. You escaped with your life, and little else. Now you must pick through scraps and rubble to survive. STARTING EQUIPMENT: Sidearm, 1 magazine, 1 food, 1 water, prisoner jumpsuit. 0 RC. Hard Difficulty."];
};
if (!_veasy and !_easy and !_norm and !_hard and _vhard) then
{
Class_Current = 5;
ctrlEnable [421, true];
ctrlEnable [422, true];
ctrlEnable [423, true];
ctrlEnable [424, true];
ctrlEnable [425, false];
ctrlSetText [426, "As an escaped patient from an insane asylum, no one really knows how you've managed to survive. Not even yourself. STARTING EQUIPMENT: Jack Shit. 0 RC. Insane Difficulty."];
};

It was... A lot more difficult than I had anticipated. But then, this 'language' is weird as all hell compared to what I am used to using.

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  

×