Multiple errors attempting to make a ZScript status bar

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
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

I'd ask this in the pinned thread but it's locked. In a nutshell, I'm trying to make a status bar in ZScript but I'm running into issues. The wiki's utter lack of functional documentation for this didn't help, and couldn't find any examples in the locked thread that would illuminate the cause of the errors I'm running into. Can anyone tell me what I'm doing wrong here?

Here is the current status bar class I'm trying to use, currently in my main zscipt file:
Spoiler:
And here are the errors I'm getting:
Spoiler:
From the looks of it, my guess is it is COMPLETELY failing to grab any of the essential properties you'd expect it to grab by inheriting from BaseStatusBar? GZDoom version is 4.6.0, status bar is largely copied from Doom version.
User avatar
phantombeta
Posts: 2090
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Multiple errors attempting to make a ZScript status bar

Post by phantombeta »

Based on the errors (e.g., the class being seemingly "play" scope despite BaseStatusBar itself being "ui"), that seems like you have no ZScript version specified. You have to specify a version in your ZScript file to get these errors to go away. Generally, you'll want to use at least 4.0.0, minimum, as some very annoying ZScript bugs were fixed before that. Preferably, though, you should use the latest version possible to avoid getting affected by already-fixed ZScript bugs.
User avatar
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Re: Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

Ah, weird. So since I'm testing in 4.6.0 then specifying that version may be the most idiotproof. I'll test it in a bit, thanks.
User avatar
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Re: Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

This upgrades the fatal error to a Very Fatal Error:

Code: Select all

Code: C0000005 (Access Violation - tried to read address 0000000000000000)
Address: 00007FF6A0365B17
Flags: 00000000
Tested both 4.0.0 and 4.6.0 for versions.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Multiple errors attempting to make a ZScript status bar

Post by Blue Shadow »

Remove the square brackets around the amt1 variable in CVDrawBarAmmo. You only need them if you're trying to get more than one return value.
User avatar
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Re: Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

Ah, that might well be it. I'm actually just about to release the mod I was testing this for, after I finish that post up I'll test that.
User avatar
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Re: Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

And yep, that seems to fix it, thanks. I'll have to tinker with offsets to get it line up with how I have it set up in SBARINFO, then I'd be able to switch to a ZScript status bar for the mod in question.
User avatar
Player701
 
 
Posts: 1640
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Multiple errors attempting to make a ZScript status bar

Post by Player701 »

Chaosvolt wrote:This upgrades the fatal error to a Very Fatal Error:

Code: Select all

Code: C0000005 (Access Violation - tried to read address 0000000000000000)
Address: 00007FF6A0365B17
Flags: 00000000
Tested both 4.0.0 and 4.6.0 for versions.
I've reported the fatal error here, since it still occurs in GZDoom 4.8.0. Please note that even if your code is not correct, very fatal errors are (generally) still engine bugs that should be reported.
User avatar
Chaosvolt
Posts: 72
Joined: Mon Apr 19, 2021 12:58 pm

Re: Multiple errors attempting to make a ZScript status bar

Post by Chaosvolt »

Ah, thanks. Definitely weird to see that happen, but glad that it was easy to sort out what triggered it.
Post Reply

Return to “Scripting”