I've added support for anyone writing/adding modules to DiXBoT and having them loaded 'almost' on-the-fly (require a cmd to check for new modules <g>).
This will be available from the next major update comming in the very near future..
I've make the first draft on a 'HowTo' including a sample "hello world" script, script template and API instructions and will post it this weekend after a quick review from a few scripters <g>
This is just a heads-up post :)
-Snooze (http://www.dixbot.com)
Thanks for the advance warning Snooze.
Any ETA on the revised version?
Both yes and no..
I made a poll on www.dixbot.com on what should be the next major update.. It's currently a tie so gonna do them all lol
I've had a few scripters from this forum checking the HowTo script ive made and most have "signed off" on it.. So I'll finish that this weekend and could have a small version of DiXBoT ready for those of you who wanna make your own Modules..
If you wanna get a preview you could contact me in the Demo Hub ..
-Snooze (http://www.dixbot.com)
ok thanks m8
This is a first draft of the HowTo file.. API section is missing more than a few entry's but it should give you a good idea of what it would look like..
Please let me know if this is easy enough to follow .. well.. any feedback will be appreciated :-)
--[[
=============================================
README before starting your code!!
=============================================
DiXBoT API
---------------------
Seconds --> DD, HH, MM, SS
doTimeCal(time_in_sec, short/long) -- two modes. nil will return long
k --> kb, mb, gb, tb
doShareCal(k, dec) -- k = share in b - dec = amount of decimals (If dec = nil then dec = 2)
Args:
doArg1(data) -> arg
doArg2(data) -> arg, arg2
doArg3(data) -> arg, arg2, arg3
doArg4(data) -> arg, arg2, arg3, arg4
-- all args return nil if either of them is nil
DiXBoT Global Config:
----------------------
tCoreConfig <-- Holds the settings
.System <-- Holds Basic system settings
.Bot <-- Main Bot Name - (!botname [ NewName ]) - require reloading functions by calling Main()
.Prefix = {} <-- table of cmd prefix's
.HubMail <-- Contact Mail Addy (!mail [ NewMailAddy ])
.Web <-- Hub Website (!website [ NewAddy ])
.Modules = {} <-- Tables of Modules (set to true/false)
Changing a Module's Status require reloading functions by calling Main()
Ex: Calling tCoreConfig.System.Bot will return the MainBot Name.
New Settings can be addy as you please - Just note that these settings migt be overwritten by updates if there's changes to table structure
Language File Creation
----------------------
I will do a 2nd Demo Script on howto add Language File Support to a Module.
It's really fairly simple and easy to do, but all in due time :)
General Notes:
----------------------
There will be added a section on my website where you can upload your Modules..
Website: www.dixbot.com
Support:
You can contact me here:
Lua Language Board - http://forum.ptokax.org/
DiXBoT Website - www.dixbot.com
DixBoT Demo Hub - demo.dixbot.com:1209
All suggestions will be highly appreciated :)
]]
--====================================================================================================
-- [ Code Example with comments :: Play around with it ;-) ] --
--====================================================================================================
HelloWorld = { -- Name of Script - the filename of the script MUST be the same - ex: HelloWorld.lua
-- All PtokaX Functions can be called as shown in the NewUserConnected example. PtokaX Functions can be found in the Scripting-Interface.txt that comes with PtokaX.
["NewUserConnected"] = { -- You should know this one ;-)
doHelloWorld1 = function(user,data) -- Example function
user:SendData(tCoreConfig.System.Bot, "Hello World, "..user.sName) -- Note, This is using the default Bot Name!
end,
},
["OpConnected"] = {
doHelloWorld2 = function(user,data) -- Example function
user:SendData(tCoreConfig.System.Bot, "Hello World, "..user.sName) -- Note, This is using the default Bot Name!
end,
},
-- All non PtokaX Functions lives in "Func"
["Func"] = {
doStuff = function(user,data)
SendToAll(tCoreConfig.System.Bot, "Doing Timed Stuff..")
end,
doMoreStuff = function(user,data)
doReturn = "Stuff Done :-)" -- 'doReturn' will return to same place as cmd is run(main/PM) + allows for calling language files (inludes return 1 to stop cmds from showing in main)
end,
doMoreStuff2 = function(user,data)
doArg1(data)
if arg == nil then
doReturn = "Error! - Type !stuff2 [ Blah ]."
elseif string.lower(arg) == "blah" then
doReturn = "Ok ok .. Your Share is [ "..doShareCal(user.iShareSize, 5).." ]."
else
doReturn = "Error! - Type !stuff2 [ Blah ]."
end
end,
},
["Timers"] = { -- minimum timer interval is 1 sec!
["doStuff"] = {20,0,"Do Stuff Timer",},
--Syntax is ["Function Name"] = {time_to_exe_in_sec, start_time_on_first_run, "Description",},
--Timers can be viewed by typing !timers
},
--NOTE: CMD and Rightclick is in the proccess of being Merged to allow for easy translation and Cmd Profile Changes
["CMD"] = {
["doMoreStuff"] = {"stuff",-1,"Calling the doMoreStuff function",},
["doMoreStuff2"] = {"stuff2",-1,"Calling the doMoreStuff2 function",},
--Syntax is ["Function Name"] = {"command", min_profile,"Description",}, (Note: description is also used for !help)
},
["Rightclick"] = {
["Stuff Cmd"] = { --Rightclick Title
[1] = {"$UserCommand 1 3 ? Stuff\\ Do Stuff$<%[mynick]> !stuff|",-1,},
[2] = {"$UserCommand 1 3 ? Stuff\\ Do Stuff2$<%[mynick]> !stuff2|",-1,},
--Syntax is [Table index] = {"raw_rightclick",min_profile,}, - min_profile should match that of the CMD min_profile!
},
},
["Asserts"] = {
-- Load Extra files into DiXBoT.
--[1] = "DiXBoT/CoreSystem/FolderName/Filename.lua",
--[2] = "DiXBoT/CoreSystem/FolderName/Filename2.lua",
},
}
DxbModule = HelloWorld -- Used to load functions into DiXBoT. MUST be the name of script AND the same as the filename without ext.
-- This line MUST be placed last in the script!
Some needed Updates will be added to this (CMD and Rightclick will be merged before a final version will be published)
Let me know if this structure is good enough :)
-Snooze (http://www.dixbot.com)