|
If statements in panels.
#261117
04/15/09 21:55
04/15/09 21:55
|
Joined: Dec 2008
Posts: 56
binsky33333
OP
Junior Member
|
OP
Junior Member
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:
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]
#261126
04/15/09 22:34
04/15/09 22:34
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
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]
#261129
04/15/09 22:43
04/15/09 22:43
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
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 smile](/ubb7/images/graemlins/default_dark/smile.gif)
|
|
|
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
Expert
|
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
|
|
|
|