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 (M_D), 1,501 guests, and 4 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
[solved] comparing of panels #384629
10/05/11 14:34
10/05/11 14:34
Joined: Dec 2003
Posts: 988
Germany, Magdeburg
JoGa Offline OP
User
JoGa  Offline OP
User

Joined: Dec 2003
Posts: 988
Germany, Magdeburg
Hi

I have a problem in comparing Panel-pointers.
I have got some Panels and wrote a little piece of code, which cycles through the panels:
Code:
var i;
	for(i=1; i <60; i++)
	{
		str_cpy(str_mouse_over, "pan_invplatz"); //Name of panels
		str_cat_num(str_mouse_over,"%.0f",i); //number of panels in the name
		pan_mouse_over = (PANEL*) str_mouse_over; //tried to say "dude, thats a panel-pointer"
		if(mouse_panel == pan_mouse_over) // and tried to compare it with the mouse-over-panel
		{
			str_cpy(str_debug,str_mouse_over);
			// ....
		}
	}
}


But I think i can't do this - it is not detected right.
The Panels name is pan_invplatz1 and goes to pan_invplatz60.
I hoped I could do this with the strings, because if this does not working, I have to wrote a if-comparing for every single panel (if(mouse_panel == pan_invplatz1){...}, if(mouse_panel == pan_invplatz2){...}, ...) An thats a lot :-) Not only this 60, there are some other places in the code, i would be forced to write the same code clusters.

So, how can i convert a string in a panel-pointer?

Thanks for reading, i'm excited for your hints :-)

Last edited by JoGa; 10/05/11 15:51.
Re: comparing of panels [Re: JoGa] #384633
10/05/11 15:23
10/05/11 15:23
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Why don't you use an array of panels?

PANEL* pan_invplatz[60];
...
for(i = 0; i < 60; i++) pan_invplatz[i] = pan_create("",layer);

Alternatively, you can use draw_quad with a BMAP array (and a var array to store inventory information).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: comparing of panels [Re: Superku] #384634
10/05/11 15:36
10/05/11 15:36
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Ummm.. dumb question...

Have looked at the "mouse_panel" pointer in the manual?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
[solved] Re: comparing of panels [Re: EvilSOB] #384635
10/05/11 15:50
10/05/11 15:50
Joined: Dec 2003
Posts: 988
Germany, Magdeburg
JoGa Offline OP
User
JoGa  Offline OP
User

Joined: Dec 2003
Posts: 988
Germany, Magdeburg
Yes, I looked in the manual =)
Its a read-only Panel*

Okay, thanks for your both reply, wasn't aware of the possibility to take a Panel*-Pointer-array, that makes it much more easier as I thought.

I will change my inventory and take the panel-array, this will also reduce the cluster of code, i wrote.
Thanks!!

Last edited by JoGa; 10/05/11 15:51.

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