Jump to content
TokeDK

Dialog list - call case (Help a friendly noob)

Recommended Posts

Hello everyone... I've been sitting with this issue all day searching everywhere trying to figure it out, so hopefully you guys can help me out easily.

I'm fairly new to scripting, and just started getting into dialogs.

My issue is that I'm trying to call a case in a different script, after selecting the desired vehicle in the list I would like to spawn.

Heres an example of the case I'm trying to call, including the switch for it... I have a lot of arrays define before this part.

Quote

switch (_this select 1) do
{

case 'Hunter': { 	//Hunter
//////////////////////////////////
_ClassV = lbCurSel 1500;
_className = lbCurSel 1500;lbData [1500, _classV];

hint 'hint'; //test...

_displayName = 'Hunter';
/////////////////////////////////
call _checkMarker;
sleep 0.1;
//Spawn
_spawnVehicle = _className createVehicle getMarkerPos 'car_spawn';
_spawnVehicle setDir _direction;
_spawnVehicle setObjectTextureGlobal [0, 'textures\vehicles\hunter1_police.paa'];
hint format ["You have spawned a %1",_displayName];
//Repair and wipe cargo...
call _rep;
call _deleteCargo;
};

 

 

And this is my dialog:
 

Quote

class VS_fncDialog
{
    idd = 9999;
    movingEnabled = false;

  class controls
  {
    ////////////////////////////////////////////////////////
    // GUI EDITOR OUTPUT START (by Toke DK, v1.063, #Lufefy)
    ////////////////////////////////////////////////////////

    class VS_rscButton_Spawn: RscButton
    {
    	idc = 1600;
    	text = "SPAWN"; //--- ToDo: Localize;
    	x = 0.355625 * safezoneW + safezoneX;
    	y = 0.588 * safezoneH + safezoneY;
    	w = 0.0876563 * safezoneW;
    	h = 0.044 * safezoneH;
//      action = "call VS_fnc_vehicles";
    };
    class VS_rscButton_Cancel: RscButton
    {
    	idc = 1601;
    	text = "CANCEL"; //--- ToDo: Localize;
    	x = 0.546406 * safezoneW + safezoneX;
    	y = 0.588 * safezoneH + safezoneY;
    	w = 0.0876563 * safezoneW;
    	h = 0.044 * safezoneH;
      action = "closeDialog 0";
    };
    class VS_rsclistBox: RscListbox
    {
    	idc = 1500;
    	x = 0.355625 * safezoneW + safezoneX;
    	y = 0.346 * safezoneH + safezoneY;
    	w = 0.273281 * safezoneW;
    	h = 0.231 * safezoneH;
      action = "[] call Hunter;"
    };
    class VS_rscBackgroundPicture: RscPicture
    {
    	idc = 1200;
    	text = "#(argb,8,8,3)color(0,0,0,0.5)";
    	x = 0.350469 * safezoneW + safezoneX;
    	y = 0.335 * safezoneH + safezoneY;
    	w = 0.28875 * safezoneW;
    	h = 0.308 * safezoneH;
    };
  };
};

 

The dialog comes up perfectly fine, I just can't figure out how to pass the script through the dialog...

What I'd like is: select desired vehicle in dialog list --> press spawn ---> and the vehicle would be right there..

Thank you very much in advance.

Share this post


Link to post
Share on other sites
class VS_rscButton_Spawn: RscButton
{
	idc = 1600;
	text = "SPAWN"; //--- ToDo: Localize;
	x = 0.355625 * safezoneW + safezoneX;
	y = 0.588 * safezoneH + safezoneY;
	w = 0.0876563 * safezoneW;
	h = 0.044 * safezoneH;
	action = "[ nil, 'Hunter' ]call VS_fnc_vehicles";
};

And remove the action from the ui listbox as it is an unsupported property for a listbox.

I have filled the first parameter in the call to VS_fnc_vehicles with nil, as you do not show the entire function so have no idea what is needed.

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

×