Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (RealSerious3D, AndrewAMD, BrainSailor, 1 invisible), 1,233 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
If statements in panels. #261117
04/15/09 21:55
04/15/09 21:55
Joined: Dec 2008
Posts: 56
B
binsky33333 Offline OP
Junior Member
binsky33333  Offline OP
Junior Member
B

Joined: Dec 2008
Posts: 56
Hi everyone, I just have a quick question whenever i try and create an if statement in a panel such as:

Code:
panel game_panel
{
	bmap= main_panel;
	flags = VISIBLE, OVERLAY;
	digits (58, 560, 5, digi_font, 1, health);
        if(weapon1.visible == on)
        {
	digits (620, 560, 5, digi_font, 1, current_ammo);
        }
	
}
I always get a bunch of errors when i do that. I guess you cant do if statements inside panels. 



 


BTW weapon1 is an entity.

Last edited by binsky33333; 04/15/09 21:55.
Re: If statements in panels. [Re: binsky33333] #261125
04/15/09 22:32
04/15/09 22:32
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
you can't use if statements outside of functions.


3333333333
Re: If statements in panels. [Re: binsky33333] #261126
04/15/09 22:34
04/15/09 22:34
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
No coding as such is allowed in panels, or entities, TEXTs, etc.
They are "definitions" , not functions.
They only describe a "thing", they never actually DO anything.
Sorry.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: If statements in panels. [Re: EvilSOB] #261127
04/15/09 22:42
04/15/09 22:42
Joined: Dec 2008
Posts: 56
B
binsky33333 Offline OP
Junior Member
binsky33333  Offline OP
Junior Member
B

Joined: Dec 2008
Posts: 56
Could i put a panel inside a function?

Re: If statements in panels. [Re: EvilSOB] #261129
04/15/09 22:43
04/15/09 22:43
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Also if your working with Lite-C

panel game_panel

should be

PANEL* game_panel = { ....
flags = SHOW | OVERLAY;....}

Ottawa smile

Re: If statements in panels. [Re: Ottawa] #261130
04/15/09 22:45
04/15/09 22:45
Joined: Dec 2008
Posts: 56
B
binsky33333 Offline OP
Junior Member
binsky33333  Offline OP
Junior Member
B

Joined: Dec 2008
Posts: 56
Its not Lite-c... It is wdl script but some mod moved the question here.

Re: If statements in panels. [Re: binsky33333] #261136
04/16/09 00:04
04/16/09 00:04
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth

try using pan_create
I've done it in liteC and I think it should work in c_script:

panel game_panel;
string panelDefinition = "";


inside some function:

str_cpy(panelDefinition,"bmap= main_panel;flags = VISIBLE, OVERLAY;digits (58, 560, 5, digi_font, 1, health);");
if(weapon1.visible == on)
{
str_cat(panelDefinition,"digits (620, 560, 5, digi_font, 1, current_ammo);");
}
game_panel = pan_create(panelDefinition,10);


If it doesn't work (I'm not sure about the "panel gamepanel;" line)you can always just make two panels and switch the second one on and of depending on weapon1.visible.


~"I never let school interfere with my education"~
-Mark Twain
Re: If statements in panels. [Re: Germanunkol] #261142
04/16/09 00:15
04/16/09 00:15
Joined: Feb 2008
Posts: 69
Australia
M
MegaMarioDeluxe Offline
Junior Member
MegaMarioDeluxe  Offline
Junior Member
M

Joined: Feb 2008
Posts: 69
Australia
This may be a good way to do dynamic HP meters, if you have a 5-hit HP meter, you could have it updating the meter straight away when the player gets a whack or something.


----
MegaMario
Regular 3D Game Studio User
http://www.krystalgaming.net
Re: If statements in panels. [Re: MegaMarioDeluxe] #261148
04/16/09 00:38
04/16/09 00:38
Joined: Dec 2008
Posts: 56
B
binsky33333 Offline OP
Junior Member
binsky33333  Offline OP
Junior Member
B

Joined: Dec 2008
Posts: 56
Could anyone possibly post a example of using a switch?

Re: If statements in panels. [Re: binsky33333] #261149
04/16/09 00:44
04/16/09 00:44
Joined: Dec 2008
Posts: 56
B
binsky33333 Offline OP
Junior Member
binsky33333  Offline OP
Junior Member
B

Joined: Dec 2008
Posts: 56
Nevermind I figured everything out.


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