Chat support for characters: Ä, ä, Ö and ö ?


(nunk) #1

Hey,

Few years ago i played at a server where those characters worked. I didn’t find the server anymore for ripping the pk3 files :D.

In Finland we use those letters a lot and its stupid to replace them with A or O…

If i say “hyvää päivää” it will look like this “hyv… p.i…”. It means “good day”.
I tried to change the chat font to Tahoma what has all those letters but it didnt help.

So what file i have to modify? Does ET block foreign characters?

My server is using the TC:E mod what is not open source so i cannot edit cgame_mp_x86.dll or ui_mp_x86.dll.

Ä, ä, Ö and ö… i need them for talking…

This is the code what “says” in the game:

void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) {
	int			j;
	gentity_t	*other;
	int			color;
	char		name[64];
	// don't let text be too long for malicious reasons
	char		text[MAX_SAY_TEXT];
	qboolean	localize = qfalse;
	char		*loc;

	switch ( mode ) {
	default:
	case SAY_ALL:
		G_LogPrintf( "say: %s: %s
", ent->client->pers.netname, chatText );
		Com_sprintf (name, sizeof(name), "%s%c%c: ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
		color = COLOR_GREEN;
		break;
	case SAY_BUDDY:
		localize = qtrue;
		G_LogPrintf( "saybuddy: %s: %s
", ent->client->pers.netname, chatText );
		loc = BG_GetLocationString( ent->r.currentOrigin );
		Com_sprintf (name, sizeof(name), "[lof](%s%c%c) (%s): ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, loc);
		color = COLOR_YELLOW;
		break;
	case SAY_TEAM:
		localize = qtrue;
		G_LogPrintf( "sayteam: %s: %s
", ent->client->pers.netname, chatText );
		loc = BG_GetLocationString( ent->r.currentOrigin );
		Com_sprintf (name, sizeof(name), "[lof](%s%c%c) (%s): ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, loc);
		color = COLOR_CYAN;
		break;
	case SAY_TEAMNL:
		G_LogPrintf( "sayteamnl: %s: %s
", ent->client->pers.netname, chatText );
		Com_sprintf (name, sizeof(name), "(%s^7): ", ent->client->pers.netname);
		color = COLOR_CYAN;
		break;
	}

	Q_strncpyz( text, chatText, sizeof(text) );

	if ( target ) {
		if( !COM_BitCheck( target->client->sess.ignoreClients, ent - g_entities ) ) {
			G_SayTo( ent, target, mode, color, name, text, localize );
		}
		return;
	}

	// echo the text to the console
	if ( g_dedicated.integer ) {
		G_Printf( "%s%s
", name, text);
	}

	// send it to all the apropriate clients
	for(j=0; j<level.numConnectedClients; j++) {
		other = &g_entities[level.sortedClients[j]];
		if( !COM_BitCheck( other->client->sess.ignoreClients, ent - g_entities ) ) {
			G_SayTo( ent, other, mode, color, name, text, localize );
		}
	}
}

And this is the one what calls it:

void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 )
{
	if(trap_Argc() < 2 && !arg0) return;
	G_Say(ent, NULL, mode, ConcatArgs(((arg0) ? 0 : 1)));
}


(valkyr) #2

You can use

=<hex#>

to get access to the entire ASCII table of characters (on the console at least)

=e4

is ä for example.


(nunk) #3

Is it possible to make a server-side script what auto-replaces the characters to those?

I think i didn’t even fully understand what you said…


(valkyr) #4

In the game console type

=e4

and press enter. It shows up “ä”

“e4” is a hexadecimal number which represents an ASCII character (all the characters allowed in the game).

Here’s a converter

Type the character you need into the ASCII box, then “translate” and you get the hex number.

ASCII : ä > translate > E4


(nunk) #5

Hey,

I typed =e4 in the console and hitted enter and it showed up =e4.

Are you talking about ET? :smiley:


(valkyr) #6

Oh yeah, or you can use a shortcut on Windows…

ALT + 0228
(Numpad numbers) is “ä” as well.

Look for the “Character Map” application on your Start Menu > Accessories and it tells you the shortcut (and hex) codes for each character.


(valkyr) #7

[QUOTE=nunk;212385]Hey,

I typed =e4 in the console and hitted enter and it showed up =e4.

Are you talking about ET? :D[/QUOTE]

Ah… I forgot that it’s ET Pro only (I guess you’re not using ET Pro)

Maybe the short-cut method above will work…


(nunk) #8

LOL! :mad:

My keyboard is finnish. I got a button for Ä and Ö. The problem was that they show up as: .

So ÄÄÄÄ will be … if i say it in the game. Read the 1st post again, please…


(Nail) #9

afaik, extended ascii is only supported in latest ETPro


(valkyr) #10

[QUOTE=nunk;212388]LOL! :mad:

My keyboard is finnish. I got a button for Ä and Ö. The problem was that they show up as: .

So ÄÄÄÄ will be … if i say it in the game. Read the 1st post again, please…[/QUOTE]

I know that. I forgot that it was ET Pro that added the =codes support though.

You could maybe ask on their IRC channel how they did it…


(nunk) #11

But if etpro has done those in the dll files i cant do anythng… Coz as i said tce is not open source.

I download etpro and check the pk3 files->

EDIT: yeah they have done it in the dll files…

Wtf did they do at the tce 0.46 server few years ago…! ä ö always appeared right.


(Cambodunum) #12

afaik, extended ascii is only supported in latest ETPro

… and EtPub


(nunk) #13

HMm maybe its possible with this? http://web.archive.org/web/20080111063751/http://qmm.planetquake.gamespy.com/


(valkyr) #14

That would depend on whether it’s the server or the client that’s causing it.

I’m actually working with QMM at the moment so gave it a quick test…

A basic attempt at sending a “print” command to the server with a hex code :

"print \"\xE4\""

Still returned “.”

The ETPub source code is available though…


(valkyr) #15

Looks like it might be client-side… I’ve managed to get the server to print the characters to the console…


(nunk) #16

EDIT2:
I found this cvar for allowing extended names: pb_sv_ExtChar 0
Is there a similar one for chat text? :smiley:


Thanks for replies!

At the 1st post i sent the code of sending messages… i don’t fully understand C though… Did i forget the server part code?

About etpub: Yes the source is open but… to run TCE i need the original DLL files. Its not possible to patch or edit them to add parts of etpub source. BUT i check how did they do it =)

Etpro has done it in the dll files. Its not open source but i know because there was nothing about ascii things or anything in the other files inside the pk3 =D

EDIT:
I checked the etPub source.

What is this “sintable”? http://trac2.assembla.com/etpub/browser/trunk/src/game/etpro_mdx_lut.h

ETPUB saying codes:

void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) {
	int			j;
	gentity_t	*other;
	int			color;
	char		name[64];
	// don't let text be too long for malicious reasons
	char		text[MAX_SAY_TEXT];
	char		censoredText[MAX_SAY_TEXT];
	qboolean	localize = qfalse;
	char		*loc;
	char		*shortcuts;

	Q_strncpyz( text, chatText, sizeof(text) );
	if ((g_censor.string[0] || g_censorNeil.integer) &&
			!(G_shrubbot_permission(ent,SBF_NOCENSORFLOOD))) {
		SanitizeString(text, censoredText, qtrue);
		if (G_CensorText(censoredText,&censorDictionary)) {
			// like shrub, if the text is censored, 
			// it becomes colorless
			Q_strncpyz( text, censoredText, sizeof(text) );
			G_CensorPenalize(ent);
		}
	}

	if(g_shortcuts.integer) {
		shortcuts = G_Shortcuts(ent, text);
		Q_strncpyz(text, shortcuts, sizeof(text));
	}

	switch ( mode ) {
	default:
	case SAY_ALL:
		G_LogPrintf( "say: %s: %s
", ent->client->pers.netname, text );
		Com_sprintf (name, sizeof(name), "%s%c%c: ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
		color = COLOR_GREEN;
		break;
	case SAY_BUDDY:
		localize = qtrue;
		G_LogPrintf( "saybuddy: %s: %s
", ent->client->pers.netname, text );
		loc = BG_GetLocationString( ent->r.currentOrigin );
		Com_sprintf (name, sizeof(name), "[lof](%s%c%c) %c%c(%s)%c%c: ", ent->client->pers.netname,
			Q_COLOR_ESCAPE, COLOR_WHITE, Q_COLOR_ESCAPE, COLOR_YELLOW, loc, Q_COLOR_ESCAPE, COLOR_WHITE);
		color = COLOR_YELLOW;
		break;
	case SAY_TEAM:
		localize = qtrue;
		G_LogPrintf( "sayteam: %s: %s
", ent->client->pers.netname, text );
		loc = BG_GetLocationString( ent->r.currentOrigin );
		Com_sprintf (name, sizeof(name), "[lof](%s%c%c) %c%c(%s)%c%c: ", ent->client->pers.netname,
			Q_COLOR_ESCAPE, COLOR_WHITE, Q_COLOR_ESCAPE, COLOR_YELLOW, loc, Q_COLOR_ESCAPE, COLOR_WHITE);
		color = COLOR_CYAN;
		break;
	case SAY_TEAMNL:
		G_LogPrintf( "sayteamnl: %s: %s
", ent->client->pers.netname, text );
		Com_sprintf (name, sizeof(name), "(%s^7): ", ent->client->pers.netname);
		color = COLOR_CYAN;
		break;
	}


	if ( target ) {
		if( !COM_BitCheck( target->client->sess.ignoreClients, ent - g_entities ) ) {
			G_SayTo( ent, target, mode, color, name, text, localize );
		}
		return;
	}

	// echo the text to the console
	if ( g_dedicated.integer ) {
		G_Printf( "%s%s
", name, text);
	}

//#ifndef WIN32
	// josh: post the text to an http chat listener
	// don't use this until it's threaded
	//if (g_httpPostURL_chat.string[0]) {
	//	g_httpinfo_t *post_info = (g_httpinfo_t *)malloc(sizeof(g_httpinfo_t)); 
	//	char *message = va("%s%s
",name,text);
	//	Q_strncpyz( post_info->url, g_httpPostURL_chat.string, sizeof(post_info->url) );
	//	Q_strncpyz( post_info->message, message, sizeof(post_info->message) );
	//	create_thread(libhttpc_post,(void*)post_info);
	//}
//#endif
	

	// send it to all the apropriate clients
	for(j=0; j<level.numConnectedClients; j++) {
		other = &g_entities[level.sortedClients[j]];
		// tjw: move this to G_SayTo()
		//if( !COM_BitCheck( other->client->sess.ignoreClients, ent - g_entities ) ) {
		//	G_SayTo( ent, other, mode, color, name, text, localize );
		//}
		G_SayTo( ent, other, mode, color, name, text, localize );
	}

	G_shrubbot_cmd_check(ent);
}


/*
==================
Cmd_Say_f
==================
*/
void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 )
{
	char *args;

	if(trap_Argc() < 2 && !arg0) return;
	args = Q_SayConcatArgs(0);
	if(g_privateMessages.integer) {
		if(!Q_stricmpn(args, "say /m ", 7) ||
		   !Q_stricmpn(args, "say_team /m ", 12) ||
		   !Q_stricmpn(args, "say_buddy /m ", 13) || 
		   !Q_stricmpn(args, "say /mt ", 8) ||
		   !Q_stricmpn(args, "say_team /mt ", 13) ||
		   !Q_stricmpn(args, "say_buddy /mt ", 14)) {

			G_PrivateMessage(ent);
			return;
		} 
	}
	if(!Q_stricmpn(args, "say /ma ", 8) ||
		!Q_stricmpn(args, "say_team /ma ", 13) ||
		!Q_stricmpn(args, "say_buddy /ma ", 14)){
		G_AdminChat(ent);
		return;
	}
	
	G_Say(ent, NULL, mode, ConcatArgs(((arg0) ? 0 : 1)));
}