Display System Time in SBARINFO
Moderator: GZDoom Developers
Display System Time in SBARINFO
Hi, after much searching I have yet to find a definitive answer for this - but would it be possible to add system time as an accessible display for DrawNumber or something in SBARINFO? I just find that it would be exceedingly convenient to have system time available to display as it already is on the AltHUD.
If there is a good reason that this can't be allowed, that is fine - but as it is already accessible via the AltHUD I don't see why it wouldn't be?
As for the why, it's mainly for convenience - I would like the capability to have it show on screen as something like "Earth Time: hh:mm:ss" just so that when I'm playing long sessions, I can keep an eye on what time it is. I even went so far as to create a "clock" ACS script that you set using CVARs, and runs "like" a clock, but after you save or load, it goes back to displaying the incorrect time so you would have to reset it if you die and reload, or start a new map, etc.
Maybe add a few new variables to SBARINFO for drawnumber... SysHr, SysMin, SysSec?
Example:
Drawstring SMALLFONT, Green, "Earth time: ", 50, 50;
Drawnumber 2, SMALLFONT, Green, SysHr, 60, 50;
Drawstring SMALLFONT, Green, ":", 60, 52;
Drawnumber 2, SMALLFONT, Green, SysMin, 60, 54;
Drawstring SMALLFONT, Green, ":", 60, 56;
Drawnumber 2, SMALLFONT, Green, SysSec, 60, 58;
Obviously that may or may not be lined up right - but that is the general idea... Again, if a similar function exists and I'm not aware - let me know, and if for some technical reason this can't be allowed - let me know as well
This is the one of the last things I want out of my perfect HUD at this point, and it is driving me crazy that i can't implement it.
Thanks!
If there is a good reason that this can't be allowed, that is fine - but as it is already accessible via the AltHUD I don't see why it wouldn't be?
As for the why, it's mainly for convenience - I would like the capability to have it show on screen as something like "Earth Time: hh:mm:ss" just so that when I'm playing long sessions, I can keep an eye on what time it is. I even went so far as to create a "clock" ACS script that you set using CVARs, and runs "like" a clock, but after you save or load, it goes back to displaying the incorrect time so you would have to reset it if you die and reload, or start a new map, etc.
Maybe add a few new variables to SBARINFO for drawnumber... SysHr, SysMin, SysSec?
Example:
Drawstring SMALLFONT, Green, "Earth time: ", 50, 50;
Drawnumber 2, SMALLFONT, Green, SysHr, 60, 50;
Drawstring SMALLFONT, Green, ":", 60, 52;
Drawnumber 2, SMALLFONT, Green, SysMin, 60, 54;
Drawstring SMALLFONT, Green, ":", 60, 56;
Drawnumber 2, SMALLFONT, Green, SysSec, 60, 58;
Obviously that may or may not be lined up right - but that is the general idea... Again, if a similar function exists and I'm not aware - let me know, and if for some technical reason this can't be allowed - let me know as well
This is the one of the last things I want out of my perfect HUD at this point, and it is driving me crazy that i can't implement it.
Thanks!
Re: Display System Time in SBARINFO
Here is the code for the "clock" I made... just to show you my desperation. Again, it only works if you don't ever die/reload/respawn.
Code: Select all
#library "systemclock"
#include "zcommon.acs"
int gametime;
int hr;
int min;
int currenthr;
int currenttens;
int currentones;
//int sec;
Script 102 enter
{
While(True)
{
SetHudSize(640,480,0);
gametime = Timer() / 35;
hr = gametime/3600;
min = (gametime/60)%60;
currenthr = GetUserCVAR(PlayerNumber(),"current_hr")+hr;
currentones = GetUserCVAR(PlayerNumber(),"current_ones")+(min%10);
currenttens = GetUserCVAR(PlayerNumber(),"current_tens")+(min/10);
//sec = gametime%60;
If (currentones > 9)
{
currenttens = currenttens + 1;
currentones = 0;
//min = 0;
}
If (currenttens > 5)
{
currenthr = currenthr + 1;
currenttens = 0;
currentones = 0;
//min = 0;
}
hudmessagebold(d:currenthr, s:":", d:currenttens, d:currentones;//, s:":", d:sec/10, d:sec%10;
HUDMSG_PLAIN, 215, CR_GRAY, 375.2, 270.1, 0);
Delay(1);
}
}
- axredneck
- Posts: 354
- Joined: Mon Dec 11, 2017 2:09 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Russia
- Contact:
Re: Display System Time in SBARINFO
Why this feature suggestion is [closed] ?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Display System Time in SBARINFO
Because SBARINFO is deprecated and will not be extended anymore.
- axredneck
- Posts: 354
- Joined: Mon Dec 11, 2017 2:09 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Russia
- Contact:
Re: Display System Time in SBARINFO
So what should i use instead of SBARINFO ?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Display System Time in SBARINFO
ZScript, of course.
I don't think you can retrieve the system time, but on the ZScript side it has a chance of getting added. Back in 2017 I blanketly closed all SBARINFO related suggestions regardless on content or merit.
The SBARINFO code is in a state that I won't maintain it any longer beyond keeping it operable.
I don't think you can retrieve the system time, but on the ZScript side it has a chance of getting added. Back in 2017 I blanketly closed all SBARINFO related suggestions regardless on content or merit.
The SBARINFO code is in a state that I won't maintain it any longer beyond keeping it operable.
- axredneck
- Posts: 354
- Joined: Mon Dec 11, 2017 2:09 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Russia
- Contact:
Re: Display System Time in SBARINFO
GZDoom has it's HUD in SBARINFO so i thought it is right way to make HUD. OK, i'll try to zscript something...
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Display System Time in SBARINFO
No, GZDoom has its HUD in ZScript. The SBARINFOS are only there for mods that use them as a base for modification.
- axredneck
- Posts: 354
- Joined: Mon Dec 11, 2017 2:09 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Russia
- Contact:
Re: Display System Time in SBARINFO
Thank you