hudmessagebold

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

hudmessagebold

Post by Scarekrowe »

At Wiki it tells you how to make a message so it'll stay on the screen longer then PrintBold. I think I pretty much understand it but it says the Int Type and there are three types. What are the three types? Also if anyone could just give me a basic example of a message in the center of the screen that stays up for... I dunno.. three seconds, that'd help me just to check mine. Thanks
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

You can fully control the timing using HudMessage and HudMessageBold. Those pages should tell you all you need to know.
User avatar
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

Post by Scarekrowe »

Yeah, I know, that was the link I posted. I'm asking what are the three text types? At "int type", what goes here?
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

For those of us who have trouble finding information on 2.5 pages:
Wiki wrote:For type 1:
..., fixed fadetime);

Fadetime is the time, in seconds, that the message takes to fade out after its holdtime is up.

For type 2:
..., fixed typetime, fixed fadetime);

Typetime is the time, in seconds, that it takes each character of the message to appear on the screen. After every character has been "typed," the message waits for holdtime seconds and then fades out for fadetime seconds.

If you want to use these two internal functions, here are some useful #defines:
...
#define HUDMSG_NORMAL 0
#define HUDMSG_FADEOUT 1
#define HUDMSG_TYPEON 2
User avatar
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

Post by Scarekrowe »

What am I doing wrong? I can't get it to compile. Here's my script
{
hudmessagebold(test;0, 0, red, (1.5,0.5), (1.5,0.5), 5);
}
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

Scarekrowe wrote:What am I doing wrong? I can't get it to compile. Here's my script
{
hudmessagebold(test;0, 0, red, (1.5,0.5), (1.5,0.5), 5);
}
Here are a few possibilities:

1. "test" is not defined
2. Print type before the string is missing (probably "s:" in this case)
3. "red" is not defined (you probably meant "CR_RED")
4. I don't know what you are trying to do, but (1.5, 0.5) is invalid
User avatar
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

Post by Scarekrowe »

I really don't get this.
script 9 (VOID)
{
hudmessagebold(s:;0,0,CR_RED,(1.5,0.5), 5, test);
}
Basically what I want is a red message in the middle of the screen that says "test" If I can just figure out how to do that, I can understand the rest.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Code: Select all

HudMessageBold(s:"Test"; 0, 0, CR_RED, 1.5, 0.5, 5.0);
Breaking it down:

s:"Test"; is the first argument. The s: signifies to ACC to expect a string to print to the screen. (A string in programming terms is a sequence of letters/numbers/other symbols enclosed in quotation marks.) "Test" is the actual string to print. (The quotation marks will not be printed). The semicolon separates the first argument from the rest of the function. This is important because if a comma was used, ACC would expect that more data would be specified for printing. For example, this:

s:"You have ", i:Lives, s:" lives left."; would print "You have X lives left", where X would be replaced by whatever the current value of Lives is.

Next is the message type. There are three types:

0 - The message instantly appears, and instantly disappears after the delay is up.
1 - The message instantly appears, but then fades out after the delay is up.
2 - The message is typed to the screen, and then fades out after the delay is up.

Our message is type 0 -- instantly appear, instantly disappear.

Next is the message ID. This can be useful if you want to manually clear a message, or replace a message with another one later. In this case, we specify 0, which means no ID. We will not be able to act on this message later.

Next is the color. There are several colors defined for convenience. CR_RED is a nice light red color that is easy to see and is very Doomish.

The next two arguments can be tricky at first. The first is the X coordinate to position the message at. The second is the Y coordinate. They become complicated, however, because each argument also controls whether the position is being done on the actual screen (the whole screen is available) or just within the valid view area (the status bar cannot be written over, and if the screen is not at full size, the outside edges cannot be written over). The X argument also controls whether the text is centered at that location, or is left-aligned. Here are the values:

X and Y:

0.0 - 1.0: Inside valid view area, left-aligned (for X only)
-1.0 - 0.0: Entire screen, left-aligned (for X only).

X only:

1.0 - 2.0: Inside valid view area, centered.
-2.0 - -1.0: Entire screen, centered.

The value of 1.5 for X here means we're going to display the message centered at the center of the view area. The 0.5 for Y positions it exactly half-way down the view area.

The final argument (for us anyway) is the time, in seconds, for the message to remain on the screen before disappearing. A time of 0 would mean the message would stay forever. (Or until removed with a subsequent HudMessage using the same message ID) Here it will stay for 5 seconds and then vanished.

If we had used message type 1, this argument would specify how long the message stays solid, and an additional argument would control how long it takes to fade out. (0 = no fade, just as if we'd used message type 0)

If we had used message type 2, this argument would specify the hold time (as above), the next argument would specify how long it takes to type each character of the message, and an additional argument would specify the fade time (0 = no fade, so you can have the message type on but vanish instantly if you want).

[Edit]Corrected description of time fields; specify them in seconds, not in TICs.
Last edited by HotWax on Wed Aug 04, 2004 9:14 am, edited 1 time in total.
User avatar
Enjay
 
 
Posts: 26976
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

This may also help. It's something Tarin/Boris posted a long time ago. It helped me with HUD messages.

Tarin's HUDMESSAGE instructions.

hudmessage(string; type, id, color, x-coord, y-coord, time [, speed] [, fadetime]);

string is the displayed text (like s:"hello world"). You can concatenate several
strings by seperating them with commas (like s:"hello ", s:"world"). Note that you
have to add a semi-colon (';') after the last string).

type defines how the text is "written" onto the screen. It can be 0 (displayed as
with print), 1 (text fades) or 2 (letters are written after each other). Or just
use the defines listed below.

id is a unique number for the hudmessage. So you can have several different messages
at the same time and they will still work fine without interfering with each other.

color is the color (duh) of the text. Can be 0 to 10. The possible colours are listed
below.

x-coord and y-coord are the position of the text relative to the screen border.

0.0/0.0 is the top left edge of the screen,

1.0/1.0 is the bottom right edge of the screen.

So if you wanted a text to be displayed in the center you'd use

0.5/0.5 for x and y coords. Using negative number will change how the text is aligned,
but I'm not sure how that works.

time simply says how long (in seconds) the text will be displayed.
Use 0 to display it forever.

speed is optional. It defines how long it takes (in seconds) to write a single letter.
0.05 seems to be a good value.

fadetime is optional too. It defines how long it takes (in seconds) the text
to completely fade.

Colours:

CR_UNTRANSLATED -1
CR_BRICK 0
CR_TAN 1
CR_GRAY 2
CR_GREY 2
CR_GREEN 3
CR_BROWN 4
CR_GOLD 5
CR_RED 6
CR_BLUE 7
CR_ORANGE 8
CR_WHITE 9
CR_YELLOW 10

Style

HUDMSG_PLAIN 0
HUDMSG_FADEOUT 1
HUDMSG_TYPEON 2


Additional info from Randy

If I remember correctly, a negative X coordinate will position the left edge of the message
and a negative Y coordinate will position the top edge of the message.





To get a hudmessage logged at the console:

The zdefs.acs that comes with ACC 1.28 has it

#defined as HUDMSG_LOG,

so now you can use HUDMSG_PLAIN | HUDMSG_LOG as your hud message type.


Also, you can go to my examples site and see a few additional examples of HUD messages in action. Go about half way down the page and look for "Examples of HUDMessage stuff in Zdoom"
Locked

Return to “Editing (Archive)”