• cvars.AddChangeCallback - It doesn't work for CreateConVar var or I'm being stupid.
    1 replies, posted
My single player: [code] ] lua_run CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end) > CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end)... ] testvarthing 123 ] testvarthing "testvarthing" = "123" ( def. "1337" ) clientcmd_can_execute [/code] My multiplayer (timer bit is unpaused, just to be sure): [code] ] lua_run CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end) > CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end)... ] testvarthing 123 ] testvarthing "testvarthing" = "123" ( def. "1337" ) clientcmd_can_execute [/code] Someone else's single player: [code] ] lua_run_con CreateConVar("deco",9000) cvars.AddChangeCallback("deco", function(cvar,prv,new) print("Changed Deco to: "..new) end) ] deco lol ] deco "deco" = "lol" ( def. "9000" ) [/code] Someone else's dedicated server: [code]] lua_run CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end) > CreateConVar("testvarthing",1337) cvars.AddChangeCallback("testvarthing", function(...) print(...) end)... ] testvarthing omgavalue [/code] (nothing follows) I've tried it with different convar names and all. I just want to make sure I haven't had 3 (or 4) occurrences of bad luck in a row before posting this on Get Satisfaction. I'm also hoping this get some more attention than if I were to simple post it on Get Satisfaction. My final resort is to just make them concommands. Halp!
I've had the same problem. It seems creating these at load time significantly changes your outcome. As in, then it works. :v:
Sorry, you need to Log In to post a reply to this thread.