[Latest (GZDoom pre-605)] Get/SetUserVar/Array not working?
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Zhs2
- Posts: 1303
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
- Contact:
[Latest (GZDoom pre-605)] Get/SetUserVar/Array not working?
As the title says. Currently I have a case set up to reproduce this problem, but the project is rather large and the steps to reproducing are slightly complex, and building the perfect smaller example to reproduce this eludes me for the moment... Either that or I am annoyed by the fact that setting up a reproduction case requires a new player class and thus a MAPINFO, a comprehensive script that reports feedback to the user via HUDMessages, the works. Sorry for complaining, but yeah...
- Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki
I recall a bug closely related to this was fixed a while ago.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki
1. Provide feedback when being asked to verify.
2. Give a version number.
3. Provide something testable.
So far neither of this is present.
2. Give a version number.
3. Provide something testable.
So far neither of this is present.
- Zhs2
- Posts: 1303
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
- Contact:
Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki
Alright. After thinking a little more on how to properly represent this problem without a huge project file, I have smithed together a crude example that reproduces this case. This is the example in question. To reproduce: "pukename userarraytest" in console. In GZDoom 2.1.1 (ZDoom 2.8.1), this example *just works*, meaning it is able to correctly retrieve values stored to the array entries it scans through until it finds an empty position to store another value to, stores it, and stops there. In the latest version (topic title), it seems the value either never gets set or retrieved correctly (probably the former), and thus the script only attempts to store to position 0 of the player's user array.
Relevant code:
Relevant code:
Code: Select all
#library "testcasegoboink"
#include "zcommon.acs"
script "UserArrayTest" (void)
{
int randomvalue = UniqueTID();
for(int i = 0; i < 999; i++)
{
if(GetUserArray(0, "User_TestArray", i))
{
continue;
}
else
{
SetUserArray(0, "User_TestArray", i, randomvalue);
HUDMessageBold(s:"I stored the value ", i:randomvalue, s:" to User_TestArray at position ", i:i;HUDMSG_FADEOUT|HUDMSG_LOG, 900, CR_GOLD, 0.5, 0.1, 3.0, 0.5);
break;
}
}
}- LilWhiteMouse
- Posts: 2270
- Joined: Tue Jul 15, 2003 7:00 pm
- Location: Maine, US
- Contact:
Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki
I think this is what's causing my problems. I did my own test, and it seems Get/SetUserArray() does not work. GetUserArray() always seems to return 0 in my tests.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki
That may be. I debbuged this and it doesn't even seem to find the user variables anymore, so they always return 0.