[ZScript] Rwplicating ACS HudMessage functionality

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Virathas
Posts: 249
Joined: Thu Aug 10, 2017 9:38 am

[ZScript] Rwplicating ACS HudMessage functionality

Post by Virathas »

Hey all!

With my a bit annoying rewriting of ACS elements into ZScript, i have stumbled upon one feature that is not as easily remade: HudMessage. While the function to draw images with it is of no importance to me, the ability to display a text in the middle of the screen, with its contents logged into console is something i'd like to have in ZScript. The question is: How?
I think i could somehow send information to SBAR to draw the text (no idea how to do so in a good way though)

Currently i use A_Log to display the messages, however, it is not as visible.

BONUS QUESTION! One more function i'd like to have easily rewritten is FadeRange. "FadeRange (0, 0, 255, 0.4, 0, 0, 0, 0.0, 0.5);" was doing a simple short blue screen flash, and it would be good to have in zscript.
Jarewill
 
 
Posts: 1768
Joined: Sun Jul 21, 2019 8:54 am

Re: [ZScript] Rwplicating ACS HudMessage functionality

Post by Jarewill »

To answer the bonus question, there's A_SetBlend.

As for the actual question, the way I do it is pass information to the status bar and draw it there, which I think is a very hacky workaround and not the intended method.
What kind of string do you want to pass exactly? You could potentially record that string in a variable in the player's class and use it this way:

Code: Select all

let playe = PlayerClass(CPlayer.mo);
If(playe.stringvar){
	DrawString(...);
}
Replacing the PlayerClass with your player's class name and stringvar with the variable you want to check for.
User avatar
Virathas
Posts: 249
Joined: Thu Aug 10, 2017 9:38 am

Re: [ZScript] Replicating ACS HudMessage functionality

Post by Virathas »

This fully answers my bonus question.

For the main question, i am stupid, since i forgot how robust is the hudmessage, so i didn't specify what i need.

In most cases, i'd like to have a broadcasted message, somewhere in the top-middle of the screen when something happens: Player casts certain spells, is affected by certain debuffs, gains a level etc. This messages appear in the console menu.

I used to transfer data via temporary inventory items, however it is not as reliable since UI and game tics differently.
Post Reply

Return to “Scripting”