Adding New Menu ITEMS


(NSA|MaJoR) #1

Ok thats what I want to add.

In the ingame Menu there should be a new item called “Bot Info”.

therefor i edited the “ingame_main.menu” file.


#include "ui/menudef.h"

// Defines //

#define WINDOW_X                30
#define WINDOW_Y		30
//#define WINDOW_WIDTH	128
#define WINDOW_WIDTH	160
#define WINDOW_HEIGHT	175
#define GROUP_NAME		"grpIngameMain"

// Macros //

#include "ui/menumacros.h"

// Main Menu //

menuDef {
	name		"ingame_main"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED
  
	onOpen {
		// ydnar
		conditionalscript ROldModeCheck 2
			( "clearFocus ; open vid_confirm" )
			( "clearFocus" )
	}
	
	onEsc {
		close ingame_main ;
	}

// Window //

	WINDOW( "MAIN", 50 )
	
// Buttons //

	BUTTONEXT( 6, 32, WINDOW_WIDTH-12, 18, "VOTE MENU", .3, 14, uiScript clientCheckVote ;
															conditionalScript cg_ui_novote 0
																( "clearFocus ; open ingame_votedisabled" )
																( "close ingame_main ; open ingame_vote" ),
															cvarTest "authLevel" showCVar { RL_NONE } )
	BUTTONEXT( 6, 32, WINDOW_WIDTH-12, 18, "REFEREE MENU", .3, 14, close ingame_main ; open ingame_vote, cvarTest "authLevel" showCVar { RL_REFEREE } )
	BUTTONEXT( 6, 32, WINDOW_WIDTH-12, 18, "ADMIN MENU", .3, 14, close ingame_main ; open ingame_vote, cvarTest "authLevel" showCVar { RL_RCON } )
	BUTTON( 6, 56, WINDOW_WIDTH-12, 18, "SERVER INFO", .3, 14, clearFocus ; open ingame_serverinfo )
	BUTTON( 6, 80, WINDOW_WIDTH-12, 18, "OPTIONS", .3, 14, close ingame_main ; open options )
	BUTTON( 6, 104, WINDOW_WIDTH-12, 18, "DISCONNECT", .3, 14, clearFocus ; open ingame_disconnect )
        BUTTON( 6, 128, WINDOW_WIDTH-12, 18, "BOT INFO", .3, 14, clearFocus ; open bot )
        BUTTON( 6, 146, WINDOW_WIDTH-12, 18, "EXIT GAME", .3, 14, clearFocus ; open quit )
}

and added a new Page “bot.menu” in the “ui” folder


#include "ui/menudef.h"

// Defines //

#define WINDOW_X		0
#define WINDOW_Y		0
#define WINDOW_WIDTH	640
#define WINDOW_HEIGHT	480
#define GROUP_NAME		"grpIngameMain"

// Macros //

#include "ui/menumacros.h"
		
// Disconnect Menu //
	
menuDef {
	name		"bot"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED
	popup
	
	fadeClamp	0.5
	fadeAmount  0.075
	
	onOpen {
                playlooped "sound/music/menu_server.wav"
		setitemcolor background backcolor 0 0 0 0 ;
		fadein background
	}
	
	onESC {
		close ingame_bot ;
		open ingame_main
	}
	
// Background //

	itemDef {
		name		"background"
		rect		0 0 640 480
		style		WINDOW_STYLE_FILLED
		background	"ui/assets/fadebox.tga"
		backcolor	0 0 0 0
		visible		1
		decoration
	}

// Subwindows //

#define SUBWINDOW_WIDTH		192
#define SUBWINDOW_HEIGHT	80
#define SUBWINDOW_X			.5*(WINDOW_WIDTH-SUBWINDOW_WIDTH)
#define SUBWINDOW_Y			.5*(WINDOW_HEIGHT-SUBWINDOW_HEIGHT)

	SUBWINDOWBLACK( SUBWINDOW_X, SUBWINDOW_Y, SUBWINDOW_WIDTH, SUBWINDOW_HEIGHT, "BOT" )
	LABEL( SUBWINDOW_X+2, SUBWINDOW_Y+16, (SUBWINDOW_WIDTH)-4, 10, "Server Bot Menu", .2, ITEM_ALIGN_CENTER, .5*((SUBWINDOW_WIDTH)-4), 8 )
        LABEL( SUBWINDOW_X+2, SUBWINDOW_Y+28, (SUBWINDOW_WIDTH)-4, 10, " ", .2, ITEM_ALIGN_LEFT, .5*((SUBWINDOW_WIDTH)-4), 8 )
        LABEL( SUBWINDOW_X+2, SUBWINDOW_Y+46, (SUBWINDOW_WIDTH)-4, 10, "Test test test test", .2, ITEM_ALIGN_LEFT, .5*((SUBWINDOW_WIDTH)-4), 8 )
	
//	BUTTON( SUBWINDOW_X+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, "YES", .3, 14, close ingame_disconnect ; close main ; uiScript leave )
	BUTTON( SUBWINDOW_X+6+.5*(SUBWINDOW_WIDTH-18)+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, "ZURUECK", .3, 14, close bot ; open ingame_main )
}

Also edited the menus.txt and loaded this new page.


