This minionlib library is holding the core functionality on which all our bots are running. You can freely use the available functions for your Addon, in order to do that, you just need to open your module.def and set the dependency of your Addon to the minionlib:
[Module] Name=YourAddon Dependencies=minionlib Version=1 Files=myluacode.lua Enabled=1
The Minion Menu is the main menu used by minion to access all settings and addons. 3rd-party developers may add custom options to the menu in several different ways.
The minion is layered into 3 distinct parts, components, members, and submembers.
All components must have a header and (optionally) members, which are displayed when the header is clicked (and the menu is open).
All component headers require the following properties: bool expanded
, string name
, string id
All component headers optionally contain the following properties: string texture
Members are displayed below their component containers, and they represent the rows that appear directly below the header.
Members may optionally contain submembers.
All members require the following properties: string name
, string id
All members optionally contain the following properties: string texture
, string tooltip
, function onClick
, bool sort
Submembers are displayed to the right and grow vertically downward. They are useful if you wish to section off a large amount of events.
Submembers will be sorted in alphabetical order by name if the sort
tag is specified on the parent member.
All submembers require the following properties: string name
, string id
All submembers optionally contain the following properties: string texture
, string tooltip
, function onClick
ml_gui.ui_mgr:AddComponent( table component)
ml_gui.ui_mgr:AddMember( table member, string componentid)
ml_gui.ui_mgr:AddComponent( table submember, string componentid, string memberid)
local ffxiv_mainmenu = { header = { id = "FFXIVMINION##MENU_HEADER", expanded = false, name = "FFXIVMinion", texture = GetStartupPath().."\\GUI\\UI_Textures\\ffxiv_shiny.png"}, members = { } } ml_gui.ui_mgr:AddComponent(ffxiv_mainmenu) ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV1", name = "Dev1", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER") ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV2", name = "Dev2", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER") ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV3", name = "Dev3", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER") ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV4", name = "Dev4", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER") ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV5", name = "Dev5", onClick = function() Dev.GUI.open = not Dev.GUI.open end, sort = true},"FFXIVMINION##MENU_HEADER") ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_1", name = "DevA", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5") ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_2", name = "DevE", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5") ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_3", name = "DevM", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5") ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_4", name = "DevC", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5")
d(…)
stacktrace()
Exit()
ml_debug( string str )
ml_error( string str )
ml_log( string str )
Now()
RegisterEventHandler(string eventtoregisterfor,function handler, string customNameHereToIdentifyYourCode)
Reload()
TimeSince(integer previousTime)
Unload()
QueueEvent( string eventname, string args, …)
For every I/O function, you need to use double dashes! Example: FolderExists(“c:\\minionapp\\ILikeBeer\\Folder”)
GetStartupPath()
GetLuaModsPath()
FileExists(string fullpathtofile)
FileLoad(string fullpathtofile)
FileSave(string fullpathtofile, variant data)
FileWrite(string fullpathtofile, string data)
FileWrite(string fullpathtofile, string data, bool arg)
FileDelete(string fullpathtofile)
FileIsValidImage(string fullpathtofile)
FileSize(string fullpathtofile)
FolderExists(string fullpathtofolder)
FolderCreate(string fullpathtofolder)
FolderDelete(string fullpathtofolder)
FolderList(string fullpathtofolder, string pattern=““, bool includeFolders=false)
The following functions extend the default string from the lua library. Usage: string.contains(..)
contains(string arg, string arg2)
empty(string arg)
ends(string arg, string arg2)
split(string arg, string seperator)
starts(string arg, string arg2)
toboolean(string arg)
totable(string arg, string seperator)
trim(string arg, int num)
valid(string arg)
starts(string str, string starts)
ends(string str, string ends)
hash(string arg)
The following functions extend the default table from the lua library. Usage: table.valid(..)
clear(table arg )
contains(table table, value)
deepcopy(table arg, bool skipMetaTable )
deepcompare(table table1, table table2, bool ignore_metatable)
delete(table table, variant object)
find(table table, value)
invert(table arg )
merge(table table1, table table2, bool keepexistingentries)
pairsbykeys(table table1, function sort)
pairsbyvalue(table table1, function sort)
print(table arg )
randomvalue(table arg )
shallowcopy(table arg )
size(table arg )
valid(table arg )
The following functions extend the default math from the lua library. Usage: math.distance3d(..)
angle(table heading1, table heading2)
approxequal(number num1, number num2)
crossproduct(table pos1, table pos2)
distance2d(number x, number y, number x1, number y1)
distance3d(table pos1, table pos2)
distance3d(number x, number y, number z, number x1, number y1, number z1)
distancepointline(table p1, table p2, table p3)
magnitude(table pos)
round(number num, integer decimals)
randomize(integer int)
PathDistance(table posTable)
The minion is layered into 3 distinct parts, components, members, and submembers.
All components must have a header and (optionally) members, which are displayed when the header is clicked (and the menu is open).
All component headers require the following properties: bool expanded
, string name
, string id
All component headers optionally contain the following properties: string texture
Members are displayed below their component containers, and they represent the rows that appear directly below the header.
Members may optionally contain submembers.
All members require the following properties: string name
, string id
All members optionally contain the following properties: string texture
, string tooltip
, function onClick
, bool sort
Submembers are displayed to the right and grow vertically downward. They are useful if you wish to section off a large amount of events.
Submembers will be sorted in alphabetical order by name if the sort
tag is specified on the parent member.
All submembers require the following properties: string name
, string id
All submembers optionally contain the following properties: string texture
, string tooltip
, function onClick
ml_gui.ui_mgr:AddComponent( table component)
ml_gui.ui_mgr:AddMember( table member, string componentid)
ml_gui.ui_mgr:AddComponent( table submember, string componentid, string memberid)
Use this function to do any kind of asynchronous http calls. Example:
function SendHttpRequest() local function success(str, header, statuscode) d("HTTP Request: success.") d("HTTP Result Header: " .. tostring(header)) d("HTTP Result StatusCode: " .. tostring(statuscode)) local data = json.decode(str) if data then d("HTTP Request: data valid. Currency Coin info:") d(data) end local function HeadersTable(header) if type(header) == "string" and #header > 0 then header = string.match(header,".?%c(.*)") -- Removing the first entry local tbl = {} for w in header:gmatch("[^%c]+") do local k,v = string.match(w,"(.*): (.*)") tbl[k] = v end table.print(tbl) return tbl end end header = HeadersTable(header) -- if you want to convert the header string to a table end local function failed(error, header, statuscode) d("HTTP Failed Error: " .. error) d("HTTP Failed Header: " .. header) d("HTTP Failed StatusCode: " .. tostring(statuscode)) end local params = { host = "api.guildwars2.com", path = "/v2/currencies?ids=1", port = 443, method = "GET", -- "GET","POST","PUT","DELETE" https = true, onsuccess = success, onfailure = failed, getheaders = true, --true will return the headers, if you dont need it you can leave this at nil body = "", --optional, if not required for your call can be nil or "" headers = {}, --optional, if not required for your call can be nil or "" } HttpRequest(params) end