diff --git a/bin/_startup.def b/bin/_startup.def index bebf7ee..ec23a2d 100644 --- a/bin/_startup.def +++ b/bin/_startup.def @@ -41,9 +41,6 @@ ELSE ENDIF UNSET errors -// loads & applies the configuration -CONFIG - // Load some SCP files LOADALLSCP diff --git a/bin/scripts/__core_internal.def b/bin/scripts/__core_internal.def index e890ae4..8149060 100644 --- a/bin/scripts/__core_internal.def +++ b/bin/scripts/__core_internal.def @@ -37,6 +37,10 @@ LOGDETAIL * Dangerous variables removed. #script=config #permission=255 //----------------------------------------------- +#onload + // create empty variable. stores if config script was already run successfully once. + SET,DONE +#/onload // Load all conf files from directory /conf/ // get all *.conf file names from /conf/ directory, store the names in list 'fl' and the amount in 'fcount' LOG ** Configuring PseuWoW... @@ -84,6 +88,7 @@ INTERNAL_PERM DEFAULT,#CMDCHAR . LOG ** All Config done. +SET,DONE true //-------------------------------------------------- @@ -98,3 +103,16 @@ LOG * Assigning permissions for internal functions... setscriptpermission,emote 0 // ... set more permissions here ... + +// this dummy script does nothing actually but since its loaded last in this file it causes the config +// script to be run before all .def files are loaded +// (this is important for scripts that depend on the config already existing during load-time) +//------------------------------------------------- +#script=dummy +//------------------------------------------------- +#onload +if ?{not ${#config::DONE}} + config +endif +#/onload + diff --git a/src/Client/DefScript/DefScript.cpp b/src/Client/DefScript/DefScript.cpp index b5cfda4..b9dc81a 100644 --- a/src/Client/DefScript/DefScript.cpp +++ b/src/Client/DefScript/DefScript.cpp @@ -252,7 +252,10 @@ bool DefScriptPackage::LoadScriptFromFile(std::string fn){ curScript->SetDebug(true); } else if(line=="onload") - Script[SN_ONLOAD] = curScript = new DefScript(this); + { + _UpdateOrCreateScriptByName(SN_ONLOAD); + curScript=Script[SN_ONLOAD]; + } else if(line=="endonload" || line=="/onload") { RunScript(SN_ONLOAD,NULL,sn); diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp index 3b4e10c..ff47b1b 100644 --- a/src/Client/PseuWoW.cpp +++ b/src/Client/PseuWoW.cpp @@ -347,8 +347,10 @@ void PseuInstance::DeleteGUI(void) PseuInstanceConf::PseuInstanceConf() { enablecli=false; + enablegui=false; exitonerror=false; debug=0; + rmcontrolport=0; } void PseuInstanceConf::ApplyFromVarSet(VarSet &v)