This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
minionlib [2018/04/17 16:48] – fxfire | minionlib [2021/01/17 20:19] – Response headers string to table example kali | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====MinionLib Lua===== | =====MinionLib Lua===== | ||
- | ====GUI API & Functions==== | ||
- | With our GUI API you can easily build your own UI purely in LUA. Each rendered frame the " | ||
- | \\ | ||
- | **GUI Overview: | ||
- | To get an overview what is possible with the UI, open the ingame console (CTRL + C) and execute this command:\\ | ||
- | **'' | ||
- | |||
- | If you find in that testwindow what you need but you are unsure how to build the same in lua, you can have a look in the c++ source of this testwindow : [[https:// | ||
- | \\ | ||
- | **IMPORTANT INFO: | ||
- | Underlined function arguments are __optional__!** | ||
- | Example: \\ | ||
- | '' | ||
- | \\ | ||
- | **IMPORTANT INFO: \\ | ||
- | Most UI Elemet " | ||
- | \\ | ||
- | Example: Name is internal identifier\\ | ||
- | '' | ||
- | Example: Same name in UI, different internal identifier\\ | ||
- | '' | ||
- | '' | ||
- | Example: Different name in UI, same internal identifier\\ | ||
- | '' | ||
- | '' | ||
- | \\ | ||
- | \\ | ||
- | To get you started, let's draw a simple window with a slider, create a new .lua file, add it to your addon' | ||
- | <code lua> | ||
- | -- Draws a Window with a Slider: | ||
- | my_gui = {} | ||
- | my_gui.open = true | ||
- | my_gui.visible = true | ||
- | my_gui.hue = 125 | ||
- | |||
- | function my_gui.Draw( event, ticks ) | ||
- | |||
- | if ( my_gui.open ) then | ||
- | |||
- | | ||
- | |||
- | | ||
- | --If the user would close our Window, "is open" would return " | ||
- | | ||
- | |||
- | if ( my_gui.visible ) then -- visible is true/false depending if the window is collapsed or not, we don't have to render anything in it when it is collapsed | ||
- | -- Again the typical syntax, passing the current value " | ||
- | | ||
- | d(my_gui.hue) | ||
- | end | ||
- | | ||
- | end | ||
- | end | ||
- | RegisterEventHandler(" | ||
- | </ | ||
- | |||
- | \\ | ||
- | \\ | ||
- | |||
- | |||
- | ===Main=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //bool// isopen | ||
- | *Test window, demonstrates GUI features | ||
- | ***'' | ||
- | *Returns: //bool// isopen | ||
- | *Metrics window for debuggings | ||
- | |||
- | ===Utility=== | ||
- | ***'' | ||
- | *Returns: //table// screenpos | ||
- | *Converts a worldposition x,y,z to a screenposition x,y , IF that point is currently visible on the screen | ||
- | |||
- | ===Window=== | ||
- | Usage: GUI:Begin( ... ) | ||
- | ***'' | ||
- | *Returns //bool// visible, //bool// open | ||
- | *// | ||
- | ***'' | ||
- | *For every GUI: | ||
- | ***'' | ||
- | *Begin a scrolling region. size==0.0f: use remaining window size, size< | ||
- | ***'' | ||
- | *For every GUI: | ||
- | |||
- | ***'' | ||
- | *Returns: //number// size | ||
- | *size (also height in pixels) of current font with current scale applied | ||
- | ***'' | ||
- | *per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows | ||
- | | ||
- | |||
- | ***'' | ||
- | *set next window position. call before Begin() | ||
- | ***'' | ||
- | *set next window position to be centered on screen. call before Begin() | ||
- | ***'' | ||
- | *set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() | ||
- | ***'' | ||
- | *set next window content size (enforce the range of scrollbars). set axis to 0.0f to leave it automatic. call before Begin() | ||
- | ***'' | ||
- | *set next window content width (enforce the range of horizontal scrollbar). call before Begin() | ||
- | ***'' | ||
- | *set next window collapsed state. call before Begin() | ||
- | ***'' | ||
- | *set next window to be focused / front-most. call before Begin() | ||
- | ***'' | ||
- | *set current window position - call within Begin()/ | ||
- | ***'' | ||
- | *set current window position - call within Begin()/ | ||
- | ***'' | ||
- | *set current window size. set X,Y to 0 to force an auto-fit. | ||
- | ***'' | ||
- | *set named window size. set X,Y to 0 to force an auto-fit on this axis. | ||
- | ***'' | ||
- | *set current window collapsed state | ||
- | ***'' | ||
- | *set named window collapsed state | ||
- | ***'' | ||
- | *set current/ | ||
- | ***'' | ||
- | *Returns: get scrolling amount [0..GetScrollMaxX()] | ||
- | ***'' | ||
- | *Returns: get scrolling amount [0..GetScrollMaxY()] | ||
- | ***'' | ||
- | *Returns: get maximum scrolling amount ~~ ContentSize.X - WindowSize.X | ||
- | ***'' | ||
- | *Returns: get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y | ||
- | ***'' | ||
- | *set scrolling amount [0..GetScrollMaxX()] | ||
- | ***'' | ||
- | *set scrolling amount [0..GetScrollMaxY()] | ||
- | ***'' | ||
- | *adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: | ||
- | ***'' | ||
- | *adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. | ||
- | ***'' | ||
- | *focus keyboard on the next widget. Use positive ' | ||
- | |||
- | |||
- | ===Style=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *sets the color for the following elements | ||
- | ***'' | ||
- | *removes the last pushed color style(s) | ||
- | ***'' | ||
- | *sets the style for the following elements | ||
- | ***'' | ||
- | *removes the last pushed style var(s) | ||
- | ***'' | ||
- | *Returns: //number// color | ||
- | ***'' | ||
- | *width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side)) | ||
- | ***'' | ||
- | *removes the last pushed item width | ||
- | ***'' | ||
- | *width of item given pushed settings and current cursor position | ||
- | ***'' | ||
- | *word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at ' | ||
- | ***'' | ||
- | *removes the last pushed wrap pos | ||
- | ***'' | ||
- | *allow focusing using TAB/ | ||
- | ***'' | ||
- | *removes the last pushed keyboard focus setting | ||
- | ***'' | ||
- | *in ' | ||
- | ***'' | ||
- | *removes the last pushed button repeat setting | ||
- | |||
- | |||
- | ===Layout=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *lock horizontal starting position. once closing a group it is seen as a single item (so you can use IsItemHovered() on a group, SameLine() between groups, etc. | ||
- | ***'' | ||
- | *Needs to be called for each BeginGroup() | ||
- | ***'' | ||
- | *horizontal line | ||
- | ***'' | ||
- | *call between widgets or groups to layout them horizontally | ||
- | ***'' | ||
- | * undo a SameLine() | ||
- | ***'' | ||
- | *add spacing | ||
- | ***'' | ||
- | *add a dummy item of given size | ||
- | ***'' | ||
- | *move content position toward the right by style.IndentSpacing pixels | ||
- | ***'' | ||
- | *move content position back to the left (cancel Indent) | ||
- | ***'' | ||
- | *setup number of columns. use an identifier to distinguish multiple column sets. close with Columns(1). | ||
- | ***'' | ||
- | *next column | ||
- | ***'' | ||
- | *Returns: //number// current column index | ||
- | ***'' | ||
- | *Returns: //number// get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this | ||
- | ***'' | ||
- | *set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column | ||
- | ***'' | ||
- | *Returns: //number// column width (== GetColumnOffset(GetColumnIndex()+1) - GetColumnOffset(GetColumnOffset()) | ||
- | ***'' | ||
- | *Returns: //number// number of columns (what was passed to Columns()) | ||
- | ***'' | ||
- | *call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets | ||
- | ***'' | ||
- | *Returns: //number// height of font == GetWindowFontSize() | ||
- | ***'' | ||
- | *Returns: //number// height of font == GetWindowFontSize() | ||
- | ***'' | ||
- | *Returns: //number// distance (in pixels) between 2 consecutive lines of standard height widgets == GetWindowFontSize() + GetStyle().FramePadding.y*2 + GetStyle().ItemSpacing.y | ||
- | |||
- | |||
- | ===ID Scopes=== | ||
- | If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them. | ||
- | You can also use "## | ||
- | Usage: GUI:PushID( ... ) | ||
- | ***'' | ||
- | *push identifier into the ID stack. | ||
- | ***'' | ||
- | *pops the last pushed identifier from the ID stack. | ||
- | ***'' | ||
- | *calculate unique ID | ||
- | |||
- | ===Cursor=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | *cursor position is relative to window position | ||
- | ***'' | ||
- | *Returns: //number// x | ||
- | ***'' | ||
- | *Returns: //number// y | ||
- | ***'' | ||
- | *sets cursor position is relative to window position | ||
- | ***'' | ||
- | *sets cursor position x | ||
- | ***'' | ||
- | *sets cursor position y | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | *initial cursor position | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | *cursor position in absolute screen coordinates [0..io.DisplaySize] | ||
- | ***'' | ||
- | *cursor position in absolute screen coordinates [0..io.DisplaySize] | ||
- | |||
- | |||
- | ===Custom Drawing=== | ||
- | Usage: GUI: | ||
- | IMPORTANT: Use GUI: | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | ***'' | ||
- | |||
- | ===Widgets Basic=== | ||
- | Usage: GUI:Text( ... ) | ||
- | ***'' | ||
- | *creates a text element | ||
- | ***'' | ||
- | *creates a colored text element, number range is 0.0 - 1.0 | ||
- | ***'' | ||
- | *creates a disabled text element | ||
- | ***'' | ||
- | *creates a text element which wraps | ||
- | ***'' | ||
- | *creates an unformatted text element | ||
- | ***'' | ||
- | *display text+label aligned the same way as value+label widgets | ||
- | ***'' | ||
- | *creates a bullet element | ||
- | ***'' | ||
- | *creates a bullet text element | ||
- | ***'' | ||
- | *creates a buttom element | ||
- | ***'' | ||
- | *creates a smaller button element | ||
- | ***'' | ||
- | *creates an invisible button element | ||
- | ***'' | ||
- | *creates a freely placable buttom element | ||
- | ***'' | ||
- | *creates a freely placable image buttom element | ||
- | ***'' | ||
- | *creates an image button, scary eh ;) ? Simple usage: GUI: | ||
- | * < 0 frame_padding uses default frame padding settings. 0 for no padding | ||
- | ***'' | ||
- | *Simple Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //bool// collapsed | ||
- | ***'' | ||
- | *Returns: //bool// checked, //bool// pressed | ||
- | ***'' | ||
- | *Returns: //number// flags, //bool// pressed | ||
- | ***'' | ||
- | *Returns: //bool// active | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// pressed | ||
- | ***'' | ||
- | *Returns: //number// current_item_listindex, | ||
- | ***'' | ||
- | *Returns: //bool// pressed | ||
- | ***'' | ||
- | *Returns: //number// R, //number// G, //number// B, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// R, //number// G, //number// B, //number// A, //bool// changed | ||
- | ***'' | ||
- | *sets ColorEditMode | ||
- | ***'' | ||
- | *Guess what it draws ;) | ||
- | |||
- | ===Widgets Drags=== | ||
- | (tip: ctrl+click on a drag box to input text) | ||
- | Usage: GUI:Text( ... ) | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | *display_format example " | ||
- | ***'' | ||
- | *Returns: //number// val_min, //number// val_max, //bool// changed | ||
- | *display_format example " | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | *display_format example " | ||
- | ***'' | ||
- | *Returns: //number// val_min, //number// val_max, //bool// changed | ||
- | *display_format example " | ||
- | |||
- | |||
- | ===Widgets Input=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //string// text, //bool// changed | ||
- | ***'' | ||
- | *Returns: //string// text, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //bool// changed | ||
- | *Draws 2 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //bool// changed | ||
- | *Draws 3 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed | ||
- | *Draws 4 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //bool// changed | ||
- | *Draws 2 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //bool// changed | ||
- | *Draws 3 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed | ||
- | *Draws 4 Input fields behind each other in the same line | ||
- | |||
- | |||
- | ===Widgets Sliders=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //bool// changed | ||
- | *Draws 2 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //bool// changed | ||
- | *Draws 3 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed | ||
- | *Draws 4 Input fields behind each other in the same line | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | ***'' | ||
- | *Returns: //number// val, //bool// changed | ||
- | |||
- | |||
- | ===Widgets Trees=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //bool// changed | ||
- | *if returning ' | ||
- | ***'' | ||
- | *already called by TreeNode(), but you can call Push/Pop yourself for layouting purpose | ||
- | ***'' | ||
- | *needs to be callled at the end of TreePush() | ||
- | ***'' | ||
- | *set next tree node to be opened. | ||
- | |||
- | |||
- | ===Widgets Lists=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //bool// changed | ||
- | *size.x==0.0: | ||
- | ***'' | ||
- | *Returns: //number// current_item_index, | ||
- | ***'' | ||
- | *Returns: //bool// | ||
- | *use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards. | ||
- | ***'' | ||
- | *terminate the scrolling region | ||
- | |||
- | |||
- | ===Widgets Tooltip=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *set tooltip under mouse-cursor, | ||
- | ***'' | ||
- | *use to create full-featured tooltip windows that aren't just text | ||
- | ***'' | ||
- | *use to create full-featured tooltip windows that aren't just text | ||
- | |||
- | ===Widgets Menus=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Returns: //bool// opened | ||
- | *create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true! | ||
- | ***'' | ||
- | *End Menubar drawing | ||
- | ***'' | ||
- | *Returns: //bool// opened | ||
- | *append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set). only call EndMenuBar() if this returns true! | ||
- | ***'' | ||
- | *End Menubar drawing | ||
- | ***'' | ||
- | *Returns: //bool// opened | ||
- | *create a sub-menu entry. only call EndMenu() if this returns true! | ||
- | ***'' | ||
- | *End Menubar drawing | ||
- | ***'' | ||
- | *Returns: //bool// activated, //bool// selected | ||
- | *Shortcuts are currently only visual, aka not working, you need to add that yourself | ||
- | |||
- | ===Widgets Popup=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *mark popup as open. popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/ | ||
- | ***'' | ||
- | *Returns: //bool// open | ||
- | *return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true! | ||
- | ***'' | ||
- | *Returns //bool// visible, //bool// open | ||
- | *modal dialog (can't close them by clicking outside) | ||
- | ***'' | ||
- | *Returns //bool// open | ||
- | *helper to open and begin popup when clicked on last item | ||
- | ***'' | ||
- | *Returns //bool// open | ||
- | *helper to open and begin popup when clicked on current window | ||
- | ***'' | ||
- | *Returns //bool// open | ||
- | *helper to open and begin popup when clicked in void (no window) | ||
- | ***'' | ||
- | *needs to be called on opened popups | ||
- | ***'' | ||
- | *close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. | ||
- | |||
- | |||
- | ===Widgets Utilities=== | ||
- | Usage: GUI: | ||
- | ***'' | ||
- | *Results: // | ||
- | *was the last item hovered by mouse? | ||
- | ***'' | ||
- | *Results: // | ||
- | *was the last item hovered by mouse? even if another item is active while we are hovering this | ||
- | ***'' | ||
- | *Results: // | ||
- | *was the last item clicked? (e.g. button/node just clicked on) | ||
- | ***'' | ||
- | *Results: // | ||
- | *was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) | ||
- | ***'' | ||
- | *Results: // | ||
- | *was the last item visible? (aka not out of sight due to clipping/ | ||
- | ***'' | ||
- | *Results: // | ||
- | ***'' | ||
- | *Results: // | ||
- | ***'' | ||
- | *Results: //number// x, //number// y | ||
- | *get bounding rect of last item in screen space | ||
- | ***'' | ||
- | *Results: //number// x, //number// y | ||
- | *get bounding rect of last item in screen space | ||
- | ***'' | ||
- | *Results: //number// x, //number// y | ||
- | ***'' | ||
- | *Allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, | ||
- | ***'' | ||
- | *Results: // | ||
- | *is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others) | ||
- | ***'' | ||
- | *Results: // | ||
- | *is current window focused | ||
- | ***'' | ||
- | *Results: // | ||
- | *is current root window focused (top parent window in case of child windows) | ||
- | ***'' | ||
- | *Results: // | ||
- | *is current root window or any of its child (including current window) focused | ||
- | ***'' | ||
- | *Results: // | ||
- | *test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side | ||
- | ***'' | ||
- | *Results: // | ||
- | *is given position hovering any active imgui window | ||
- | ***'' | ||
- | *Results: // | ||
- | ***'' | ||
- | *Results: // | ||
- | ***'' | ||
- | *Results: //number// x, //number// y | ||
- | *utility to find the closest point the last item bounding rectangle edge. useful to visually link items | ||
- | ***'' | ||
- | *Results: //number// sizex, //number// sizey | ||
- | ***'' | ||
- | *Results: //number// out1, //number// out2 | ||
- | *calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can. | ||
- | ***'' | ||
- | *Results: //bool// | ||
- | *helper to create a child window / scrolling region that looks like a normal widget frame | ||
- | ***'' | ||
- | *needs to be called at the end of BeginChildFrame. | ||
- | ***'' | ||
- | *Returns: //number// val1,// | ||
- | ***'' | ||
- | *Returns: //number// U32val | ||
- | ***'' | ||
- | *Returns: //number// h, //number// s, //number// v | ||
- | ***'' | ||
- | *Returns: //number// r, //number// g, //number// b | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | ***'' | ||
- | *Returns: // | ||
- | *https:// | ||
- | ***'' | ||
- | *Returns: // | ||
- | *https:// | ||
- | ***'' | ||
- | *Returns: // | ||
- | *https:// | ||
- | ***'' | ||
- | *Returns: // | ||
- | ***'' | ||
- | *Returns: //bool// | ||
- | ***'' | ||
- | *Returns: // | ||
- | ***'' | ||
- | *Returns: // | ||
- | ***'' | ||
- | *Returns: // | ||
- | *is mouse hovering current window (" | ||
- | ***'' | ||
- | *Returns: // | ||
- | ***'' | ||
- | *Returns: // | ||
- | *is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/ | ||
- | ***'' | ||
- | *Returns: // | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | *retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into | ||
- | ***'' | ||
- | *Returns: //number// x, //number// y | ||
- | *dragging amount since clicking. | ||
- | ***'' | ||
- | *Banana ;) | ||
- | |||
- | |||
- | \\ | ||
- | |||
- | |||
- | |||
- | ===Enums & Flags=== | ||
- | These are registered values in the GUI metatable. //Usage: d(GUI.WindowFlags_NoMove)// | ||
- | |||
- | ==WindowFlags== | ||
- | * GUI.WindowFlags_NoTitleBar | ||
- | * GUI.WindowFlags_NoResize | ||
- | * GUI.WindowFlags_NoMove | ||
- | * GUI.WindowFlags_NoScrollbar | ||
- | * GUI.WindowFlags_NoScrollWithMouse | ||
- | * GUI.WindowFlags_NoCollapse | ||
- | * GUI.WindowFlags_AlwaysAutoResize | ||
- | * GUI.WindowFlags_ShowBorders | ||
- | * GUI.WindowFlags_NoSavedSettings | ||
- | * GUI.WindowFlags_NoInputs | ||
- | * GUI.WindowFlags_MenuBar | ||
- | * GUI.WindowFlags_HorizontalScrollbar | ||
- | * GUI.WindowFlags_NoFocusOnAppearing | ||
- | * GUI.WindowFlags_NoBringToFrontOnFocus | ||
- | * GUI.WindowFlags_ForceVerticalScrollbar | ||
- | * GUI.WindowFlags_ForceHorizontalScrollbar | ||
- | |||
- | ==InputTextFlags== | ||
- | * GUI.InputTextFlags_CharsDecimal | ||
- | * GUI.InputTextFlags_CharsHexadecimal | ||
- | * GUI.InputTextFlags_CharsUppercase | ||
- | * GUI.InputTextFlags_CharsNoBlank | ||
- | * GUI.InputTextFlags_AutoSelectAll | ||
- | * GUI.InputTextFlags_EnterReturnsTrue | ||
- | * GUI.InputTextFlags_CallbackCompletion | ||
- | * GUI.InputTextFlags_CallbackHistory | ||
- | * GUI.InputTextFlags_CallbackAlways | ||
- | * GUI.InputTextFlags_CallbackCharFilter | ||
- | * GUI.InputTextFlags_AllowTabInput | ||
- | * GUI.InputTextFlags_CtrlEnterForNewLine | ||
- | * GUI.InputTextFlags_NoHorizontalScroll | ||
- | * GUI.InputTextFlags_AlwaysInsertMode | ||
- | * GUI.InputTextFlags_ReadOnly | ||
- | * GUI.InputTextFlags_Password | ||
- | |||
- | ==SelectableFlags== | ||
- | * GUI.SelectableFlags_DontClosePopups | ||
- | * GUI.SelectableFlags_SpanAllColumns | ||
- | * GUI.SelectableFlags_AllowDoubleClick | ||
- | |||
- | |||
- | ==SelectableFlags== | ||
- | * GUI.SelectableFlags_DontClosePopups | ||
- | * GUI.SelectableFlags_SpanAllColumns | ||
- | * GUI.SelectableFlags_AllowDoubleClick | ||
- | |||
- | |||
- | ==PushStyleColor== | ||
- | * GUI.Col_Text | ||
- | * GUI.Col_TextDisabled | ||
- | * GUI.Col_WindowBg | ||
- | * GUI.Col_ChildWindowBg | ||
- | * GUI.Col_Border | ||
- | * GUI.Col_BorderShadow | ||
- | * GUI.Col_FrameBg | ||
- | * GUI.Col_FrameBgHovered | ||
- | * GUI.Col_FrameBgActive | ||
- | * GUI.Col_TitleBg | ||
- | * GUI.Col_TitleBgCollapsed | ||
- | * GUI.Col_TitleBgActive | ||
- | * GUI.Col_MenuBarBg | ||
- | * GUI.Col_ScrollbarBg | ||
- | * GUI.Col_ScrollbarGrab | ||
- | * GUI.Col_ScrollbarGrabHovered | ||
- | * GUI.Col_ScrollbarGrabActive | ||
- | * GUI.Col_ComboBg | ||
- | * GUI.Col_CheckMark | ||
- | * GUI.Col_SliderGrab | ||
- | * GUI.Col_SliderGrabActive | ||
- | * GUI.Col_Button | ||
- | * GUI.Col_ButtonHovered | ||
- | * GUI.Col_ButtonActive | ||
- | * GUI.Col_Header | ||
- | * GUI.Col_HeaderHovered | ||
- | * GUI.Col_HeaderActive | ||
- | * GUI.Col_Column | ||
- | * GUI.Col_ColumnHovered | ||
- | * GUI.Col_ColumnActive | ||
- | * GUI.Col_ResizeGrip | ||
- | * GUI.Col_ResizeGripHovered | ||
- | * GUI.Col_ResizeGripActive | ||
- | * GUI.Col_CloseButton | ||
- | * GUI.Col_CloseButtonHovered | ||
- | * GUI.Col_CloseButtonActive | ||
- | * GUI.Col_PlotLines | ||
- | * GUI.Col_PlotLinesHovered | ||
- | * GUI.Col_PlotHistogram | ||
- | * GUI.Col_PlotHistogramHovered | ||
- | * GUI.Col_TextSelectedBg | ||
- | * GUI.Col_TooltipBg | ||
- | * GUI.Col_ModalWindowDarkening | ||
- | |||
- | ==PushStyleVar== | ||
- | * GUI.StyleVar_Alpha | ||
- | * GUI.StyleVar_WindowPadding | ||
- | * GUI.StyleVar_WindowRounding | ||
- | * GUI.StyleVar_WindowMinSize | ||
- | * GUI.StyleVar_ChildWindowRounding | ||
- | * GUI.StyleVar_FramePadding | ||
- | * GUI.StyleVar_FrameRounding | ||
- | * GUI.StyleVar_ItemSpacing | ||
- | * GUI.StyleVar_ItemInnerSpacing | ||
- | * GUI.StyleVar_IndentSpacing | ||
- | * GUI.StyleVar_GrabMinSize | ||
- | |||
- | ==Align== | ||
- | * GUI.Align_Left | ||
- | * GUI.Align_Center | ||
- | * GUI.Align_Right | ||
- | * GUI.Align_Top | ||
- | * GUI.Align_VCenter | ||
- | * GUI.Align_Default | ||
- | |||
- | ==SetCondFlags== | ||
- | * GUI.SetCond_Always | ||
- | * GUI.SetCond_Once | ||
- | * GUI.SetCond_FirstUseEver | ||
- | * GUI.SetCond_Appearing | ||
- | |||
- | |||
- | |||
- | ====Core Functions & Helper Functions==== | ||
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: | 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: | ||
<code lua> | <code lua> | ||
Line 783: | Line 59: | ||
ml_gui.ui_mgr: | ml_gui.ui_mgr: | ||
</ | </ | ||
+ | |||
===Utility Functions=== | ===Utility Functions=== | ||
+ | |||
+ | ==General== | ||
+ | ***'' | ||
+ | *Prints out the passed variable or the result of a function into the console. | ||
+ | ***'' | ||
+ | *Prints out the current call stack into the console. | ||
+ | ***'' | ||
+ | *Closes the current game instance | ||
+ | ***'' | ||
+ | *Prints our the passed variable or the result of a function into the console when gEnableLog == " | ||
+ | ***'' | ||
+ | *Prints our the passed variable or the result of a function into the console. | ||
+ | ***'' | ||
+ | *Adds the string to the statusbar-line which gets shown on each pulse. | ||
+ | ***'' | ||
+ | *Returns tickcount from ml_global_information.Now | ||
+ | ***'' | ||
+ | *Registers a local handler to an event | ||
+ | ***'' | ||
+ | *Returns //bool// , reloads all lua modules | ||
+ | ***'' | ||
+ | *Returns //integer// ml_global_information.Now - previousTime | ||
+ | ***'' | ||
+ | *Returns //bool// , tries to unload the bot | ||
+ | ***'' | ||
+ | *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings. | ||
+ | *Use RegisterEventHandler(" | ||
+ | |||
+ | |||
==File I/O== | ==File I/O== | ||
For every I/O function, you need to use double dashes! Example: FolderExists(" | For every I/O function, you need to use double dashes! Example: FolderExists(" | ||
Line 802: | Line 108: | ||
***'' | ***'' | ||
*Returns // | *Returns // | ||
+ | ***'' | ||
+ | *Returns // | ||
+ | ***'' | ||
+ | *Returns //number// | ||
***'' | ***'' | ||
*Returns //bool// | *Returns //bool// | ||
Line 902: | Line 212: | ||
- | ==General== | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console. | ||
- | ***'' | ||
- | *Closes the current game instance | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console when gEnableLog == " | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console. | ||
- | ***'' | ||
- | *Adds the string to the statusbar-line which gets shown on each pulse. | ||
- | ***'' | ||
- | *Returns tickcount from ml_global_information.Now | ||
- | ***'' | ||
- | *Registers a local handler to an event | ||
- | ***'' | ||
- | *Returns //bool// , reloads all lua modules | ||
- | ***'' | ||
- | *Returns //integer// ml_global_information.Now - previousTime | ||
- | ***'' | ||
- | *Returns //bool// , tries to unload the bot | ||
- | ***'' | ||
- | *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings. | ||
- | *Use RegisterEventHandler(" | ||
==Navigation== | ==Navigation== | ||
Line 933: | Line 219: | ||
+ | |||
+ | ==Structure== | ||
+ | |||
+ | 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// '' | ||
+ | All component headers optionally contain the following properties: **// | ||
+ | |||
+ | 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: **// | ||
+ | All members optionally contain the following properties: **// | ||
+ | |||
+ | Submembers are displayed to the right and grow vertically downward. | ||
+ | Submembers will be sorted in alphabetical order by name if the **'' | ||
+ | All submembers require the following properties: **// | ||
+ | All submembers optionally contain the following properties: **// | ||
+ | |||
+ | ==API== | ||
+ | |||
+ | ***'' | ||
+ | ***'' | ||
+ | ***'' | ||
+ | |||
+ | |||
+ | ===HTTPRequest=== | ||
+ | Use this function to do any kind of asynchronous http calls. Example: | ||
+ | |||
+ | <code lua> | ||
+ | function SendHttpRequest() | ||
+ | local function success(str, | ||
+ | d(" | ||
+ | d(" | ||
+ | d(" | ||
+ | |||
+ | local data = json.decode(str) | ||
+ | if data then | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | local function HeadersTable(header) | ||
+ | if type(header) == " | ||
+ | header = string.match(header," | ||
+ | local tbl = {} | ||
+ | for w in header: | ||
+ | local k,v = string.match(w," | ||
+ | | ||
+ | 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, | ||
+ | d(" | ||
+ | d(" | ||
+ | d(" | ||
+ | end | ||
+ | |||
+ | local params = { | ||
+ | host = " | ||
+ | path = "/ | ||
+ | port = 443, | ||
+ | method = " | ||
+ | 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 = "", | ||
+ | headers = {}, --optional, if not required for your call can be nil or "" | ||
+ | } | ||
+ | |||
+ | | ||
+ | end | ||
+ | </ |