cvars: To set or not to set

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

cvars: To set or not to set

Postby Dokujisan » Thu Jul 10, 2008 6:47 am

This has confused me a lot in the past, so I wanted some clarity on this issue. I realize there are cvars and commands in Nexuiz. My understanding is that the commands don't require "set" before them. You just enter the command in the config or the console without "set".

But the cvars do require "set", right? I've heard that but I really don't know the answer. It seems to me that some cvars will set without using "set". Does it depend on the context? (entering in console, client config or server config) Does it depend on the cvar?

I was helping someone with a server setup and their server.cfg didn't use "set" at all.

Code: Select all
g_maplist_index 0
g_maplist_shuffle 1
g_maplist_votable 5
g_maplist_votable_suggestions 2

sv_motd "Here is the message of the day"



Evidently, the g_whatever commands are not setting, but the sv_motd cvar is setting. How could that be?


...

And on a side note, what exactly does "seta" do? My understanding is that it saves the cvar setting in autoexec.cfg. Is that right? That's what I've been telling people, but I'm pretty sure I've experienced settings being saved (appearing the same after a nexuiz restart) by using "set" and not "seta" before.
Dokujisan
Forum addon
 
Posts: 1199
Joined: Sat Oct 07, 2006 4:31 pm
Location: Louisville, Kentucky

Postby KadaverJack » Thu Jul 10, 2008 10:02 pm

"set" defines a new cvar. So you only need to use set once for each cvar to tell the engine that this is a new cvar (with its default value listed in cvarlist/tab completion) and you can use it afterwards without set.
Since all custom cvars are already defined in default.cfg (or other config files loaded by default.cfg), i would strongly advise against using set in server.cfg or other custom config files, so you will actually get error messages if you misspell a cvar name.

Dokujisan wrote: I realize there are cvars and commands in Nexuiz. My understanding is that the commands don't require "set" before them. You just enter the command in the config or the console without "set".

Actually you may never use "set" on a command, because the engine won't allow you to define a cvar with the same name as a command ("set set foo" for example would define a new cvar named "set", so any use of "set" hereafter would be ambiguous).
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby Dokujisan » Thu Jul 10, 2008 10:49 pm

ok, that clears it up. Thank you very much :-)
Dokujisan
Forum addon
 
Posts: 1199
Joined: Sat Oct 07, 2006 4:31 pm
Location: Louisville, Kentucky


Return to Nexuiz - General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron