Home   Help Search Login Register  

Author Topic: Dialogs, passing multiple LBCursels...  (Read 1087 times)

0 Members and 1 Guest are viewing this topic.

Acecool

  • Guest
Dialogs, passing multiple LBCursels...
« on: 17 Mar 2005, 12:58:19 »
_ok = createDialog "Dialog_Visit_Shop"
?(!_ok): hint "Error Creating Dialog!"; exit

_index = lbAdd [104, "[ $2,500 ] American Repair Truck"]
lbSetData [104, _index, "Truck5tRepair"]
lbSetData [105, 0, 2500]
lbSetData [106, 0, "Vehicle"]
lbSetData [107, 0, "American Repair Truck"]

_index = lbAdd [104, "[ $2,500 ] American Refuel Truck"]
lbSetData [104, _index, "Truck5tRefuel"]
lbSetData [105, 1, 2500]
lbSetData [106, 1, "Vehicle"]
lbSetData [107, 1, "American Refuel Truck"]

_index = lbAdd [104, "[ $2,500 ] American Ammo Truck"]
lbSetData [104, _index, "Truck5tRearm"]
lbSetData [105, 1, 2500]
lbSetData [106, 1, "Vehicle"]
lbSetData [107, 1, "American Ammo Truck"]

lbSetCurSel [104, 0]
lbSetCurSel [105, 0]
lbSetCurSel [106, 0]
lbSetCurSel [107, 0]

######################

Checkout.sqs

_unit = player
_item = lbdata [104,(lbcursel 104)]
_index = lbCurSel 104

_item_price = lbSetCurSel [105, _index]
_item_price = lbdata [105,(lbcursel 105)]
_item_type = lbSetCurSel [106, _index]
_item_type = lbdata [106,(lbcursel 106)]
_item_name = lbSetCurSel [107, 1]
_item_name = lbdata [107,(lbcursel 107)]

hint format["Item: %1\nPrice: %2\nType: %3\nName: %4", _item, _item_price, _item_type, _item_name]

exit

####################

description.ext

   objects[] = { };
   controls[] = { PURCHASE, EXIT, MY_LIST, MY_LIST_PRICE, MY_LIST_TYPE, MY_LIST_ITEM };
   class PURCHASE : RscButton
   {
      idc = 101;
      style = ST_CENTER;
      x = 0.3;
      y = 0.649;
      w = 0.2;
      h = 0.05;
      text = "Purchase!";
      action = "[] 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
   };

   class MY_LIST_PRICE : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 105
      w = 0.001
      h = 0.001
      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
   };

   class MY_LIST_TYPE : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 106
      w = 0.001
      h = 0.001
      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
   };

   class MY_LIST_ITEM : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 107
      w = 0.001
      h = 0.001
      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
   };

#############################

Any ideas?
Been trying and trying..

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Dialogs, passing multiple LBCursels...
« Reply #1 on: 17 Mar 2005, 19:10:27 »
Im not sure if this is your problem or if you just cropped it out, but many things in description.ext are not defined. ie ST_LEFT,ST_CENTER...
I like your approach, lets see your departure.
Download the New Flashlight Script!

Acecool

  • Guest
Re:Dialogs, passing multiple LBCursels...
« Reply #2 on: 18 Mar 2005, 00:01:59 »
full:
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, MY_LIST_PRICE, MY_LIST_TYPE, MY_LIST_ITEM };
   class PURCHASE : RscButton
   {
      idc = 101;
      style = ST_CENTER;
      x = 0.3;
      y = 0.649;
      w = 0.2;
      h = 0.05;
      text = "Purchase!";
      action = "[] 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
   };

   class MY_LIST_PRICE : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 105
      w = 0.001
      h = 0.001
      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
   };

   class MY_LIST_TYPE : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 106
      w = 0.001
      h = 0.001
      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
   };

   class MY_LIST_ITEM : RscListBox
   {
      x = 30.3
      y = 30.1
      idc = 107
      w = 0.001
      h = 0.001
      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
   };

};

Acecool

  • Guest
Re:Dialogs, passing multiple LBCursels...
« Reply #3 on: 19 Mar 2005, 20:51:56 »
Any ideas?

Acecool

  • Guest
Re:Dialogs, passing multiple LBCursels...
« Reply #4 on: 31 Mar 2005, 17:46:01 »
Anyone?

Offline Pilot

  • Contributing Member
  • **
Re:Dialogs, passing multiple LBCursels...
« Reply #5 on: 31 Mar 2005, 21:53:08 »
Are there any errors when the dialogs are run, or do they simply not show up?

Acecool

  • Guest
Re:Dialogs, passing multiple LBCursels...
« Reply #6 on: 01 Apr 2005, 09:34:22 »
They dont show up, since I use one list box to display data etc, and then I made a few more list boxes and inserted data along the same indexes..


_ok = createDialog "Dialog_Visit_Shop"
?(!_ok): hint "Error Creating Dialog!"; exit

_index = lbAdd [104, "[ $2,500 ] American Repair Truck"]
_index_p = lbAdd [105, "Price"]
_index_t = lbAdd [106, "Type"]
_index_n = lbAdd [107, "Name"]
lbSetData [104, _index, "Truck5tRepair"]
lbSetData [105, _index_p, "2500"]
lbSetData [106, _index_t, "Vehicle"]
lbSetData [107, _index_n, "American Repair Truck"]

_index = lbAdd [104, "[ $2,500 ] American Refuel Truck"]
_index_p = lbAdd [105, "Price"]
_index_t = lbAdd [106, "Type"]
_index_n = lbAdd [107, "Name"]
lbSetData [104, _index, "Truck5tRefuel"]
lbSetData [105, _index_p, "2500"]
lbSetData [106, _index_t, "Vehicle"]
lbSetData [107, _index_n, "American Refuel Truck"]

_index = lbAdd [104, "[ $2,500 ] American Ammo Truck"]
_index_p = lbAdd [105, "Price"]
_index_t = lbAdd [106, "Type"]
_index_n = lbAdd [107, "Name"]
lbSetData [104, _index, "Truck5tRearm"]
lbSetData [105, _index_p, "2500"]
lbSetData [106, _index_t, "Vehicle"]
lbSetData [107, _index_n, "American Ammo Truck"]

lbSetCurSel [104, 0]
lbSetCurSel [105, 0]
lbSetCurSel [106, 0]
lbSetCurSel [107, 0]

--
The purchase script:


_unit = player
_item = lbdata [104,(lbcursel 104)]
_index = lbCurSel 104

_item_price = lbSetCurSel [105, _index]
_item_price = lbdata [105,(lbcursel 105)]

_item_type = lbSetCurSel [106, _index]
_item_type = lbdata [106,(lbcursel 106)]

_item_name = lbSetCurSel [107, _index]
_item_name = lbdata [107,(lbcursel 107)]

hint format["Item: %1\nPrice: %2\nType: %3\nName: %4\n\nIndex: %5", _item, _item_price, _item_type, _item_name, _index]

exit


--

Its supposed to set the index of the others to the index of the displayed listbox, for extra data..