Hello Friends,
This was a help from mutor.
Actually i wanted a script for loading another scripts from a folder like in AOI. So mutor helped me for it a few weeks back but now i actually have started working on to it.
What i am doing here is using this module as a test. and made a directory called test as per the script requires and i added a simple script to reg the bot in the hub.And placed the script in the script folder using name as per script Module as Script1.lua.
but when i start the module the bot is not registered.
It is giving me a error in as
Quote[12:33] Syntax [string "Modules = {..."]:21: attempt to index global 'Core' (a nil value)
Quote[12:20] Syntax cannot open D:/My test Hub/scripts/test/Settings.ini: No such file or directory
Actually i have no idea what to do with it since am learning it and trying it out for the first time cant even look into other AOI since its very high level for me and i am on the basics level.
Please help me understand this problem.
Oops this the Script That mutor gave me:
Modules = {
"Script1.lua",
"Script2.lua",
"Script3.lua",
}
LoadModules = function()
local path,s = Core.GetPtokaXPath().."scripts/test/","\r\n\r\n"
for i,v in ipairs(Modules) do
local status = "loaded"
v = path..v
if loadfile(v) then
dofile(v)
else
status = "not loaded"
end
s = s.."\t"..v.." was "..status.."\r\n"
end
return s
end
Path = Core.GetPtokaXPath().."scripts/test/"
OnStartup = function ()
dofile(Path.."Settings.ini")
end
Sorry I had not posted the Module which i was trying to load
Its actually i read it by going through Flexo made by Madman.And i am using it learn about the plugins.
This is the module
QuoteModules ["Script1"] = {
["Config"] = {
["Bot"] = "Test",
["Reg"] = true,
},
["OnStartup"] = function()
Modules.Script1.Func.CheckReg()
end,
["Func"] = {
["CheckReg"] = function()
if Modules.Script1.Config.Reg then
Core.RegBot(Modules.Script1.Config.Bot,"","",true)
else
Modules.Script1.Config.Bot = SetMan.GetString(21)
end
end,
}
}
'Core' is a nil value (non-existing) until OnStartup has been called.
use below code instead
Modules = {
"Script1.lua",
"Script2.lua",
"Script3.lua",
}
LoadModules = function()
local path,s = Core.GetPtokaXPath().."scripts/test/","\r\n\r\n"
for i,v in ipairs(Modules) do
local status = "loaded"
v = path..v
if loadfile(v) then
dofile(v)
else
status = "not loaded"
end
s = s.."\t"..v.." was "..status.."\r\n"
end
return s
end
OnStartup = function ()
Path = Core.GetPtokaXPath().."scripts/test/"
dofile(Path.."Settings.ini")
end