[SBARINFO] Ability To Read From Global ACS Variables
Moderator: GZDoom Developers
[SBARINFO] Ability To Read From Global ACS Variables
Details found here:
http://forum.zdoom.org/viewtopic.php?f= ... 67#p329667
I think it would be great if SBARINFO could read from global ACS variables as values for commands such as DrawNumber. Hopefully it's not just me but some projects have data that isn't part of the normal stuff, (health,armor,ammo). My project includes some data that is contained in ACS global variables and to be able to display this on the HUD through SBARINFO would be really nice.
So I'm wondering, would something like this be at all possible?
http://forum.zdoom.org/viewtopic.php?f= ... 67#p329667
I think it would be great if SBARINFO could read from global ACS variables as values for commands such as DrawNumber. Hopefully it's not just me but some projects have data that isn't part of the normal stuff, (health,armor,ammo). My project includes some data that is contained in ACS global variables and to be able to display this on the HUD through SBARINFO would be really nice.
So I'm wondering, would something like this be at all possible?
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [SBARINFO] Ability To Read From Global ACS Variables
Yes, this is certainly possible. The global variables are stored in an array called ACS_GlobalVars.
The only restriction would be that they'd have to be accessed by number because their names are not known in compiled form. If they contain strings they have to be looked up for display, of course but technically it's all doable.
The only restriction would be that they'd have to be accessed by number because their names are not known in compiled form. If they contain strings they have to be looked up for display, of course but technically it's all doable.
Re: [SBARINFO] Ability To Read From Global ACS Variables
Well at most we can have, what? About 65 or so of them? And we have to declare them by their number anyway so we can use that as refenece to that particular global. Doesn't sound too bad at all to me. As far as I know, all the globals that I wish to display on the HUD are numbers so that's no problem.
-
Blzut3
-

- Posts: 3220
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: [SBARINFO] Ability To Read From Global ACS Variables
As Slasher said, getting the numbers for global variables won't be hard for mod authors. And since we are talking about drawnumber here I don't think I need to check if it is a string. Likewise if I add something to drawstring the only thing I would need to do is check if the string is in the string table. So the next time I'm working with SBarInfo I'll look into doing this.
Re: [SBARINFO] Ability To Read From Global ACS Variables
Excellent.Blzut3 wrote:As Slasher said, getting the numbers for global variables won't be hard for mod authors. And since we are talking about drawnumber here I don't think I need to check if it is a string. Likewise if I add something to drawstring the only thing I would need to do is check if the string is in the string table. So the next time I'm working with SBarInfo I'll look into doing this.
-
Blzut3
-

- Posts: 3220
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: [SBARINFO] Ability To Read From Global ACS Variables
This still needs to be [Added]'d.
Re: [SBARINFO] Ability To Read From Global ACS Variables
Does this still need testing? I'd have tested it as soon as it was made available, but since I rely on http://sourceforge.net/project/showfile ... _id=254169 for my SVN versions of zdoom, I am still stuck with r841 and I don't have access to the latest stuff, which is some really good stuff. I don't know how to compile the latest build myself so I have no choice but to wait until someone gives me access to the latest build.
Other than that, I have stuff ready to go for testing this, but in my present situation I cannot...
Other than that, I have stuff ready to go for testing this, but in my present situation I cannot...
-
Blzut3
-

- Posts: 3220
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: [SBARINFO] Ability To Read From Global ACS Variables
As far as I know this has not been tested.
http://blzut3.maniacsvault.net/zdoom.zip Should be the latest revision.
http://blzut3.maniacsvault.net/zdoom.zip Should be the latest revision.
Re: [SBARINFO] Ability To Read From Global ACS Variables
I just tested this in r858. I don't think it worked.
This is my SBARINFO lump:
And these are the global variables referenced in SBARINFO above:
Take note that they are arrays, as they are meant to be different values based on each player. My project is designed to be co-op compatible for up to 8 players.
Anyway when I start the game, they all display as "0" and they don't change at all. Some should be displaying 0 at the very beginning, but they seem to permanently stay that way. I followed the syntax here: http://zdoom.org/wiki/SBARINFO so something is definitely wrong.
This is my SBARINFO lump:
Code: Select all
Height 32;
Statusbar Normal
{
DrawImage "HUDBASE3",0,168;
DrawString VFON1,Red,"Health",35,169;
DrawNumber 4,SMALLFONT,Red,Health,30,179;
DrawNumber 4,SMALLFONT,Red,GlobalVar 3,30,189;
DrawString VFON1,Gold,"Level",72,169;
DrawNumber 3,VFON2,Gold,GlobalVar 0,64,177;
DrawString VFON1,Blue,"Exp",65,183;
DrawNumber 7,VFON3,Blue,GlobalVar 1,74,191;
DrawNumber 7,VFON3,Blue,GlobalVar 2,74,196;
DrawSelectedInventory AlternateOnEmpty,INDEXFON,145,170
{
}
}
Statusbar Inventory
{
DrawInventoryBar Doom,7,INDEXFON,52,169;
}
Code: Select all
global int 0:level[];
global int 1:exp[];
global int 2:expneed[];
global int 3:maxhealth[];Anyway when I start the game, they all display as "0" and they don't change at all. Some should be displaying 0 at the very beginning, but they seem to permanently stay that way. I followed the syntax here: http://zdoom.org/wiki/SBARINFO so something is definitely wrong.
-
Blzut3
-

- Posts: 3220
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: [SBARINFO] Ability To Read From Global ACS Variables
Could you try something that isn't an array?
Re: [SBARINFO] Ability To Read From Global ACS Variables
Yep. Works perfectly fine with global variables that are not arrays.
-
Blzut3
-

- Posts: 3220
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: [SBARINFO] Ability To Read From Global ACS Variables
Thanks. Would anyone object to having global array printing always act like var[playernumber()]?
Re: [SBARINFO] Ability To Read From Global ACS Variables
That's exactly how I have them set up in scripts when working with them. Strange things happen when using PlayerNumber() to reference these values while in scripts called by monsters, but this isn't about that. These are called by players only so it should have no problem. So if that's how you want to solve it, I don't foresee any problems.