[Latest (GZDoom pre-605)] Get/SetUserVar/Array not working?

Bugs that have been investigated and resolved somehow.

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.
Post Reply
User avatar
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?

Post by Zhs2 »

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...
User avatar
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

Post by Major Cooke »

I recall a bug closely related to this was fixed a while ago.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
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

Post by Graf Zahl »

1. Provide feedback when being asked to verify.
2. Give a version number.
3. Provide something testable.

So far neither of this is present.
User avatar
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

Post by Zhs2 »

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:

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;
        }
    }
}
User avatar
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

Post by LilWhiteMouse »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
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

Post by Graf Zahl »

That may be. I debbuged this and it doesn't even seem to find the user variables anymore, so they always return 0.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [Latest (GZDoom pre-605)] Get/SetUserVar/Array not worki

Post by randi »

Post Reply

Return to “Closed Bugs [GZDoom]”