[Fixed] making a cvar for auto map_restart
hello, e+ devs.
how about making a cvar (for example, xp_maprestart) that will hold list of custom (config-specific) var names for automatically performing map_restart if one of them changed via callvote.
example: consider we have plusn.cfg (or plusc, or whatever with custom vars - it doesn't matter). we want to change xp_freezestyle via callvote. we vote yes, vote succeedes and we have to wait until next map for changes to take effect. but if this custom var is contained in xp_maprestart list, the server will automatically restart map (as it does when voting on g_gametype cvar succeedes).
so, we would have smth like this in server start script:
blah-blah-blah1
set xp_maprestart "xp_freezestyle, xp_itemstyle"
blah-blah-blah2
(if the server admin/owner doesn't want to mess with that thing he simply will not edit default value of that cvar: '', that's it).
and one more thing: is this possible to implement 'reloading' server cfg upon changing custom vars via callvote without map_restarting (without resetting the game and starting new match, i.e. on-the-fly)? i guess server could perform some kinda preprocessing to ensure if restart is needed or not (e.g. if some 'critical' cvars are changed by config or not: g_gametype, etc). if so, that would be great.
with respect, illca.
I think the answer will be :
Won't implement.
You can make a cvar and add it on callvote list if I remember well containing something predefined
seta item1 "xp_itemStyle 1; map_restart"
note that you can use http://www.excessiveplus.net/documentation/server/server-cvars-commands#execstr
On topic: Why do you need devs answer when Ali already said how it can be done? Do you see any drawbacks in the way he suggested?
Off topic: There is no need to doublepost (for example to give your thread extra attention), if you use the EDIT button, your last post date changes to a more recent one and it is displayed as the last post in the category, so it's as if you replaced your old post with a new one, you just get 1 post less, but it makes it for others more enjoyable to read.
Your suggestion seems interesting. However, the problem is that we can only track for modifications on cvars used by the mod, so implementing that is not possible.
However, I offer you an alternative: a /cmd2
(alias /c
) command for defining new "commands" that would accept parameters. It would work like this:
- You define the command in a cvar, like this:
// strings of the form $(X), where x is a number, // will be replaced by the parameters passed // this will set xp_itemStyle to the first parameter and restart the map set set_items "set xp_itemStyle $(1); map_restart"
- You add the string
cmd2 <cvarname>
(orc <cvarname>
) to callvote, like this:// add the "command" to vote string set xp_vote "c set_items"
- In the server, callvote the command, like this:
/callvote "c set_items" 1
If the need to enclose the command with brackets seems too ugly, we might come with some convention, like for example that every string of the form =cvarname
inside vote/referee string can be expanded to /cmd2 =cvarname
(or simply /cmd2 cvarname
), so you would have to do /callvote =cvarname param
instead, or something like that.
About the second suggestion, won't implement. The config is loaded only once when map is starting, and it will be like that to keep the implementation details simple.
Wooohooo
I was like Oo, I have thought that I have missed such command, but it isn't released yet.
i guess we should wait for devs to answer
thanx for info, ali.