SCRMaps
/
Sign in

Putting values on screen

DisplayText for fixed text, f_eprintf for text with values in it.

6 min read

This is one of the main reasons people move to EUD. Classic triggers cannot print “level 12”; here you can.

DisplayText("...")Print fixed text. Colour and alignment codes go inside the string as before.
f_eprintf("...", args)Print with values interpolated; braces are the placeholders.
{}A number placeholder.
{:n}A player-name placeholder; pass CurrentPlayer.
function updateStatusLine(){
    var level = 0;
    if(level + 512 <= 1000 && Deaths(CurrentPlayer, AtLeast, level + 512, "Level")){ level = level + 512; }
    // ... 나머지 자릿수

    f_eprintf("\x19{:n} \x1D|\x04 \x07레벨: \x04{}", CurrentPlayer, level);
}
f_eprintf writes to the fixed line at the top of the screen. Calling it every cycle does not push messages off the way DisplayText would.

Calling DisplayText every cycle buries the screen. Use f_eprintf for status and DisplayText for events.

Every StringBuffer operation goes to CurrentPlayer alone - Display, printf and fadeInf all do. Call one outside a player loop, as in afterTriggerExec, and CurrentPlayer is whatever the last trigger left behind. This is exactly the “it shows on my screen and nobody else's” and “only player 1 sees it” bug.

setcurpl(getuserplayerid());        // 이 기계의 플레이어 / this machine’s player
HUD.printfAt(11, "골드 {}", gold);

foreach(p : EUDLoopPlayer()) {      // 내용이 사람마다 다를 때만 / only when the content differs
    FEED.printf("{:c}{:n} — {}", p, p, score[p]);
}
getuserplayerid() is whoever is sitting at that machine. When everyone sees the same line, this one call covers every machine without a loop - and without costing a trigger per player.

When you need to assemble a string from pieces, use the string buffer. Building a save code character by character is the usual case.

GetGlobalStringBuffer().delete(0, 1);
GetGlobalStringBuffer().append("\x13\x07");
GetGlobalStringBuffer().append("A");
GetGlobalStringBuffer().Display();
Clear with delete, build up with append, then Display.

A few of these are already written. There is a function for choosing which line to print on, and the left-to-right colour sweep is one call rather than a project.

Worth knowing about
DisplayTextAllAt(line, text)Prints to a chosen line, for everyone.
TextFX_FadeIn / FadeOut / RemoveSweeps colour across the text from left to right and back out. You can pass the set of colour codes and the interval.
SetPNamef(player, format, ...)Sets a player's name from a format string.
IsPName(player, name)A condition asking whether that player is called that. Look here before hand-rolling a nickname match out of byte comparisons.
PColor(player)That player's colour code, for building a line that matches them.
Sign in to track your progress