[ACS] HUDMessage in box size/limit?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] HUDMessage in box size/limit?

#1

Post by FranckyFox2468 » Sun Mar 12, 2017 3:46 am

Hey, its me again with another (hopefully) simple question. How do you limit a hudmessage to fit a certain size/box? Something like wolfendoom's hud? (I actually went to check wolfendoom and i still have no frigging clue how they made that work)

Basically my issue is that when a hude message display it takes the entire screen and only starts a new line once too many text has taken off the screen, what i would want is the text to start new lines/sentences to fit inside a dialogue box that appears when you do something or when a character talks to you for instance.

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

[ACS] Re: HUDMessage in box size/limit?

#2

Post by ZZYZX » Sun Mar 12, 2017 3:49 am

The way I know is https://zdoom.org/wiki/SetHudClipRect
Not sure if it works in Zandronum 2.x.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: HUDMessage in box size/limit?

#3

Post by FranckyFox2468 » Sun Mar 12, 2017 3:59 am

ZZYZX wrote:The way I know is https://zdoom.org/wiki/SetHudClipRect
Not sure if it works in Zandronum 2.x.
I'm working with 3.0 actually. But it doesn't seem to do jack shit. Unless im doing something wrong?
Here's my code:
SetHudClipRect(5, 5, 5, 5, 5);
HudMessage (s:"The Water in the gap... It's going up! Perhaps if we find more switches like this, we could swim across the gap!";HUDMSG_TYPEON, 5, CR_GOLD, 0.5,0.5, 1.0, 0.05, 0.2);
SetHudClipRect(0, 0, 0, 0, 0);
Delay(1);

User avatar
Kaminsky
Developer
Posts: 202
Joined: Sun Apr 14, 2013 7:17 pm
Location: Canada

[ACS] Re: HUDMessage in box size/limit?

#4

Post by Kaminsky » Sun Mar 12, 2017 7:55 am

For SetHudClipRect, the position, width and height of the box are relative to whatever width or height is specified using SetHudSize. I think that if the screen size isn't changed using this function, it will use the client's resolution instead, which might be the case in the example you provided.

For your code, I would suggest setting the size of the HUD then adjust the box so that it covers the parts of the message meant to be hidden.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: HUDMessage in box size/limit?

#5

Post by FranckyFox2468 » Sun Mar 12, 2017 4:56 pm

Dr.Robotnik wrote:For SetHudClipRect, the position, width and height of the box are relative to whatever width or height is specified using SetHudSize. I think that if the screen size isn't changed using this function, it will use the client's resolution instead, which might be the case in the example you provided.

For your code, I would suggest setting the size of the HUD then adjust the box so that it covers the parts of the message meant to be hidden.
Uh... you gonna have to help me with maybe an exemple cause i kinda have trouble following you. I'm kinda bad with ACS tbh...

User avatar
Kaminsky
Developer
Posts: 202
Joined: Sun Apr 14, 2013 7:17 pm
Location: Canada

[ACS] Re: HUDMessage in box size/limit?

#6

Post by Kaminsky » Sun Mar 12, 2017 6:02 pm

Try this example:

Code: Select all

#include "zcommon.acs"

SCRIPT 1 ENTER
{
    //Set the size of the HUD.
    SetHudSize(640, 480, TRUE);
    
    //Adjust the position and size of the clipping rectangle based on the width/height of the HUD.
    SetHudClipRect(160, 120, 320, 240, 0);
    
    //Draw first message, clipped.
    HudMessage(s:"Here's a message; some of it will be unseen if outside the clipping rectangle."; HUDMSG_PLAIN, 0, CR_RED, 320.0, 240.0, 0.0); 
    
    //Remove the clipping rectangle so future HUD messages aren't affected.
    SetHudClipRect(0, 0, 0, 0, 0);
    
    //Draw second message, unclipped.
    HudMessage(s:"Here's another message; this one should be entirely visible."; HUDMSG_PLAIN, 0, CR_WHITE, 320.0, 280.0, 0.0);
}
You might want to play around with the parameters of SetHudClipRect to see where the messages will not be drawn, but it also depends on whatever the size of the HUD is.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: HUDMessage in box size/limit?

#7

Post by FranckyFox2468 » Mon Mar 13, 2017 12:24 am

I'm gonna be a bit busy to do further ACS stuff this week but ill update if i get around something whenever i get around it...

Post Reply