Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Creatd panel problem #171945
12/09/07 19:19
12/09/07 19:19
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
Im without ideas how can make every created panel with his own identity - that mean when under one name from three created panels --> function execute only last created and others ignore all of this.
/////////////////////////////////////////////////////
Here some example code
/////////////////////////////////////////////////////
function radit
{
///this function is executed only after button pressing
mantu_pan = pan_create("bmap =abols.tga;",14,);
mantu_pan.on_click = parvietot_mani;
}

function parvietot_mani
{
while(mouse_left == 1)
{
mantu_pan.pos_x = mouse_pos.x;
mantu_pan.pos_y = mouse_pos.y;
wait(1);
}
}
/////////////////////////////////////////////
This is very short example but only to show that when here pressing on every panel let execute function only to last one created
*Please help any --> with this im fighting long time and cant solve.


Latvija rullē
Re: Creatd panel problem [Re: MDI] #171946
12/11/07 01:57
12/11/07 01:57
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline
Member
raiden  Offline
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
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

Last edited by raiden; 12/11/07 01:59.

"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Creatd panel problem [Re: raiden] #171947
12/15/07 19:44
12/15/07 19:44
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
Sorry for so late answer, but first i wishes something where can undefined quantity of panel use! - That first.
second is here:
//////////////////////////////////////////////
mantu_pan = pan_create("bmap =abols.tga;",14,);
mantu_pan.on_click = parvietot_mani;
//////////////////////////////////////////////
OR "on_click" can get in that quotation marks! Then sure every panel will execute his own pressed function, but then for panels need termine like "Me". Overnamed entity name let use mostly functions for last entity! And that next_entity i dont understand too - haw can use it.

And then here is much questions - if any really this engine user can help me - please, because panel system looks quit primitive here!

Last edited by MDI; 12/15/07 19:46.

Latvija rullē
Re: Creatd panel problem [Re: MDI] #171948
12/16/07 03:09
12/16/07 03:09
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
did you define mantu_pan like this:

panel* mantu_pan;

this is very important, if you don't do this, you will get errors, or it just won't work


- aka Manslayer101
Re: Creatd panel problem [Re: mpdeveloper_B] #171949
12/16/07 03:15
12/16/07 03:15
Joined: Jul 2006
Posts: 503
Australia
A
adoado Offline

User
adoado  Offline

User
A

Joined: Jul 2006
Posts: 503
Australia
Quote:

Sorry for so late answer, but first i wishes something where can undefined quantity of panel use! - That first.





You will need to use an array like Raiden said. Arrays cannot change their size during runtime, so if you wanted the size the change at runtime you would need to use a DLL as the storage (and not 3dgs arrays) or, in Lite-C, I think you can use Linked Lists.

Thanks, ^^
Adoado


Visit our development blog: http://yellloh.com
Creatd panel problem [Re: adoado] #171950
12/16/07 08:30
12/16/07 08:30
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
Pity from dll i dont know anything! But or with dll can make panels so interactive like entities? Otherwise i cant work normal. But i can try to hide all problems, but that never is good solution.

mpdeveloper_B : Im always defining all names, but that isnt problem here.
adoado: Im using standart c-script. Ann how i see you have experience with dlls - possible you can help me understand how to work with thrm.


Latvija rullē

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1