Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,709 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
calling panel & function from the previous script #357232
02/06/11 09:41
02/06/11 09:41
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
hi,

can anyone help me with this problem??
i have a game and i want it to go back to the menu when it is game over. the menu code and the level code are separated, so the level code is included at the menu code: "#define level1.c". when i include level1.c to the menu code, there is an error. all panels declared to the level1.c is visible and overlays to the menu code when i run the script although it is set to ~SHOW in menu code. what should i do? pls help me. thanks laugh

Re: calling panel & function from the previous script [Re: carla_mariz] #357235
02/06/11 10:15
02/06/11 10:15
Joined: Nov 2010
Posts: 125
Germany
chrisp1 Offline
Member
chrisp1  Offline
Member

Joined: Nov 2010
Posts: 125
Germany
"#define level1.c" ?

I think there have to be #include "level1.c"


---------------------------------------------------
My new project: www.sfc.de.to
My old project: www.littlesubmarine.de.to
My Youtubechannel: http://www.youtube.com/user/darkchrisp#p/a/u/0/5idMXmCDdmA
---------------------------------------------------
Re: calling panel & function from the previous script [Re: chrisp1] #357237
02/06/11 10:20
02/06/11 10:20
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
oh..sorry, what i mean was "#include level.c".. grin
sorry, mistyped here.

Re: calling panel & function from the previous script [Re: carla_mariz] #357315
02/06/11 17:09
02/06/11 17:09
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
So you're saying you have switched OFF all the panels from level1.c within the menu code? And this is still happening?

My first guess is maybe you have a while() loop somewhere in the level code that is switching the panels on every frame, and for whatever reason it's not stopping when the menu comes up. In that case just add a simple if(is(menu,SHOW)) break; to the loop. That's just a guess though. That's probably the mistake I would have made. tongue

Sometimes the most remote lines in the tiniest parts of your code causes massive problems. I'd do an Edit>Find in SED to find every occurrence of the panel names, to see if you are switching them on at wrong times.

Re: calling panel & function from the previous script [Re: carla_mariz] #357397
02/06/11 23:16
02/06/11 23:16
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
Originally Posted By: carla_mariz
hi,

when i include level1.c to the menu code, there is an error. all panels declared to the level1.c is visible and overlays to the menu code when i run the script although it is set to ~SHOW in menu code. what should i do? pls help me. thanks laugh


sorry, what i want to say here was, "when i include menucode.c to the level1.c" grin
~the reason why i include menucode.c to the level1.c is to call the menu panel so that the user can play again or exit. laugh

Re: calling panel & function from the previous script [Re: carla_mariz] #357408
02/07/11 00:20
02/07/11 00:20
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Alright, so,

Can you please post the code where you turn on the menu after the level is done? And can you post any other code where you set or reset the SHOW flag of a panel?

Re: calling panel & function from the previous script [Re: Logan] #357414
02/07/11 01:09
02/07/11 01:09
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
here, this is the menu code:
Code:
#include <acknex.h>
#include <default.c>

#include "level1.c"

.
.
.

PANEL* logoscreen =
{
	layer = 2;
	bmap = men1;
	pos_x = 0;     
	pos_y = 0; 
	button (287, 167, "sot.tga", "sot.tga", "sov.tga", lvl_load, NULL, overmenuitem);      
	button (287, 215, "lanot.tga", "lanot.tga", "lanov.tga", NULL, NULL, overmenuitem);      
	button (287, 263, "optot.tga", "optot.tga", "optov.tga", options, NULL, overmenuitem);      
	button (287, 311, "insot.tga", "insot.tga", "insov.tga", instruct, NULL, overmenuitem);      
	button (287, 359, "abot.tga", "abot.tga", "abov.tga", NULL, NULL, overmenuitem);      
	button (287, 407, "exot.tga", "exot.tga", "exov.tga", is_exit_prg, NULL, overmenuitem);   
	flags = SHOW | OVERLAY;
}
.
.
.

function main()
{
	screen_size.x = 800;
	screen_size.y = 600;
	mouse_map = cur;
	mouse_mode = 4;
	
	master_vol = 75; 
	soundtrack_handle = media_loop("Pacman.mp3", NULL, soundtrack_volume); 
	options_pan.flags &= ~SHOW;
	level2_pan.flags &= ~SHOW;
	ins_pan.flags &= ~SHOW;
	exit_pan.flags &= ~SHOW;
	logoscreen.flags &= ~SHOW;
	selectchar.flags &= ~SHOW;
	q1.flags &= ~SHOW;
	health_pan.flags &= ~SHOW;
	gameover.flags &= ~SHOW;
	score_gameover.flags &= ~SHOW;
	tme_up.flags &= ~SHOW;
	gui.flags &= ~SHOW;
	radar_screen.flags &= ~SHOW;
	level1_pan.flags &= ~SHOW;
	congrats_pan.flags &= ~SHOW;
	scoret.flags &= ~SHOW;
	splashout();	
}
.
.
.



