Skip to content

TE_TEXTMESSAGE

GeckoN edited this page Jul 16, 2017 · 6 revisions

Basically just a game_text. Don't bother using the NetworkMessage version as the API function has the same power and can center text properly.

Parameters

Type Name Description
string test Text to display (max 512 characters)
uint8 channel Text Channel (only 0-3 are valid?)
int16 x X position on screen.
Expects signed 16-bit fixed-point number with scale 1<<13.
Range: 0.0 ... 1.0; -1: center
int16 y Y position on screen.
Expects signed 16-bit fixed-point number with scale 1<<13.
Range: 0.0 ... 1.0; -1: center
uint8 effect Possible effects:
0 : fade in/out
1 : flickery credits
2 : Scan in (write char by char)
Color textColor Color of the text
Color effectColor Text color during effect animation
uint16 fadeInTime Time to fade in.
Expects unsigned 16-bit fixed-point number with scale 1<<8.
uint16 fadeOutTime Time to fade out.
Expects unsigned 16-bit fixed-point number with scale 1<<8.
uint16 holdTime Time to display text after the initial animation/fade in.
Expects unsigned 16-bit fixed-point number with scale 1<<8.
uint16 scanTime Time between character prints when effect is set to "2".
Expects unsigned 16-bit fixed-point number with scale 1<<8.

See the sample script for floating-point to fixed-point conversion functions.

API Function

void CPlayerFuncs::HudMessage(CBasePlayer@ pTargetPlayer, const HUDTextParams& in textParams, const string& in szMessage)
void CPlayerFuncs::HudMessageAll(const HUDTextParams& in textParams, const string& in szMessage)

NetworkMessage Function

void te_textmessage(string text, uint8 channel=1, float x=1, float y=-1,
	uint8 effect=0, Color textColor=WHITE, Color effectColor=PURPLE,
	float fadeInTime=1.5, float fadeOutTime=0.5, float holdTime=1.2, float scanTime=0.25,
	NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
	NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
	m.WriteByte(TE_TEXTMESSAGE);
	m.WriteByte(channel);
	m.WriteShort(FixedSigned16(x,1<<13));
	m.WriteShort(FixedSigned16(y,1<<13));
	m.WriteByte(effect);
	m.WriteByte(textColor.r);
	m.WriteByte(textColor.g);
	m.WriteByte(textColor.b);
	m.WriteByte(textColor.a);
	m.WriteByte(effectColor.r);
	m.WriteByte(effectColor.g);
	m.WriteByte(effectColor.b);
	m.WriteByte(effectColor.a);
	m.WriteShort(FixedUnsigned16(fadeInTime,1<<8));
	m.WriteShort(FixedUnsigned16(fadeOutTime,1<<8));
	m.WriteShort(FixedUnsigned16(holdTime,1<<8));
	if (effect == 2) 
		m.WriteShort(FixedUnsigned16(scanTime,1<<8));
	m.WriteString(text);
	m.End();
}
Clone this wiki locally