Home   Help Search Login Register  

Author Topic: Dialog && GetArray && Picture  (Read 1673 times)

0 Members and 1 Guest are viewing this topic.

Offline Eymerich

  • Members
  • *
Dialog && GetArray && Picture
« on: 10 May 2007, 09:46:23 »
Hi,

I'm trying to build a dialog in one of my mission.

It will be displayed at the beginning of the mission to make player choose his own set of equipment...
(The dialog will be displayed during the mission also. That's the reason I'm not interested in using the "normal" gear in the briefing).

Now, I was Thinking to fill a listbox with the name of the weapon. This is simple...

The problem is another:

How do I get a picture of the weapon once the _index select one item in the list box?

I've thinked about "getarray" but... to be honest, I don't understand how does it works...  ???

And...

Is possible to display the picture without using a loop check (a loop, in other words, that monitor the index and display the different image on the proper control)?


Regards


Nicolas

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Dialog && GetArray && Picture
« Reply #1 on: 10 May 2007, 10:10:37 »
To avoid the loop, you may use the onLBSelChanged UI event:
For example:
Code: [Select]
   class TESTLIST : RscListBox
   {
      idc = 333;
      style = ST_LEFT;
      x = 0.021;
      y = 0.030;
      w = 0.28;
      h = 0.4;
      colorText[] = {0.0, 1.0, 0, 1};
      font = "Bitstream";
      sizeEx = 0.02;
      onLBSelChanged  = "_this execVM""mylistclicked.sqf""";
   };
Then do whatever you need into mylistclicked.sqf

UI Events, in Notes you will find what "_this" contains for each event.

Now, in your listbox, you may use lbSetData to set particular non-visible data (string type) for each displayed item, when you get the clicked item, retrieve the data with lbData command. You may set as data the JPG images (the name of the jpg) you want to display, once clicked to may use the jpg name to set the image of any other image control using setText command with the jpg name as text.

Hope I've understood correctly your problem.

Offline Eymerich

  • Members
  • *
Re: Dialog && GetArray && Picture
« Reply #2 on: 10 May 2007, 10:52:31 »
Thank you very much for your answer. It's a very interesting idea I'll try to improve as soon as I can (now 'm at work)...  :clap:

However, This (_this ?  :D ) solve only a part of my problem.
How can I get the path of the picture?

I've talked about Getarray 'cause in one mission (Rts) I've seen an Author displaying the picture in a list box using a loop and the getarray function.

Unfortunatly, I don't understand how I can use get array ( different function to make this will be also perfect) to retrive the path of a given picture...  :confused:

Regards,

Nicolas


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Dialog && GetArray && Picture
« Reply #3 on: 10 May 2007, 12:35:00 »
Ah, now I understand, you dont want to use your own images (jpgs), but the ingame images of the weapons/magazines, right? If so, I cannot help there, probably Hoz or Planck may help.

EDIT:
To get the pictures of the weapons you may do the following:
Code: [Select]
_weapon = theweaponnameyouwish;
_picture = getText(configFile >> "CfgWeapons" >> _weapon >> "picture");

For example:
Code: [Select]
_weapon = "AK74";
_picture = getText(configFile >> "CfgWeapons" >> _weapon >> "picture");

For magazines, change CfgWeapons by CfgMagazines and use magazine name instead of weapon name.
« Last Edit: 12 May 2007, 11:17:29 by Mandoble »

Offline Eymerich

  • Members
  • *
Re: Dialog && GetArray && Picture
« Reply #4 on: 14 May 2007, 10:33:16 »
Thank you very much!!!

 :)

I've tried with the getetxt functions with Vehicle and it works well.

But the same function doesn't seems to work when I want to displayed the picture of a man.

Any Help?
« Last Edit: 11 Jun 2007, 09:56:08 by Eymerich »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Dialog && GetArray && Picture
« Reply #5 on: 11 Jun 2007, 10:15:13 »
So you cannot get the icons or individual soldiers, right?
Sure Planck may enlight us with the structure of soldier class  :whistle: