[3.6.0] CVar.GetCVar...Set* not saving to ini?

These bugs do plan to be resolved, when they can be.

Moderator: Developers

[3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Matt » Fri Nov 09, 2018 11:25 am

Here's the relevant test ZScript:
Code: Select allExpand view
class Loadout1Butts:CustomInventory{
    states{
    pickup:
        TNT1 A 0{
            A_Log(cvar.getcvar("hd_loadout1",player).getstring());
            cvar.getcvar("hd_loadout1",player).setstring("butts");
            A_Log(cvar.getcvar("hd_loadout1",player).getstring());
        }stop;
    }
}
class Load20Boobs:CustomInventory{
    states{
    pickup:
        TNT1 A 0{
            A_LogInt(cvar.getcvar("hd_load20",player).getint());
            cvar.getcvar("hd_load20",player).setint(80085);
            A_LogInt(cvar.getcvar("hd_load20",player).getint());
        }stop;
    }

and CVARINFO:
Code: Select allExpand view
user string hd_loadout1="";
user int hd_load20=0;


Expected:
Typing "give Loadout1Butts" the first time will output
Code: Select allExpand view

butts

and all subsequent give calls will output
Code: Select allExpand view
butts
butts


Actual:

Typing "give Loadout1Butts" the first time in every new session will output
Code: Select allExpand view

butts

but will work fine for the rest of that session alone, even if I start a new game.

Same thing with the integer version, mutatis mutandis.

Also if I give this item and then check the cvar's value from the console, the console will return the original value even though the CVar...Get* function will return the new value.


I have only tried this in Debian, in case this is an issue with where the ini is stored on a given OS.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Matt » Sat Nov 10, 2018 1:03 am

This is not restricted to CustomInventory pickup calls, as the same thing happens with the following:
Code: Select allExpand view
class Loadout1Butts:Inventory{
    override void attachtoowner(actor other){
        super.attachtoowner(other);
        other.A_Log(cvar.getcvar("hd_loadout1",other.player).getstring());
        cvar.getcvar("hd_loadout1",other.player).setstring("butts");
        other.A_Log(cvar.getcvar("hd_loadout1",other.player).getstring());
        destroy();
    }
}
class Loadout1ButtsW:Weapon{
    default{weapon.slotnumber 1;}
    states{
    select:
        TNT1 A 0{
            A_Log(cvar.getcvar("hd_loadout1",player).getstring());
            cvar.getcvar("hd_loadout1",player).setstring("butts");
            A_Log(cvar.getcvar("hd_loadout1",player).getstring());
        }
        TNT1 A 1 A_Raise();
        wait;
    deselect:
        TNT1 A 1 A_Lower();
        wait;
    fire:
        TNT1 A 1;
        TNT1 A 0 A_Refire();
    ready:
        TNT1 A 1 A_WeaponReady();
        wait;
    }
}
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Graf Zahl » Sat Nov 10, 2018 1:12 am

Please post a runnable example, not script fragments.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby phantombeta » Sat Nov 10, 2018 1:13 am

The problem seems to be with GetCVar. Using FindCVar, setting CVars works fine, but GetCVar doesn't seem to actually set the CVar properly.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Matt » Sat Nov 10, 2018 1:59 am

The script fragments in the OP were sufficient to be run once placed in zscript and cvarinfo files, but here's everything from both posts.
Attachments
bb.zip
(686 Bytes) Downloaded 1 time
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Graf Zahl » Sat Nov 10, 2018 2:24 am

phantombeta wrote:The problem seems to be with GetCVar. Using FindCVar, setting CVars works fine, but GetCVar doesn't seem to actually set the CVar properly.



The problem is with user CVARs. Please don't ask me what this was supposed to achieve, the code is all Greek to me. It only appears to save the global reference CVAR for these, which of course is empty.

But since I don't even understand half of this stuff and the other half appears to be somewhat broken and ill-conveived I am passing on this one.
In my opinion the entire user CVAR feature needs to be excised and dumped into the deepest bowels of hell, because it's so poorly implemented.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Rachael » Sat Nov 10, 2018 3:46 am

The idea behind user CVARs is to allow every player in a multiplayer game to have their own independent setting of a CVAR. Like server CVARs, each player's copy is sync'd to every other player, and therefore any CVAR that is marked such is suitable for both demos and multiplayer. Allegedly, in order to call a user CVAR in ACS, the player has to be the activator. I am not sure how it's supposed to work in ZScript, ideally it would be something like "GetPlayer(0).GetCVar("some_user_cvar").Set("whatever")"

Things this is good for, particularly, are player-defined preferences, such as player control, visuals, vanity, etc.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Graf Zahl » Sat Nov 10, 2018 4:09 am

I wasn't talking about what this is used for but how it is implemented. The entire CVARINFO feature doesn't look fully thought through and suffers from several problems as a result.
It's like building a house without a solid foundation. This actually is a property of several things that were just added because people "needed" them.

The biggest problem, of course, is that it was shoehorned into the INI save format without giving it any useful structure at all. And user CVARs are a story of their own when it comes to this.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Rachael » Sat Nov 10, 2018 4:20 am

Graf Zahl wrote:This actually is a property of several things that were just added because people "needed" them.


That describes much of GZDoom at this point. >_<

Graf Zahl wrote:The biggest problem, of course, is that it was shoehorned into the INI save format without giving it any useful structure at all. And user CVARs are a story of their own when it comes to this.


This has always needed fixing, in my opinion. There is no reasonable way that loading all CVARs from all mods has ever made sense to me.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: [3.6.0] CVar.GetCVar...Set* not saving to ini?

Postby Graf Zahl » Sat Nov 10, 2018 4:39 am

Yes, and for the second one there is an open report. The main problem here is that I have no idea how to manage configurations that are both local to a mod but share other parts with more global settings.

This gets particularly bad if multiple mods with custom settings are loaded on top of each other.
It's like I said, the system was never really thought through. The feature was just implemented without ever bothering with the consequences.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to On Hold Bugs

Who is online

Users browsing this forum: No registered users and 1 guest