Home   Help Search Login Register  

Author Topic: need help creating class names with dialogs  (Read 1503 times)

0 Members and 1 Guest are viewing this topic.

Offline jones

  • Members
  • *
need help creating class names with dialogs
« on: 30 Jul 2008, 01:56:14 »
I will describe this as best as I can.  i am creating 64 different magazine classes for my artillery mod. I have broken down the class names into sections to identify them. propellent, round type, and powder charge. I list all three categories in combo boxes.

Code: [Select]
FC_IDD_FCVIEW = 5980;
FC_PRPCOMBO = 5990;
FC_RNDCOMBO = 5991;
FC_PCCOMBO  = 5992;

_ok = createDialog "FC_FCDialog";

_index1 = lbAdd [FC_PRPCOMBO, "M1"];
lbSetData [FC_PRPCOMBO, _index1, "M1_"];
_index1 = lbAdd [FC_PRPCOMBO, "M3"];
lbSetData [FC_PRPCOMBO, _index1, "M3_"];
_index1 = lbAdd [FC_PRPCOMBO, "M6"];
lbSetData [FC_PRPCOMBO, _index1, "M6_"];

_index2 = lbAdd [FC_RNDCOMBO, "HE"];
lbSetData [FC_RNDCOMBO, _index2, "HE_"];
_index2 = lbAdd [FC_RNDCOMBO, "SABOT"];
lbSetData [FC_RNDCOMBO, _index2, "SABOT_"];
_index2 = lbAdd [FC_RNDCOMBO, "Smoke"];
lbSetData [FC_RNDCOMBO, _index2, "SMOKE_"];


_index3 = lbAdd [FC_PCCOMBO, "Powder charge 1"];
lbSetData [FC_PCCOMBO, _index3, "PC1"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 2"];
lbSetData [FC_PCCOMBO, _index3, "PC2"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 3"];
lbSetData [FC_PCCOMBO, _index3, "PC3"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 4"];
lbSetData [FC_PCCOMBO, _index3, "PC4"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 5"];
lbSetData [FC_PCCOMBO, _index3, "PC5"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 6"];
lbSetData [FC_PCCOMBO, _index3, "PC6"];
_index3 = lbAdd [FC_PCCOMBO, "Powder charge 7"];
lbSetData [FC_PCCOMBO, _index3, "PC7"];

What I am looking to do is to run a script that will take each piece of data and put it together into one variable, the magazine class name.
I select the first box "M1" propellent name ( lbsetdata "M1_") then the next box  "HE" (lbsetdat "HE_") then the last box "PC1" (lbsetdata "PC1")

When hit the load button on the dialog I want it to take all three data sets index1 index2 and index3 and create one variable "M1_HE_PC1" (the magazine class name so that I can load it into the gun.

I have tried several times but i keep hitting a wall. I am still fairly new to this stuff. any insight on how to achieve this would be greatly appreciated.

I might be going about this all wrong the other idea I had was to use buttons for each that passes the text i.e "M1_" "HE_" and "PC1" to text displays and executing a script tha combines all the text.

EDIT: Found solution Banged my head against the wall for a while before trying this.

Code: [Select]
Ammo.sqf

FC_IDD_FCVIEW = 5980;
FC_PRPCOMBO = 5990;
FC_RNDCOMBO = 5991;
FC_PCCOMBO  = 5992;

_ok = createDialog "FC_FCDialog";

_index = lbAdd [FC_PRPCOMBO, "M1"];
lbSetData [FC_PRPCOMBO, _index, "M1_"];
_index = lbAdd [FC_PRPCOMBO, "M3"];
lbSetData [FC_PRPCOMBO, _index, "M3_"];
_index = lbAdd [FC_PRPCOMBO, "M6"];
lbSetData [FC_PRPCOMBO, _index, "M6_"];

Then call this file from the onLBSelChanged

Code: [Select]
Ammo2.sqf

FC_IDD_FCVIEW = 5980;
FC_PRPCOMBO = 5990;
FC_RNDCOMBO = 5991;
FC_PCCOMBO  = 5992;

_control = _this select 0;
_index = _this select 1;
_displaym = findDisplay FC_IDD_FCVIEW;
_ammo = _control lbdata _index;

switch (_ammo) do
{
    case "M1_":
    {
             lbclear FC_RNDcombo;
lbclear FC_PCcombo;
_index = lbAdd [FC_RNDCOMBO, "M1_HE"];
lbSetData [FC_RNDCOMBO, _index, "M1_HE_"];
_index = lbAdd [FC_RNDCOMBO, "M1_SABOT"];
lbSetData [FC_RNDCOMBO, _index, "M1_SABOT_"];
_index = lbAdd [FC_RNDCOMBO, "M1_SMOKE"];
lbSetData [FC_RNDCOMBO, _index, "M1_SMOKE_"];
    };

    case "M3_":
    {
             lbclear FC_RNDcombo;
lbclear FC_PCcombo;
_index = lbAdd [FC_RNDCOMBO, "M3_HE"];
lbSetData [FC_RNDCOMBO, _index, "M3_HE_"];
_index = lbAdd [FC_RNDCOMBO, "M3_SABOT"];
lbSetData [FC_RNDCOMBO, _index, "M3_SABOT_"];
_index = lbAdd [FC_RNDCOMBO, "M3_SMOKE"];
lbSetData [FC_RNDCOMBO, _index, "M3_SMOKE_"];
    };

    case "M6_":
         {
              lbclear FC_RNDcombo;
lbclear FC_PCcombo;
_index = lbAdd [FC_RNDCOMBO, "M6_HE"];
lbSetData [FC_RNDCOMBO, _index, "M6_HE_"];
_index = lbAdd [FC_RNDCOMBO, "M6_SABOT"];
lbSetData [FC_RNDCOMBO, _index, "M3_SABOT_"];
_index = lbAdd [FC_RNDCOMBO, "M6_SMOKE"];
lbSetData [FC_RNDCOMBO, _index, "M3_SMOKE_"];
   };
case "M1_HE_":
{
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC1"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC1"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC2"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC2"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC3"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC3"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC4"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC4"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC4"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC4"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC5"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC5"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC6"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC6"];
_index = lbAdd [FC_PCCOMBO, "M1_HE_PC7"];
lbSetData [FC_PCCOMBO, _index, "M1_HE_PC7"];
   }; 
};
Then run the last file on the last list box with onLBSelChanged to load the ammo.

Code: [Select]
ammoload.sqf

FC_IDD_FCVIEW = 5980;

_control = _this select 0;
_index = _this select 1;
_displaym = findDisplay FC_IDD_FCVIEW;
_artmag = _control lbdata _index;
_LRM119 = position player nearestObject "LRM119";
_Default_mags = magazines _LRM119;
{_LRM119 removemagazine _x;}foreach _Default_mags;
_LRM119 addmagazine _artmag;
player groupchat format ["Ammo Loaded: %1",_artmag];

Sorry for the extremely long post but hopefully this may help someone with the same issue I had.

Respectfully
Jones
« Last Edit: 30 Jul 2008, 10:54:18 by jones »