Home   Help Search Login Register  

Author Topic: Passing variable from dialog listbox, to other script with _unit  (Read 539 times)

0 Members and 1 Guest are viewing this topic.

Acecool

  • Guest
Code: [Select]
shop.sqs that opens dialog...

_index = lbAdd [104, "[ $28,000 ] Jeep"]
lbSetData [104, _index, "SportsCars_Jeep"]

######### description .ext

   controls[] = { PURCHASE, EXIT, MY_LIST };
   class PURCHASE : RscButton
   {
      idc = 101;
      style = ST_CENTER;
      x = 0.3;
      y = 0.649;
      w = 0.2;
      h = 0.05;
      text = "Purchase Loadout!";
      action = "[] exec ""Shops\Checkout.sqs"""
      default = true;
      hint = "Test";
   };

How do I get it to pass: _unit, SportsCars_Jeep, shop_id to shops\checkout?


StonedSoldier

  • Guest
hello, ill be able to help you alot further is you post all the of script thats sets the values of the dialog controls

Acecool

  • Guest
Shops\Vehicles\Sport\Activate.sqs
Code: [Select]
_ok = createDialog "Dialog_Visit_Shop"
?(!_ok): hint "Error Creating Dialog!"; exit

_index = lbAdd [104, "[ $28,000 ] Jeep"]
lbSetData [104, _index, "SportsCars_Jeep"]
_index = lbAdd [104, "[ $70,000 ] Corvette"]
lbSetData [104, _index, "SportsCars_Corvette"]
_index = lbAdd [104, "[ $80,000 ] Tuned Corvette"]
lbSetData [104, _index, "SportsCars_Tuned_Corvette"]
_index = lbAdd [104, "[ $90,000 ] Challenger"]
lbSetData [104, _index, "SportsCars_"]
_index = lbAdd [104, "[ $100,000 ] Ferrari"]
lbSetData [104, _index, "SportsCars_Ferrari"]
lbSetCurSel [104, 0]

Shops\Checkout.sqs
Code: [Select]
_unit = this select 0

hint "name _unit"

exit

Description.ext
Code: [Select]
respawn=3;
respawndelay=60;

#define FontM "tahomaB36"
#define FontHTML "CourierNewB64"

#define ST_LEFT          0
#define ST_RIGHT         1
#define ST_CENTER       2
#define ST_FRAME         64

#define CT_STATIC       0
#define CT_BUTTON       1
#define CT_EDIT          2
#define CT_COMBO       4
#define CT_LISTBOX               5
#define CT_ACTIVETEXT 11

class RscText
{
   type = CT_STATIC;
   idc = -1;
   style = ST_LEFT;
   colorBackground[] = {0, 0, 0, 0};
   colorText[] = {1, 1, 1, 1};
   font = FontM;
   sizeEx = 0.04;
};

class RscActiveText
{
   type = CT_ACTIVETEXT;
   idc = -1;
   style = ST_LEFT;
   color[] = {1, 1, 1, 1};
   colorActive[] = {1, 0, 0, 1};
   font = FontM;
   sizeEx = 0.04;
   soundEnter[] = {"ui\ui_over", 0.2, 1};
   soundPush[] = {, 0.2, 1};
   soundClick[] = {"ui\ui_ok", 0.2, 1};
   soundEscape[] = {"ui\ui_cc", 0.2, 1};
   default = false;
};

class RscButton
{
   type = CT_BUTTON;
   idc = -1;
   style = ST_CENTER;
   colorText[] = {0, 0, 0, 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 RscEdit
{
   type = CT_EDIT;
   idc = -1;
   style = ST_LEFT;
   font = FontHTML;
   sizeEx = 0.02;
   colorText[] = {0, 0, 0, 1};
   colorSelection[] = {0.5, 0.5, 0.5, 1};
   autocomplete = false;
   text = ;
};

class RscLB_C
{
   style = ST_LEFT;
   idc = -1;
   colorSelect[] = {0.4, 0.4, 0.4, 1};
   colorSelectBackground[] = {0.2, 0.2, 0.2, 1};
   colorText[] = {0.2, 0.2, 0.2, 1};
   colorBackground[] = {0.4, 0.4, 0.4, 1};
   font = FontHTML;
   sizeEx = 0.025;
   rowHeight = 0.04;
};

class RscListBox: RscLB_C
{
        type = CT_LISTBOX;
};


class RscCombo : RscLB_C
{
   type = CT_COMBO;
   wholeHeight = 0.3;
};

class Dialog_Visit_Shop
{
   idd = -1;
   movingEnable = true;
   controlsBackground[] = { MY_BACKGROUND, MY_FRAME };
   class MY_BACKGROUND : RscText
   {
      colorBackground[] = {0.4, 0.4, 0.4, 0.75};
      text = ;
      x = 0.3;
      y = 0.1;
      w = 0.4;
      h = 0.6;
   };

   class MY_FRAME : RscText
   {
       idc = 103;
       style = ST_FRAME;
       colorText[] = {0, 0, 0, 1};
       text = "";
       font = FontHTML;
       sizeEx = 0.025;
       x = 0.299;
       y = 0.099;
       w = 0.4;
       h = 0.6;
   };

   objects[] = { };
   controls[] = { PURCHASE, EXIT, MY_LIST };
   class PURCHASE : RscButton
   {
      idc = 101;
      style = ST_CENTER;
      x = 0.3;
      y = 0.649;
      w = 0.2;
      h = 0.05;
      text = "Purchase Loadout!";
      action = "[player] exec ""Shops\Checkout.sqs"""
      default = true;
      hint = "Test";
   };

   class EXIT : RscButton
   {
      idc = 102;
      style = ST_CENTER;
      x = 0.5;
      y = 0.649;
      w = 0.2;
      h = 0.05;
      text = "Leave Shop!";
      action = "closeDialog 0";
   };

   class MY_LIST : RscListBox
   {
      x = 0.3
      y = 0.1
      idc = 104
      w = 0.397
      h = 0.547
      style = ST_LEFT
      colorText[] = {0.2, 0.2, 0.2, 1};
      colorBackground[] = {0.752, 0.752, 0.752, 1};
      font = "CourierNewB64"
      SizeEX = 0.025
      colorSelect[] = {0.4, 0.4, 0.4, 1};
      colorSelectBackGround[] = {0.2, 0.2, 0.2, 1};
      RowHeight = 0.04
   };

};