Jump to content

Recommended Posts

Hello I have run in to a issue that I have not yet been able to figure out. I am a beginner to scripting in SQF and ArmA in general. A little info about what I am in the process of making, Simply it is a GUI attached to a object you can approach and use via addAction. The purpose of the menus is to choose a level, difficulty and missionType, mission. missionType and mission both have a listBox, return button, select button, close button. Now this is where the issue lies, when returning to the missionType menu the listBox options disappear. I tried but am limited to few options because I don't know much about scripting for arma and every tutorial I have watched and or read have been helpful but, has not helped me fix my issue. I love this game so dam much and I have a lot of respect for others who put their time in to making something amazing. Did I forget to add something ? Is there a refresh command or something similar ?

 

Mission Type Menu.hpp

Spoiler

class goisseMissionTypeMenu {
idd = 6104
movingEnabled = false;
onLoad = "[] spawn {execVM 'functions\fnc\actions\goisse\listBox\GLB_missionTypeMenu.sqf';};";
class controls {
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by Capt MacTavish, v1.063, #Lyzaje)
////////////////////////////////////////////////////////

class CMT_rscPicture_1: RscPicture
{
	idc = 1200;

	text = "images\Towns\Goisse\[4] Mission Type Menu\goisseMissionTypeSelectMenu.paa";
	x = 0.154531 * safezoneW + safezoneX;
	y = -0.017 * safezoneH + safezoneY;
	w = 0.70125 * safezoneW;
	h = 1.045 * safezoneH;
};
class CMT_rscButton_1: RscButton
{
	idc = 1600;
	action = "call CMT_fnc_SDT_3goisseDifficultySelectMenu;";

	text = "Return"; //--- ToDo: Localize;
	x = 0.381406 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.0360937 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Return to previous menu"; //--- ToDo: Localize;
};
class CMT_rscPicture_2: RscButton
{
	idc = 1601;
	action = "closeDialog 0";

	text = "Close Menu"; //--- ToDo: Localize;
	x = 0.572187 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.0515625 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Close the Menu"; //--- ToDo: Localize;
};
class CMT_rscButton_3: RscButton
{
	idc = 1602;
	action = "[] spawn {execVM 'functions\fnc\actions\goisse\listBox\GLB_missionTypeMenuActions.sqf'}";

	text = "Select"; //--- ToDo: Localize;
	x = 0.474219 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.04125 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Confirm selection"; //--- ToDo: Localize;
};
class RscStructuredText_1100: RscStructuredText
{
	idc = 1100;
	x = 0.422656 * safezoneW + safezoneX;
	y = 0.357 * safezoneH + safezoneY;
	w = 0.170156 * safezoneW;
	h = 0.22 * safezoneH;
	action = "[] spawn {execVM 'test.sqf'}";
};
class CMT_rscListBox_1: RscListbox
{
	idc = 1501;
	x = 0.4175 * safezoneW + safezoneX;
    y = 0.313 * safezoneH + safezoneY;
    w = 0.154687 * safezoneW;
    h = 0.264 * safezoneH;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
    };
};

 

 

Mission.hpp

Spoiler

class goisseMissionTypeMenu {
idd = 6104
movingEnabled = false;
onLoad = "[] spawn {execVM 'functions\fnc\actions\goisse\listBox\GLB_missionTypeMenu.sqf';};";
class controls {
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by Capt MacTavish, v1.063, #Lyzaje)
////////////////////////////////////////////////////////

class CMT_rscPicture_1: RscPicture
{
	idc = 1200;

	text = "images\Towns\Goisse\[4] Mission Type Menu\goisseMissionTypeSelectMenu.paa";
	x = 0.154531 * safezoneW + safezoneX;
	y = -0.017 * safezoneH + safezoneY;
	w = 0.70125 * safezoneW;
	h = 1.045 * safezoneH;
};
class CMT_rscButton_1: RscButton
{
	idc = 1600;
	action = "call CMT_fnc_SDT_3goisseDifficultySelectMenu;";

	text = "Return"; //--- ToDo: Localize;
	x = 0.381406 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.0360937 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Return to previous menu"; //--- ToDo: Localize;
};
class CMT_rscPicture_2: RscButton
{
	idc = 1601;
	action = "closeDialog 0";

	text = "Close Menu"; //--- ToDo: Localize;
	x = 0.572187 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.0515625 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Close the Menu"; //--- ToDo: Localize;
};
class CMT_rscButton_3: RscButton
{
	idc = 1602;
	action = "[] spawn {execVM 'functions\fnc\actions\goisse\listBox\GLB_missionTypeMenuActions.sqf'}";

	text = "Select"; //--- ToDo: Localize;
	x = 0.474219 * safezoneW + safezoneX;
	y = 0.599 * safezoneH + safezoneY;
	w = 0.04125 * safezoneW;
	h = 0.033 * safezoneH;
	colorText[] = {0.61,0.61,0.61,1};
	tooltip = "Confirm selection"; //--- ToDo: Localize;
};
class RscStructuredText_1100: RscStructuredText
{
	idc = 1100;
	x = 0.422656 * safezoneW + safezoneX;
	y = 0.357 * safezoneH + safezoneY;
	w = 0.170156 * safezoneW;
	h = 0.22 * safezoneH;
	action = "[] spawn {execVM 'test.sqf'}";
};
class CMT_rscListBox_1: RscListbox
{
	idc = 1501;
	x = 0.4175 * safezoneW + safezoneX;
    y = 0.313 * safezoneH + safezoneY;
    w = 0.154687 * safezoneW;
    h = 0.264 * safezoneH;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
    };
};

 

 

Function for switching dialog to mission type menu

Spoiler

// params["_player"];

if (!(isNull (findDisplay 6104)));
lbClear 1501;
closeDialog 0;
createDialog "goisseMissionTypeMenu";
_index = lbCurSel 1501;
waitUntil {!(isNull(findDisplay 6104))};

 

 

function for switching dialog to mission menu

Spoiler

params["_player"];

if (!(isNull (findDisplay 6105)));
closeDialog 0;
createDialog "goisseDefendMissionMenu";
waitUntil {!(isNull(findDisplay 6105))};

 

 

List box for mission type menu

Spoiler

disableSerialization;

_display = findDisplay 6104;

_listBox = _display displayCtrl 1501;

_listBox lbAdd "Defend";
_listBox lbAdd "Patrol";
_listBox lbAdd "Garrison";
_listBox lbSetColor [0, [0,1,0,1]];

 

 

List box actions for mission type menu

Spoiler

_selectedIndex = lbCurSel 1501;

if(_selectedIndex == 0) exitWith
{
    closeDialog 0;
	createDialog "goisseDefendMissionMenu";
};

if(_selectedIndex == 1) exitWith
{
	hint "You have selected index 1, or second item in the list";
	closeDialog 0;
};

if(_selectedIndex == 2) exitWith
{
	hint "You have selected index 2, or third item in the list";
	closeDialog 0;
};

 

 

 

I know doing it this way might seem messy but it is the only way I know of right now.

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

I am a little confused about your issue still. Can you .zip your mission so I can take a better look? There is a issue in your SQF code by the way:

if (!(isNull (findDisplay 6104)));
if (!isNull (findDisplay 6104)) then {};
waitUntil {!isNull (findDisplay 6104)};

 

Share this post


Link to post
Share on other sites

Found out the issue thanks to @HazJ Forgot to re-populate the listBox. After a little while got it working. Thank you @HazJ so much for your time and helping me through it!

  • Thanks 1

Share this post


Link to post
Share on other sites

No problem! :dontgetit:

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

×