Writing to Status or top of screen text?

Discuss modding questions and implementation details.
User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Writing to Status or top of screen text?

Post by Ralzar » Sun Nov 24, 2019 11:12 pm

How do you get text like, for example, being Poison creates?

The floating text saying "You feel bad" and the status information "You have been poisoned".

Is there some way to write to one or both of these?

User avatar
pango
Posts: 1780
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango » Sun Nov 24, 2019 11:50 pm

Code: Select all

DaggerfallUI.AddHUDText(message)
and variants should do for scrolling text at the top of the screen and

Code: Select all

DaggerfallUI.SetMidScreenText(message)
for middle screen text
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar » Mon Nov 25, 2019 8:06 am

Thanks! That worked great :D

User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar » Mon Nov 25, 2019 11:38 pm

Hm, is there a way these are usually set to delay the messages? My DaggerfallUI.AddHUDText(message) just spams me. Unlike when you are poisoned for example, where the text only appears every 10 seconds or so.

User avatar
pango
Posts: 1780
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango » Tue Nov 26, 2019 4:00 am

Poisoned messages only appear at multiples of 5s because they're triggered by magical/effects "rounds", that's not a feature of display functions.

So you'd have to do something similar, use Unity's Time package to schedule events.
Say, maintain a counter that you increment with Time.deltaTime, and trigger a message only when it reaches the period you want.
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar » Tue Nov 26, 2019 7:14 am

Ah, ok. My function allready triggers by magical rounds. So it's simply that the rounds are too short. Which is sort of what I assumed. I'll take a look at what my options are.

User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar » Sun Dec 01, 2019 9:30 pm

Is there a relatively easy way to write to this?
status.png
status.png (91.93 KiB) Viewed 70 times

User avatar
pango
Posts: 1780
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango » Sun Dec 01, 2019 9:47 pm

That's the DaggerfallMessageBox class, it's very powerful (because it can contain formatted text, buttons,...) so it all depends on what you want to do with it exactly.

DaggerfallUI.MessageBox(string message) or DaggerfallUI.MessageBox(string[] message) may be sufficient for your needs, but you can search around in the code for more advanced usage examples...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Hazelnut
Posts: 1832
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Writing to Status or top of screen text?

Post by Hazelnut » Sun Dec 01, 2019 9:49 pm

It reports any disease or poison effects on the player and is constructed in DaggerfallUI.CreateHealthStatusBox() if you want to use it. Replacing this method is not provided to mods. If you created a 'disease' effect you could probably have it appear on here, but seems a bit over the top.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Ralzar
Posts: 448
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar » Sun Dec 01, 2019 10:32 pm

And that answered the "relatively easy way" question :D

Too bad really, because the game lacks these kind of places to just look up status effects. Since you are not told what is buffing/debuffing your attributes, and this box is apparently pretty custom made for just diseases and poisons (and poisons down't even use it properly).

I was hoping to use it for my Climates&Cloaks mod as a place to look up exactly how warm/cold it is instead of having to wait for it to vaguely roll across the screen.
Ah well, it works ok as it is. I just figured it was worth checking.

Post Reply