// menu defs
// 
{	
	loadMenu { "ui/global.menu" }	
	loadMenu { "ui/main.menu" }
	loadMenu { "ui/profile.menu" }
	loadMenu { "ui/profile_create.menu" }
	loadMenu { "ui/profile_create_initial.menu" }
	loadMenu { "ui/profile_rename.menu" }
	loadMenu { "ui/profile_delete.menu" }
	loadMenu { "ui/profile_delete_error.menu" }
	loadMenu { "ui/profile_create_error.menu" }
	loadMenu { "ui/playonline.menu" }
	loadMenu { "ui/playonline_connecttoip.menu" }
	loadMenu { "ui/playonline_serverinfo.menu" }
	loadMenu { "ui/playonline_disablepb.menu" }
	loadMenu { "ui/playonline_enablepb.menu" }
	loadMenu { "ui/hostgame.menu" }
	loadMenu { "ui/hostgame_advanced.menu" }
	loadMenu { "ui/hostgame_advanced_default.menu" }
	loadMenu { "ui/hostgame_dedicated_warning.menu" }
	loadMenu { "ui/viewreplay.menu" }
	loadMenu { "ui/viewreplay_delete.menu" }
	loadMenu { "ui/options.menu" }
	loadMenu { "ui/options_customise_game.menu" }
	loadMenu { "ui/options_customise_hud.menu" }
	loadMenu { "ui/options_controls.menu" }
	loadMenu { "ui/options_controls_default.menu" }
	loadMenu { "ui/options_system.menu" }
	loadMenu { "ui/options_system_gamma.menu" }
	loadMenu { "ui/credits_splashdamage.menu" }
	loadMenu { "ui/credits_idsoftware.menu" }
	loadMenu { "ui/credits_activision.menu" }
	loadMenu { "ui/credits_additional.menu" }
	loadMenu { "ui/credits_quit.menu" }
	loadMenu { "ui/quit.menu" }

	// popups
	loadMenu { "ui/popup_errormessage.menu" }
	loadMenu { "ui/popup_errormessage_pb.menu" }	
	loadMenu { "ui/popup_hostgameerrormessage.menu" }
	loadMenu { "ui/popup_autoupdate.menu" }
	loadMenu { "ui/popup_password.menu" }

	// video confirmation
	loadMenu { "ui/vid_restart.menu" }
	loadMenu { "ui/vid_confirm.menu" }
	loadMenu { "ui/rec_restart.menu" }

	// quickchats
	loadMenu { "ui/wm_quickmessage.menu" }
	loadMenu { "ui/wm_quickmessageAlt.menu" }
	loadMenu { "ui/wm_ftquickmessage.menu" }
	loadMenu { "ui/wm_ftquickmessageAlt.menu" }


	// Neue Seiten
        loadMenu { "ui/ingame_bot.menu" } // BOT
	loadMenu { "ui/ingame_vote_map_" }// User Menu
	// ingame
	loadMenu { "ui/ingame_main.menu" }
	loadMenu { "ui/ingame_vote.menu" }
	loadMenu { "ui/ingame_vote_disabled.menu" }
	loadMenu { "ui/ingame_vote_misc.menu" }
	loadMenu { "ui/ingame_vote_misc_refrcon.menu" }
	loadMenu { "ui/ingame_vote_map.menu" }
	loadMenu { "ui/ingame_vote_players.menu" }
	loadMenu { "ui/ingame_vote_players_warn.menu" }
	loadMenu { "ui/ingame_serverinfo.menu" }
	loadMenu { "ui/ingame_disconnect.menu" }
	loadMenu { "ui/ingame_messagemode.menu" }
	loadMenu { "ui/ingame_tapout.menu" }
	loadMenu { "ui/ingame_tapoutlms.menu" }
}

Ok the menu shows up in the Ingame menu, but when i click on it, nothing happens. The page just wont show up? Where is my error?

Ty 4 reading :slight_smile:


(Jaquboss) #2

look at the console what it writes … and you don´t need to put music to ingame menu , you will need to do more things for that …
simply clean bot.menu , because error is most probably there


(Lanz) #3

Just a typing error here in the forum?


(NSA|MaJoR) #4

Ok, here again, that is what i edited…

ingame_main.menu

BUTTON( 6, 128, WINDOW_WIDTH-12, 18, "BOT INFO", .3, 14, clearFocus ; open ingame_bot )

menus.txt

loadMenu { "ui/ingame_bot.menu" } 

can somebody now post me the content auf the new page

ingame_bot.menu

dont know why it wont show up.

ty


(nUllSkillZ) #5


and added a new Page “bot.menu” in the “ui” folder

I think that’s what Lanz mean.
In the other files the file is called “ingame_bot.menu”.
But if the file is named “bot.menu” this won’t work.


(NSA|MaJoR) #6

that was just a typing error…

hmm strange, made all the changes but in the MAIN MENU.

The Bot info button shows up and if i click on it the new menu shows up too. But why ´does this not work in the ingame menu?

strange :confused:


(bacon) #7

I believe you have to put it below ui/ingame_main.menu for it to work correctly in ingame.


(NSA|MaJoR) #8

OK now i got it…

ETPRO :confused:

there was a new file which had to be edited…

thnx 4 all ur advise…