Module Script By mutor.
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Module Script By mutor.

Started by TZB, 11 September, 2009, 08:59:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TZB

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

TZB

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,
                        }
}

CrazyGuy

'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

SMF spam blocked by CleanTalk