Menu:
menu-MainMenu object in DLib
use menu.addItem(MenuObject) to add something to main menu. Returns added object.
local submenu=menu.addItem(SubMenu.new("Test"))
SubMenu
SubMenu.new(String name) returns submenu object that can be added to mainmenu/submenu
local submenu2=submenu.addItem(SubMenu.new("Test"))
or(same effect)
local submenu2=SubMenu.new("Test")
submenu.addItem(submenu2)
Has method .addItem(MenuItem) like main menu
MenuBool
An ON/OFF switch
MenuBool.new(String name, [boolean initial value])
MenuSeparator
Does nothing, just contains a string
MenuSeparator.new(String name)
MenuSlider
A Slider
MenuSlider.new(String name, number initial value, number min value, number max value, number step)
MenuStringList
MenuStringList.new(String name, indexed table<String>)
First item is default.
MenuKeyBind
See http://cherrytree.at/misc/vk.htm
MenuKeyBind.new(String name, number default keycode)
Every MenuItem has methods:
- .getValue() returns item's value
Bool: true/false
Slider: number
StringList: selected index, number
KeyBind: key pressed, boolean, if you call .getValue(true) for KeyBind, it will return selected keycode
- .setValue(value)
- .setHeight(number)
- .setWidth(number)
- .expand(number)
Example code used to create menu from screens:
require ("DLib")
local submenu = menu.addItem(SubMenu.new("Test"))
submenu.addItem(MenuBool.new("On/Off"))
submenu.addItem(MenuSeparator.new("Separator"))
local sl = submenu.addItem(MenuSlider.new("Slider", 5, 0, 10, 1))
submenu.addItem(MenuStringList.new("List", {"Option 1", "Option 2", "Option 3"}))
local comb = submenu.addItem(MenuKeyBind.new("Combo!", 32))
OnLoop(function(myHero)
if comb.getValue() then
PrintChat("Combo key pressed")
end
PrintChat("Slider's value: "..sl.getValue())
end)
Notification:
notification(message, duration, animationscale, fontsize, textcolor, drawcolor)
- message: text
- duration[optional]: time in miliseconds after nofication disappears, default:2000
- animationscale: how fast in/out animation is, default : 1 use numbers between 0.1 and 10
- fontsize: text's size
- drawcolor[optional]: rectangle's color, default like on screens
- textcolor[optional]: text's color, default like on screens
example:
notification(" updated.\n F6-F6 to reload.", 5000)
prequire:
prequire("module")
returns module, if module not found, returns nil
requireDL
requireDL(script, address, retry)
loads and returns module, if module not found tries to download it and saves in Common
script:name of the module
address: link to github in form "DrakeSharp/GOS/master/RecallTracker.lua"
retry[optional]: how many retries, default 4
delay
delay(function, time)
delays function execution by given amount of time in miliseconds
Example:
delay(function()
notification(this.name.." updated.\n F6-F6 to reload.", 5000)
end, 5000)
Geometry and other documentation soon™
propably tomorrow