Combining two variables!

Posted By: Mahdi

Combining two variables! - 04/05/11 12:48

hi,

sorry I ask a lot of questions grin

This is the situation:

I hav several panels with these kind of names:

inventory_panel_1, inventory_panel_2, inventory_panel_3,...

I have a function and I want to make all these panels visible with just one while loop, like this:

Code:
function whatever ()
{
  while (x < y)
  {
    inventory_panel_x.visible=on;
    x+=1;
    wait(1);
  }

}



Is it possible (don't forget the above code does not work)?
Posted By: Uhrwerk

Re: Combining two variables! - 04/05/11 12:51

You can save your panels in an array and later on iterate over that array. You can store the panels in a var array. You just have to temporarily assign them to a panel reference later on to set their visible flag.
Posted By: Mahdi

Re: Combining two variables! - 04/05/11 13:23

I don't undrestand. can u pls write an example?
Posted By: Mahdi

Re: Combining two variables! - 04/05/11 15:22

someone please help me. I want to change not only the visibility but also the bmap property of all panels.

Is there any way?
Posted By: Uhrwerk

Re: Combining two variables! - 04/05/11 15:28

Which part didn't you understand?
Posted By: Mahdi

Re: Combining two variables! - 04/05/11 15:32

I think the whole part grin

How can I assign panels to arrays?
In which way can change the visibility of panels (now arrays)?

I just cann't undrestand. please give me an example.
Posted By: Uhrwerk

Re: Combining two variables! - 04/05/11 15:44

Well, you define a panel as usual. Then you define an array - as usual as well. My C-Script is a bit rusty, but it should be something like this:
Code:
var mypanels[10];


The you can assign your panels to the array.
Code:
mypanels[0] = my_first_panel;
mypanels[1] = my_second_panel;
// etc.


Finally you can read them out of the array.
Code:
PANEL* p;
p = mypanels[0];
p.visible = off;


Just put that last code fragment in a loop.

Posted By: Mahdi

Re: Combining two variables! - 04/06/11 03:22

Thanks. That is want. problem is solved.
© 2024 lite-C Forums