Search function for finding players


(Chruker) #1

Hi

I’ve seen in the source code that there were a few UI functions to search for players, so I finally decided to try them out. They work 99.9999%, it is only missing a menu file, so I made one.

------ Edit -------
Here is my final version. I’ve added a new serverinfo window. Also the playonline.menu file is updated to make room for a ‘Find player’ button.
http://junk.chruker.dk/files/temp/f014_menu_files.zip
------ Edit -------

playonline_findplayer.menu

#include "ui/menudef.h"

// Defines //

#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	608
#define WINDOW_HEIGHT	448
#define GROUP_NAME		"grpPlayOnlineFindPlayer"

// Macros //

#include "ui/menumacros.h"
		
// Find Player Menu //
	
menuDef {
	name		"playonline_findplayer"
	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 {
		setitemcolor background backcolor 0 0 0 0 ;
		fadein background ;
		setEditFocus "efleftName:"
	}

	onESC {
		close playonline_findplayer ;
		open playonline
	}
	
// 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		512
#define SUBWINDOW_HEIGHT	320
#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, "FIND PLAYER" )
	
	SUBWINDOWBLACK( SUBWINDOW_X+6, SUBWINDOW_Y+14+6, SUBWINDOW_WIDTH-12, 48, "SEARCH CRITERIA" )
	
	SUBWINDOWBLACK( SUBWINDOW_X+6, SUBWINDOW_Y+14+6+48+6, SUBWINDOW_WIDTH-12, SUBWINDOW_HEIGHT-14-6-48-6-6-18-6, "RESULTS" )
	
	itemDef {
		name		"efleftbackFind Player:"
		group		GROUP_NAME
		rect		$evalfloat(SUBWINDOW_X+6+6+32) $evalfloat(SUBWINDOW_Y+14+6+14+2) $evalfloat(SUBWINDOW_WIDTH-24-32) $evalfloat(10)
		style		WINDOW_STYLE_FILLED
		backcolor	.5 .5 .5 .2
		visible		1
		decoration
	}

	EDITFIELDLEFT( SUBWINDOW_X+6+6, SUBWINDOW_Y+14+6+14+2, SUBWINDOW_WIDTH-24-32-6, 10, "Name:", .2, 8, "ui_findPlayer", 32, 25, "" )
	BUTTON( SUBWINDOW_X+6+6+.80*(SUBWINDOW_WIDTH-24), SUBWINDOW_Y+14+6+14+2+10+2, .20*(SUBWINDOW_WIDTH-24), 14, "SEARCH", .3, 11, uiScript FindPlayer )
	
	BUTTON( SUBWINDOW_X+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .33*(SUBWINDOW_WIDTH-18), 18, "BACK", .3, 14, close playonline_findplayer ; open playonline )
	BUTTON( SUBWINDOW_X+6+.33*(SUBWINDOW_WIDTH-18)+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .33*(SUBWINDOW_WIDTH-18), 18, "JOIN SERVER", .3, 14, uiScript FoundPlayerJoinServer )
	BUTTON( SUBWINDOW_X+6+.33*(SUBWINDOW_WIDTH-18)+6+.33*(SUBWINDOW_WIDTH-18)+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .33*(SUBWINDOW_WIDTH-18), 18, "SERVER INFO", .3, 14, uiScript FoundPlayerServerStatus ; clearFocus ; open playonline_serverinfo )



	// Server List
	itemDef {
		name			"playerList"
		group			GROUP_NAME
		rect			$evalfloat((SUBWINDOW_X)+6+6) $evalfloat(SUBWINDOW_Y+14+6+48+6+14+4) $evalfloat((SUBWINDOW_WIDTH)-24) $evalfloat(192)
		type			ITEM_TYPE_LISTBOX
		textfont		UI_FONT_COURBD_21
		textstyle		ITEM_TEXTSTYLE_SHADOWED
		textscale		.2
		textaligny		-3
		forecolor		.6 .6 .6 1
		outlinecolor	.5 .5 .5 .4
		feeder			FEEDER_FINDPLAYER
		elementtype		LISTBOX_TEXT
		elementwidth	$evalfloat((SUBWINDOW_WIDTH)-24)
		elementheight	12
		columns			1	0 100 39
		visible			1
		
		doubleClick {
			/*close playonline ;*/
			uiScript FoundPlayerJoinServer
		}
		
		onEnter {
			/*close playonline ;*/
			uiScript FoundPlayerJoinServer
		}
	}
}

You just need to make a button on your playonline.menu file which calls this menu file.

However there is a problem with my menu file. It keeps appearing above the serverinfo. Does the .menu system have an equipvalent of CSS alpha value?

If I just close the find player box, serverinfo uses the server selected on the normal server list.

Anyhoo, maybe the fix is to include an area for the serverinfo on my menu… but it is late now, I need sleep :slight_smile:

Ideally you would also want to add some more information to the output.

Like I said the functions in the SDK works. There was just a few status text that had been typed by someone without the use of the shift key :slight_smile:


(Jaquboss) #2

just look for this at etpro forum i dropped it there…


(Chruker) #3

This one I guess: http://bani.anime.net/banimod/forums/viewtopic.php?t=6151&highlight=search+player


(Jaquboss) #4

yeah


(Chruker) #5

I tried putting your pk3 into my etpro directory and into my etmain directory. I tried extracting the files to the etpro directory. Still I can’t find the menus. One of the server browser buttons should be replaced with the find player button, right?


(Chruker) #6

I don’t know if I wanna say this but it worked when I renamed the file from .zip to .pk3 :weird:


(Chruker) #7

Anyway, the way to fix the server info problem would be to create a special version of the menu for the find player function.

Still I would like to keep the search results open while displaying the serverinfo on top.


(Jaquboss) #8

hmm maybe remove closewindow in search window why looking into serverinfo


(Chruker) #9

Edited my first post to include the menu files in a zip file.