Hi MDI, the solution to your problem can be easily solved by storing the panel pointer in an array with the commands handle() and ptr_to_handle().
Here is an example:
Code:
define maxPanels, 10; // this defines the total amount of panels you want
//
panel* panel1;
panel* panel2;
panel* panel3;
panel* panel4;
panel* panel5;
panel* panel6;
panel* panel7;
panel* panel8;
panel* panel9;
panel* panel10;
//
panel* tempPanel;
//
var panelArray[maxPanels]; // holds your panel pointers
var panelCtr; // increments the indexes in the array
//
function storePanels(index)
{
if(index == 0) { panelArray[index] = handle(panel1); return; }
if(index == 1) { panelArray[index] = handle(panel2); return; }
if(index == 2) { panelArray[index] = handle(panel3); return; }
if(index == 3) { panelArray[index] = handle(panel4); return; }
if(index == 4) { panelArray[index] = handle(panel5); return; }
if(index == 5) { panelArray[index] = handle(panel6); return; }
if(index == 6) { panelArray[index] = handle(panel7); return; }
if(index == 7) { panelArray[index] = handle(panel8); return; }
if(index == 8) { panelArray[index] = handle(panel9); return; }
if(index == 9) { panelArray[index] = handle(panel10); }
}
//
function createPanels()
{
if(panelCtr > maxPanels-1) { error("Not enough indexes in array!"); return; }
if(panelCtr == 0) { panel1 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 1) { panel2 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 2) { panel3 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 3) { panel4 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 4) { panel5 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 5) { panel6 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 6) { panel7 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 7) { panel8 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 8) { panel9 = pan_create("bmap = abols.tga",14); }
if(panelCtr == 9) { panel10 = pan_create("bmap = abols.tga",14); }
//
storePanels(panelCtr); // store the handle
//
panelCtr += 1;
}
//
function getPanel(index)
{
tempPanel = ptr_for_handle(panelArray[index]);
if(tempPanel != null)
{
// do some stuff(testing)
tempPanel.pos_x += 10;
tempPanel.pos_y += 10;
}
}
So thats the cscript way I know of, its not very clean, but it works(i think
)
Anyway, you have all your panel pointers, and a way to store them in the array every time you call createPanels(); Next its just a matter of knowing which panel is stored in the array and getting it back to manipulate it however you need and you would do that through getPanel(index);, so if you want to grab your 1st panel, you would call getPanel(0); and now tempPanel points to panel1, to which you can alter however you need.
I hope that helps you out.
-raiden