Code: Select all
use cfgfile;
include "include/utils"
program dotcmd_reloadconst(who, text)
if (who.cmdlevel < 5)
send_to_gm("Idiots have tried to use .reloadconst!");
SendSysMessage(who, "GO DIE!");
ApplyRawDamage(who, 99999);
else
UnloadConfigFile(":worldconst:worldconst");
var cfg := ReadConfigFile(":worldconst:worldconst");
var elem := FindConfigElem(cfg, "global");
var props := ListConfigElemProps(elem);
// props variable is an array of all global "constants" we are going to reload. (not their values).
var value;
foreach constant in (props)
value := GetConfigString(elem, props[constant]);
// i could either iterate through another bit of shit here to determine if we have 'string' or 'int' values, or i could just force int use in the config. :)
if (TypeOf(value) != "Integer")
SendSysMessage(who, "THAT DIDN'T WORK!");
ApplyRawDamage(who, 99999);
endif
SetGlobalProperty(props[constant], value);
endforeach
endif
endprogram
Code: Select all
# This file contains variables used by scripts unloadable by the core that may need alteration at any given point to obtain a result without restart.
global global
{
WORLD_SPAWN_TIME_MINIMUM_SECONDS 1800
WORLD_SPAWN_TIME_ADDITIONAL_RANDOM_MINUTES 20
}
Code: Select all
// load the world constants, simplified boot time version of command .reloadconst
var cfg := ReadConfigFile(":worldconst:worldconst");
var elem := FindConfigElem(cfg, "global");
var props := ListConfigElemProps(elem);
// props variable is an array of all global "constants" we are going to reload. (not their values).
var value;
foreach constant in (props)
value := GetConfigString(elem, props[constant]);
// i could either iterate through another bit of shit here to determine if we have 'string' or 'int' values, or i could just force int use in the config. :)
if (TypeOf(value) != "Integer")
SendSysMessage(who, "THAT DIDN'T WORK!");
ApplyRawDamage(who, 99999);
endif
SetGlobalProperty(props[constant], value);
endforeach