Skip to content

TE_TEXTMESSAGE

wootguy edited this page Nov 29, 2025 · 3 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
const char* test Text to display (max 512 characters)
uint8_t channel Text Channel (only 0-3 are valid?)
uint16_t x X position on screen. -1 should center but doesn't for some reason (yes, I've tried 65535 and int16)
uint16_t y Y position on screen. -1 should center but doesn't for some reason (yes, I've tried 65535 and int16)
uint8_t effect Possible effects: 0 : fade in/out 1 : flickery credits 2 : Scan in (write char by char)
RGBA textRGBA RGBA of the text
RGBA effectRGBA Text RGBA during effect animation
uint16_t fadeInTime Time to fade in
uint16_t fadeOutTime Time to fade in
uint16_t fadeInTime Time to fade out
uint16_t holdTime Time to display text after the initial animation/fade in
uint16_t scanTime Time between character prints when effect is "2"

Example Usage

void te_textmessage(const char* text, uint8_t channel=1, uint16_t x=4000, uint16_t y=4000, uint8_t effect=2,
    RGBA textRGBA=WHITE, RGBA effectRGBA=PURPLE, uint16_t fadeInTime=16, 
    uint16_t fadeOutTime=16, uint16_t holdTime=300, uint16_t scanTime=20,
    int msgType=MSG_BROADCAST, edict_t* dest=NULL)
{
    MESSAGE_BEGIN(msgType, SVC_TEMPENTITY, dest);
    WRITE_BYTE(TE_TEXTMESSAGE);
    WRITE_BYTE(channel);
    WRITE_SHORT(x);
    WRITE_SHORT(y);
    WRITE_BYTE(effect);
    WRITE_BYTE(textRGBA.r);
    WRITE_BYTE(textRGBA.g);
    WRITE_BYTE(textRGBA.b);
    WRITE_BYTE(textRGBA.a);
    WRITE_BYTE(effectRGBA.r);
    WRITE_BYTE(effectRGBA.g);
    WRITE_BYTE(effectRGBA.b);
    WRITE_BYTE(effectRGBA.a);
    WRITE_SHORT(fadeInTime);
    WRITE_SHORT(fadeOutTime);
    WRITE_SHORT(holdTime);
    if (effect == 2 and scanTime > 0) 
        WRITE_SHORT(scanTime);
    WRITE_STRING(text);
    MESSAGE_END();
}

Clone this wiki locally