and this is the level1 code:

Code:
#include <acknex.h>
#include <default.c>

#define health skill1
#define state skill2

PANEL* level2_pan = 
{
	bmap = "level2.jpg";
	pos_x = 0;
	pos_y = 0;
	layer = 40;
	flags = SHOW;
}

PANEL* q1 = 
{
	bmap = "q1.pcx";
	layer = 4;
	pos_x = 580;
	pos_y = 10;
	flags = SHOW | TRANSLUCENT;
}

PANEL* radar_screen=
{
	BMAP = "dark1.bmp";
	flags = SHOW | TRANSLUCENT;
	pos_x=5;
	pos_y=5;
	layer = 0; 
	alpha = 95;
}

PANEL* tme_up =
{
	bmap = "times.pcx";
	pos_x = 0;
	pos_y = 0;
	flags = SHOW | TRANSLUCENT;
	alpha = 85;
}

PANEL* congrats_pan = 
{
	bmap = "ans1.pcx";
	layer = 4;
	pos_x = 580;
	pos_y = 10;
	flags = SHOW;
}


PANEL* health_pan = 
{
	bmap = "hbar.pcx";
	pos_x = 10;
	pos_y = 550;
	layer = 25;
	flags = SHOW;
}

PANEL* gameover =
{
	bmap = "gameover.pcx";
	pos_x = 0;
	pos_y = 0;
	flags = SHOW | TRANSLUCENT;
	alpha = 85;
}

PANEL* time_txt =
{
	digits(20, 250, 3, "Arial#24b", 1, time_str);
	flags = SHOW;
}

PANEL* gui =
{
	digits(570, 550, 1, "Arial#24bi", 1, players_life);
	digits(740, 550, 2, "Arial#24bi", 1, players_score);
	digits(780, 550, 2, "Arial#24bi", 1, total_power);
	flags = SHOW;
}


PANEL* scoret = 
{
	bmap = "score.tga";
	pos_x = 0;
	pos_y = 0;
	layer = 0;
	button = (350, 450, "Lokot.tga", "Lokot.tga", "Lokov.tga", level2, NULL, overmenuitem);
	
	digits(550, 182, 9, "Arial#24bi", 1, a);
	digits(400, 182, 9, "Arial#24bi", 1, players_score);
	digits(550, 230, 9, "Arial#24bi", 1, b);
	digits(400, 230, 9, "Arial#24bi", 1, players_diamond);  
	digits(550, 280, 9, "Arial#24bi", 1, c);
	digits(550, 320, 9, "Arial#24bi", 1, total);
	flags |= SHOW;
}

PANEL* score_gameover = 
{
	bmap = "score.tga";
	pos_x = 0;
	pos_y = 0;
	layer = 0;
	button = (350, 450, "Lokot.tga", "Lokot.tga", "Lokov.tga", mmenu, NULL, overmenuitem);
	
	digits(550, 182, 9, "Arial#24bi", 1, a);
	digits(400, 182, 9, "Arial#24bi", 1, players_score);
	digits(550, 230, 9, "Arial#24bi", 1, b);
	digits(400, 230, 9, "Arial#24bi", 1, players_diamond);  
	digits(550, 280, 9, "Arial#24bi", 1, c);
	digits(550, 320, 9, "Arial#24bi", 1, total);
	flags |= SHOW;
}

function mmenu()//the function where i want to call the logoscreen panel 
{               //from the menu code.
	//logoscreen.flags |= SHOW;
}



whenever i include menucode.c in the level1.c, an error saying that the panels from level1.c are unidentified. btw, the first code to run is the main menu code. laugh

Re: calling panel & function from the previous script [Re: carla_mariz] #357562
02/07/11 17:13
02/07/11 17:13
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Hmm. So you are running the menu code, in which main() runs (hopefully--you might try putting a beep(); in there just to check)... and even when main runs all the panels are SHOWing on top of each other?

From what you posted I'm having a hard time figuring out why. The only things I see are that in score_t and score_gameover you wrote "flags |= " instead of just "flags = "... but I don't know if or why that would cause this behavior.

I also wonder why you set all the panels to SHOW in the definitions when you are just immediately switching them off in main(). You might just NOT set them to SHOW and let everything then take care of itself.

I'll keep working to help you as I have time today. I don't really know why the problem is happening though.

Re: calling panel & function from the previous script [Re: Logan] #357667
02/08/11 00:32
02/08/11 00:32
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
Everything is fine when i first run the code. all panels are correct, showing where they should be shown @ the right time @ the right place. But in my game, i wanted it to go back to the menu when the game is over. So, i tried to include the menu code because the function for the menu is there which is the "logoscreen". frown


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

Gamestudio download | 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