if i do that and when i run the program, the buttons won't work and the "script.c" level is overlapped by the menu. frown

here is my menu code:
Code:
#include <acknex.h>
#include <default.c>
//#include "level2code.c"

//

////////////////////////////////////////////////////////////////////
var speed = 50;

BMAP* mouse_pcx = "mouse.pcx"; // bitmap used for the mouse pointer

///////////////////////////////////////////////////////////

function main()
{
//video_screen = 1;
  screen_size.x = 800;
  screen_size.y = 600;
  mouse_map = mouse_pcx;
  mouse_mode = 4;
}

PANEL* main_pan =
{
	layer = 30;
	bmap = "pacmantittle2.jpg";
 	pos_x = -90;     
 	pos_y = 0; 
 	button (390, 250, "player_OVER.pcx", "player_OUT.pcx", "player_OVER.pcx", load_program, NULL, NULL);      
 	button (400, 290, "lan_OVER.pcx", "lan_OUT.pcx", "lan_OVER.pcx", load_program, NULL, NULL);      
 	button (380, 330, "instructions_OVER.pcx", "instructions_OUT.pcx", "instructions_OVER.pcx", instruction_program, NULL, NULL);      
 	button (395, 370, "settings_OVER.pcx", "settings_OUT.pcx", "settings_OVER.pcx", exit_program, NULL, NULL);      
 	button (390, 410, "about_OVER.pcx", "about_OUT.pcx", "about_OVER.pcx", exit_program, NULL, NULL);      
 	button (395, 450, "exit_OVER.pcx", "exit_OUT.pcx", "exit_OVER.pcx", exit_program, NULL, NULL);      
	flags = OVERLAY | SHOW;
}
//////////////////////////////////////////////
////////////////////////////////////////////////////////

function instruction_program()
{
	while (key_any) {wait (1);}
	level_load("instruct.c");
		main_pan.flags &= ~SHOW;
   //sys_exit(main_pan);
	
}

#include "choosechar.c"

function load_program()
{
	while (key_any) {wait (1);}
	level_load("choosechar.c");
	main_pan.flags &= ~SHOW;
	
   //sys_exit(main_pan);
}

function exit_program()
{
	while (key_any) {wait (1);}
	
	sys_exit(NULL);
}


//////////////////////////////////////////////////////////////////////




and here is the choose character code:
Code:
////////////////////////////////////////////////////////////////////

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



/////////////////////////////////////////////////////////////////////

FONT* arial_font = "Arial#20";

/////////////////////////////////////////////////////////////////////

var i = 0; // used as an index
var active_agents = 0; // removes the old agent models that aren't used anymore

/////////////////////////////////////////////////////////////////////

STRING* name_str = "#30"; // used to display the name of the agent, holds up to 30 characters

/////////////////////////////////////////////////////////////////////

TEXT* models_txt =
{
	strings = 100; // store up to 100 model names
}

PANEL* output_pan =
{	
	digits (120, 120, "Character name: %s ", arial_font, 1, name_str);
	flags = SHOW;
}


//////////////////////////////////////////////////////////////////////


typedef struct {
	STRING* name;
	ENTITY* agent_model;
} AGENTS;

AGENTS* taskforces[100];

function rotate_agent()
{
	while (active_agents)
	{
		my.pan += 4 * time_step;
		wait (1);	
	}	
	ent_remove(my); // remove the agent model when it isn't needed anymore
}

function create_agent(STRING *agent_name) 
{
   AGENTS* temp_agent = malloc(sizeof(AGENTS)); // create a new agent
   temp_agent.name = str_create(agent_name); // create the string that holds the agent's name
  	temp_agent.agent_model = ent_create(agent_name, vector(130, 0, -10), rotate_agent); // create the agent model
	str_trunc(temp_agent.name, 4); // now cut its name tail (.mdl) because we don't want to display it
   return temp_agent; // returns the address of the struct for further use (might be needed in the future)
}

function main() 
{
	var counter = 0;
	level_load (NULL);
	int j;
	for(j = 0; j < 100; j++)
		taskforces[j] = malloc(sizeof(AGENTS));
	txt_for_dir(models_txt, "*.mdl"); // loads the model names
	while (str_len((models_txt.pstring)[i]) > 0) // the name of the string contains something useful? (a model name)
	{
		i++;
	}
	i--; // set the proper index (i was incremented once more before we got out of the loop)
	// i stores the total number of agent models in the project folder here
	while (1)
	{
		active_agents = 0; // remove the previous agent model
		wait (2); // give it enough time to be removed
		active_agents = 1; // keep the new agent alive
  		taskforces[i] = create_agent((models_txt.pstring)[counter]);
		str_cpy(name_str, taskforces[i].name);
		while (!key_cud && !key_cuu) {wait (1);}
		counter += key_cud - key_cuu;
		counter = clamp(counter, 0, i);
		while (key_cud || key_cuu) {wait (1);}
	}
}


////////////
///////////////////////////
PANEL* menu=
{
	button (600, 500, "player_OVER.pcx", "player_OUT.pcx", "player_OVER.pcx", load_program, NULL, NULL);      
	flags = OVERLAY | SHOW;
}
/////////////////////////////////////////////////////////////////////

function load_program()
{
	while (key_any) {wait (1);}
	level_load("level2maze.wmb");
	menu.flags &= ~SHOW;
	
   //sys_exit(main_pan);
}




thanks!


Last edited by carla_mariz; 12/01/10 08:32.