I am trying to reproduce your problem with the steps you described. To make sure I did so correctly, here's what I did and do on my way to fixing stuff.
1) Create a new world.
2) Save it as C:\Projects\Test.mcl
3) Extract your plugin to C:\Projects\tmp\
4) Load the plugin.
5) Save & close MUSHclient.
6) Restart MUSHclient. Load Test.mcl.
7) Errors I encountered were different from yours:
Scripting error popup:
[string "Plugin"]:638: attempt to call local 'f' (a nil value)
stack traceback:
[string "Plugin"]:638: in function 'loadAfflictionColors'
[string "Plugin"]:798: in main chunk
Starterpack.xml Notepad window:
Line 1249: Error parsing script (problem in this file)
Test.mcl:
Line 422: Error processing include file "C:\Projects\tmp\StarterPack.xml" (include file not loaded)
8) I found the following code: (do NOT forget that any <include> directives bump the line numbers - in this case, you are being confused with the line numbers by your constants.lua include!)
function loadAfflictionColors()
SysNote("Loading Affliction colors from : "..AFFLICTION_COLORS_FILE)
local f = loadfile(AFFLICTION_COLORS_FILE)
f()
return true
end
The error here is that you use loadfile(), yet do not check if it succeeded. I suggest you adjust it as follows to make debugging more easier:
function loadAfflictionColors()
SysNote("Loading Affliction colors from : "..AFFLICTION_COLORS_FILE)
local f = loadfile(AFFLICTION_COLORS_FILE)
if (f ~= nil) then
f()
return true
else
Note("Could not load "..AFFLICTION_COLORS_FILE)
return false
end
end
9) Why could it not load the file? Simple, because it couldn't FIND the file. Looking at the definitions, we find:
AFFLICTION_TRIGGERS_FILE = "STP_triggers.lua"
AFFLICTION_CURE_TRIGGERS_FILE = "STP_cures.lua"
AFFLICTION_DIAGNOSIS_TRIGGERS_FILE = "STP_diagnosis.lua"
AFFLICTION_COLORS_FILE = "STP_affliction_colors.lua"
CURE_COLORS_FILE = "STP_cure_colors.lua"
EAT_AFFLICTION_PRIORITIES_FILE = "STP_eat_affliction_priorities.lua"
APPLY_AFFLICTION_PRIORITIES_FILE = "STP_apply_affliction_priorities.lua"
DRUG_AFFLICTION_PRIORITIES_FILE = "STP_drug_affliction_priorities.lua"
AUTOSIPPER_FILE = "STP_autosipper.lua"
at the top of your file. Suggested fix is as follows:
PLUGIN_PATH = GetPluginInfo(GetPluginID(), 20)
AFFLICTION_TRIGGERS_FILE = PLUGIN_PATH.."STP_triggers.lua"
AFFLICTION_CURE_TRIGGERS_FILE = PLUGIN_PATH.."STP_cures.lua"
AFFLICTION_DIAGNOSIS_TRIGGERS_FILE = PLUGIN_PATH.."STP_diagnosis.lua"
AFFLICTION_COLORS_FILE = PLUGIN_PATH.."STP_affliction_colors.lua"
CURE_COLORS_FILE = PLUGIN_PATH.."STP_cure_colors.lua"
EAT_AFFLICTION_PRIORITIES_FILE = PLUGIN_PATH.."STP_eat_affliction_priorities.lua"
APPLY_AFFLICTION_PRIORITIES_FILE = PLUGIN_PATH.."STP_apply_affliction_priorities.lua"
DRUG_AFFLICTION_PRIORITIES_FILE = PLUGIN_PATH.."STP_drug_affliction_priorities.lua"
AUTOSIPPER_FILE = PLUGIN_PATH.."STP_autosipper.lua"
10) Save the changes. Repeat steps 5) and 6).
11) No more errors.
Edit: Right, forgot the conclusion/summary thing.
The problem here, as always with MUSHclient plugins that won't load after restarting, is that they tend to depend on the current working directory. Depending on the users last open or save action, that can differ. In your case, your MCL was in another directory, and since it was most recently browsed in by the user, that is where the current directory pointed at - not the directory of your plugin.
The lesson here is to always make sure you feed MUSHclient absolute pathnames, even if you have to take a little bit more trouble in finding out what that path would be. |