User Tools

Site Tools



minionlib

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
minionlib [2017/10/11 20:53] mmoaltminionlib [2021/04/30 18:13] (current) ace
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 "Gameloop.Draw" - Event gets called. You need to register a function for this event and let it draw/build your UI. There are no c++ sided objects created or maintained, everything you have to do in LUA. \\ 
-\\ 
-**GUI Overview:**\\ 
-To get an overview what is possible with the UI, open the ingame console (CTRL + C) and execute this command:\\ 
-**''ml_gui.showtestwindow = true''**\\ 
- 
-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://github.com/ocornut/imgui/blob/master/imgui_demo.cpp]], the used function names and syntax in there are 99% the same, just the arguments may be slightly different due to lua not supporting references.\\ 
-\\ 
-**IMPORTANT INFO:\\  
-Underlined function arguments are __optional__!** 
-Example: \\ 
-''GUI:Begin(//string// name, //bool// open, __[[minionlib#WindowFlags|windowflags]] flags__)''\\ 
-\\ 
-**IMPORTANT INFO: \\ 
-Most UI Elemet "names" or "labels" are at the same time their internal identifier.** 
-\\ 
-Example: Name is internal identifier\\  
-''GUI:Begin("Banana", true)''\\ 
-Example: Same name in UI, different internal identifier\\  
-''GUI:Begin("Banana##123hohoho", true)''\\ 
-''GUI:Begin("Banana##hohoho456", true)''\\  
-Example: Different name in UI, same internal identifier\\  
-''GUI:Begin("Banana###123hohoho", true)''\\  
-''GUI:Begin("Pineapple###123hohoho", true)''\\  
-\\ 
-\\ 
-To get you started, let's draw a simple window with a slider, create a new .lua file, add it to your addon's module.def and put the following code into that new lua file: 
-<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  
- 
-           GUI:SetNextWindowSize(250,400,GUI.SetCond_FirstUseEver) -- set the next window size, only on first ever, GUI.SetCond_FirstUseEver is one of many possible enums. 
-            
-           --GUI:Begin takes in two arguments, the name of the window and the current "is open" bool. It returns "is visible/is not collapsed" and the "is open" bool again. 
-           --If the user would close our Window, "is open" would return "false", else it will keep returning "true" as long as the window is open. 
-    my_gui.visible, my_gui.open = GUI:Begin("My Fancy GUI", my_gui.open) 
-     
-           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 "hue" to the function as argument and receiving back the (un-)changed value.  
-     my_gui.hue = GUI:SliderInt("Master HUE",my_gui.hue,0,255) 
-         d(my_gui.hue)  -- spam print out the current value 
-    end 
-    GUI:End()  -- THIS IS IMPORTANT! For EVERY BEGIN() you NEED to ALWAYS call END(), it does not matter if the window is visible/open or not! Same goes with BeginChild() & EndChild() and others ! 
-        end  
-end 
-RegisterEventHandler("Gameloop.Draw", my_gui.Draw) 
-</code> 
- 
-\\ 
-\\ 
- 
- 
-===Main=== 
-Usage: GUI:ShowTestWindow( isopen ) 
-  ***''ShowTestWindow(//bool// isopen)''** 
-    *Returns: //bool// isopen 
-    *Test window, demonstrates GUI features 
-  ***''ShowMetricsWindow(//bool// isopen)''** 
-    *Returns: //bool// isopen 
-    *Metrics window for debuggings 
- 
-===Utility=== 
-  ***''RenderManager:WorldToScreen(//table// worldpos)''** 
-    *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( ... ) 
-  ***''Begin(//string// name, //bool// open, __[[minionlib#WindowFlags|windowflags]] flags__)''** 
-    *Returns //bool// visible, //bool// open 
-    *//visible// means "not collapsed", so can opt out early when window is collapsed. For WindowFlags, check the Enums & Flags further below on this page. 
-  ***''End()''** 
-    *For every GUI:Begin(..) call, you need to call GUI:End(), independent if the the window is opened/shown or not. 
-  ***''BeginChild(//string// name, __//int// sizeX__, __//int// sizeY__, __//bool// border__, __[[minionlib#WindowFlags|windowflags]] flags__''** 
-    *Begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. sizeX=0 & sizeY=400. 
-  ***''EndChild()''** 
-    *For every GUI:BeginChild(..) call, you need to call GUI:EndChild(). 
-  ***''GetContentRegionMax()''** 
-    *Returns: //number// x, //number// y 
-    *current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates 
-  ***''GetContentRegionAvail()''** 
-    *Returns: //number// x, //number// y 
-    *== GetContentRegionMax() - GetCursorPos() 
-  ***''GetContentRegionAvailWidth()''** 
-    *Returns: //number// width 
-  ***''GetWindowContentRegionMin()''** 
-    *Returns: //number// x, //number// y 
-    *content boundaries min (roughly (0,0)-Scroll), in window coordinates 
-  ***''GetWindowContentRegionMax()''** 
-    *Returns: //number// x, //number// y 
-    *content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates 
-  ***''GetWindowContentRegionWidth()''** 
-    *Returns: //number// witdth 
-  ***''GetWindowFontSize()''** 
-    *Returns: //number// size 
-    *size (also height in pixels) of current font with current scale applied 
-  ***''SetWindowFontScale( //number// scale)''** 
-    *per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows 
-  ***''GetWindowPos()''** 
-    *Returns: //number// x, //number// y 
-    *get current window position in screen space 
-  ***''GetWindowSize()''** 
-    *Returns: //number// x, //number// y 
-    *get current window size 
-  ***''GetWindowWidth()''** 
-    *Returns: //number// width 
-  ***''GetWindowHeight()''** 
-    *Returns: //number// height 
-  ***''IsWindowCollapsed()''** 
-    *Returns: //bool// collapsed 
-  ***''SetNextWindowPos( //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set next window position. call before Begin() 
-  ***''SetNextWindowPosCenter( __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set next window position to be centered on screen. call before Begin() 
-  ***''SetNextWindowSize( //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() 
-  ***''SetNextWindowContentSize( //number// X, //number// Y)''** 
-    *set next window content size (enforce the range of scrollbars). set axis to 0.0f to leave it automatic. call before Begin() 
-  ***''SetNextWindowContentWidth( //number// width)''** 
-    *set next window content width (enforce the range of horizontal scrollbar). call before Begin()  
-  ***''SetNextWindowCollapsed( //bool// collapsed, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set next window collapsed state. call before Begin() 
-  ***''SetNextWindowFocus()''** 
-    *set next window to be focused / front-most. call before Begin() 
-  ***''SetWindowPos( //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set current window position - call within Begin()/End(). 
-  ***''SetWindowPos( //string// name, //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set current window position - call within Begin()/End(). may incur tearing  
-  ***''SetWindowSize( //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set current window size. set X,Y to 0 to force an auto-fit. 
-  ***''SetWindowSize( //string// name, //number// X, //number// Y, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set named window size. set X,Y to 0 to force an auto-fit on this axis. 
-  ***''SetWindowCollapsed( //bool// collapsed, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set current window collapsed state 
-  ***''SetWindowCollapsed( //string// name, //bool// collapsed, __[[minionlib#SetCondflags|SetCondflags]] flags__)''** 
-    *set named window collapsed state 
-  ***''SetWindowFocus( __//string// name__)''** 
-    *set current/named window to be focused / front-most 
-  ***''GetScrollX()''** 
-    *Returns: get scrolling amount [0..GetScrollMaxX()] 
-  ***''GetScrollY()''** 
-    *Returns: get scrolling amount [0..GetScrollMaxY()] 
-  ***''GetScrollMaxX()''** 
-    *Returns: get maximum scrolling amount ~~ ContentSize.X - WindowSize.X 
-  ***''GetScrollMaxY()''** 
-    *Returns: get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y 
-  ***''SetScrollX( //number// scrollX)''** 
-    *set scrolling amount [0..GetScrollMaxX()] 
-  ***''SetScrollY( //number// scrollX)''** 
-    *set scrolling amount [0..GetScrollMaxY()] 
-  ***''SetScrollHere( __//number// center_y_ratio__)''** 
-    *adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. 
-  ***''SetScrollFromPosY( //number// pos_y, __//number// center_y_ratio__)''** 
-    *adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. 
-  ***''SetKeyboardFocusHere(__//number// offset__)''** 
-    *focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget 
- 
- 
-===Style=== 
-Usage: GUI:PushStyleColor( ... ) 
-  ***''PushStyleColor([[minionlib#ImGuiCol|ImGuiCol]] flags, //number// R, //number// G, //number// B, //number// A)''** 
-    *sets the color for the following elements 
-  ***''PopStyleColor( __//number// count__ )''** 
-    *removes the last pushed color style(s) 
-  ***''PushStyleVar([[minionlib#StyleVar|StyleVar]] flags, //number// val, __//number// val2__)''** 
-    *sets the style for the following elements 
-  ***''PopStyleVar( __//number// count__ )''** 
-    *removes the last pushed style var(s) 
-  ***''GetColorU32( //number// r, //number// g, //number// b, //number// a  )''** 
-    *Returns: //number// color 
-  ***''PushItemWidth( //number// item_width )''** 
-    *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)) 
-  ***''PopItemWidth( )''** 
-    *removes the last pushed item width 
-  ***''CalcItemWidth( )''** 
-    *width of item given pushed settings and current cursor position    
-  ***''PushTextWrapPos( __//number// wrap_pos_x__ )''** 
-    *word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space 
-  ***''PopTextWrapPos( )''** 
-    *removes the last pushed wrap pos 
-  ***''PushAllowKeyboardFocus( //bool// val )''** 
-    *allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets 
-  ***''PopAllowKeyboardFocus( )''** 
-    *removes the last pushed keyboard focus setting 
-  ***''PushButtonRepeat( //bool// repeat)''** 
-    *in 'repeat' mode, Button functions return repeated true in a typematic manner. 
-  ***''PopButtonRepeat( )''** 
-    *removes the last pushed button repeat setting 
- 
- 
-===Layout=== 
-Usage: GUI:BeginGroup( ... ) 
-  ***''BeginGroup( )''** 
-    *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. 
-  ***''EndGroup( )''** 
-    *Needs to be called for each BeginGroup() 
-  ***''Separator( )''** 
-    *horizontal line 
-  ***''SameLine( __//number// local_pos_x__, __//number// spacing_w__ )''** 
-    *call between widgets or groups to layout them horizontally 
-  ***''NewLine()''** 
-    * undo a SameLine() 
-  ***''Spacing( )''** 
-    *add spacing 
-  ***''Dummy( //number// sizeX, //number// sizeY )''** 
-    *add a dummy item of given size 
-  ***''Indent( )''** 
-    *move content position toward the right by style.IndentSpacing pixels 
-  ***''Unindent( )''** 
-    *move content position back to the left (cancel Indent) 
-  ***''Columns( //number// count, __//string// name__, __//bool// border__ )''** 
-    *setup number of columns. use an identifier to distinguish multiple column sets. close with Columns(1). 
-  ***''NextColumn( )''** 
-    *next column 
-  ***''GetColumnIndex( )''** 
-    *Returns: //number// current column index 
-  ***''GetColumnOffset( __//int// 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 
-  ***''SetColumnOffset( //int// column_index, //number// offset_x )''** 
-    *set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column 
-  ***''GetColumnWidth( __//int// column_index__ )''** 
-    *Returns: //number// column width (== GetColumnOffset(GetColumnIndex()+1) - GetColumnOffset(GetColumnOffset()) 
-  ***''GetColumnsCount( )''** 
-    *Returns: //number// number of columns (what was passed to Columns()) 
-  ***''AlignFirstTextHeightToWidgets( )''** 
-    *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 
-  ***''GetTextLineHeight( )''** 
-    *Returns: //number// height of font == GetWindowFontSize() 
-  ***''GetTextLineHeightWithSpacing( )''** 
-    *Returns: //number// height of font == GetWindowFontSize() 
-  ***''GetItemsLineHeightWithSpacing( )''** 
-    *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 "##extra" within your widget name to distinguish them from each others. 
-Usage: GUI:PushID( ... ) 
-  ***''PushID( //string// id)''** 
-    *push identifier into the ID stack. 
-  ***''PopID( )''** 
-    *pops the last pushed identifier from the ID stack. 
-  ***''GetID( //string// id)''** 
-    *calculate unique ID 
- 
-===Cursor=== 
-Usage: GUI:GetCursorPos( ... ) 
-  ***''GetCursorPos( )''** 
-    *Returns: //number// x, //number// y 
-    *cursor position is relative to window position 
-  ***''GetCursorPosX( )''** 
-    *Returns: //number// x 
-  ***''GetCursorPosY( )''** 
-    *Returns: //number// y 
-  ***''SetCursorPos( //number// x, //number// y )''** 
-    *sets cursor position is relative to window position 
-  ***''SetCursorPosX( //number// x )''** 
-    *sets cursor position x 
-  ***''SetCursorPosY( //number// y )''** 
-    *sets cursor position y 
-  ***''GetCursorStartPos( )''** 
-    *Returns: //number// x, //number// y 
-    *initial cursor position 
-  ***''GetCursorScreenPos( )''** 
-    *Returns: //number// x, //number// y 
-    *cursor position in absolute screen coordinates [0..io.DisplaySize] 
-  ***''SetCursorScreenPos( //number// x, //number// y )''** 
-    *cursor position in absolute screen coordinates [0..io.DisplaySize] 
- 
- 
-===Custom Drawing=== 
-Usage: GUI:AddCircleFilled( 300, 300, 475,GUI:ColorConvertFloat4ToU32(0.9,0.1,0.12,0.5)) 
-IMPORTANT: Use GUI:ColorConvertFloat4ToU32() to calculatethe required //number//color argument!! 
-  ***''AddLine( //number// X1, //number// Y1, //number// X2, //number// Y2, //number// color, __//number// thickness = 1.0__,)''** 
-  ***''AddRect( //number// X1, //number// Y1, //number// X2, //number// Y2, //number// color, __//number// rounding= 0.0__, __//number// rounding_corners = 0.0__)''** 
-  ***''AddRectFilled( //number// X1, //number// Y1, //number// X2, //number// Y2, //number// color, __//number// rounding= 0.0__, __//number// rounding_corners = 0.0__)''** 
-  ***''AddTriangleFilled( //number// X1, //number// Y1, //number// X2, //number// Y2, //number// X3, //number// Y3, //number// color)''** 
-  ***''AddCircle( //number// X1, //number// Y1, //number// radius, //number// color, __//number// num_segments= 12__)''** 
-  ***''AddCircleFilled( //number// X1, //number// Y1, //number// radius, //number// color, __//number// num_segments= 12__)''** 
-  ***''AddText( //number// X1, //number// Y1, //number// color, //string// text)''** 
-  ***''AddImage( //string// texturepath, //number// X1, //number// Y1, //number// X2, //number// Y2)''** 
- 
-===Widgets Basic=== 
-Usage: GUI:Text( ... ) 
-  ***''Text( //string// text)''** 
-    *creates a text element 
-  ***''TextColored( //number// R, //number// G, //number// B, //number// A,//string// text)''** 
-    *creates a colored text element, number range is 0.0 - 1.0 
-  ***''TextDisabled( //string// text)''** 
-    *creates a disabled text element 
-  ***''TextWrapped( //string// text)''** 
-    *creates a text element which wraps 
-  ***''TextUnformatted( //string// text)''** 
-    *creates an unformatted text element 
-  ***''LabelText( //string// label, //string// text)''** 
-    *display text+label aligned the same way as value+label widgets 
-  ***''Bullet( )''** 
-    *creates a bullet element 
-  ***''BulletText( //string// text)''** 
-    *creates a bullet text element 
-  ***''Button( //string// label, __//number// sizeX__, __//number// sizeY__)''** 
-    *creates a buttom element 
-  ***''SmallButton( //string// label)''** 
-    *creates a smaller button element 
-  ***''InvisibleButton( //string// label, //number// sizeX, //number// sizeY)''** 
-    *creates an invisible button element 
-  ***''FreeButton( //string// label, //number// posX, //number// posY, //number// sizeX, //number// sizeY)''** 
-    *creates a freely placable buttom element 
-  ***''FreeImageButton( ///string// internalid, //string// filepath, //number// posX, //number// posY, //number// sizeX, //number// sizeY)''** 
-    *creates a freely placable image buttom element 
-  ***''ImageButton(//string// internalid, //string// filepath, //number// sizeX, //number// sizeY, __//number// UV0_x__, __//number// UV0_y__, __//number// UV1_x__, __//number// UV1_y__, __//number// framepadding__,__//number// bg_col_R__, __//number// bg_col_G__, __//number// bg_col_B__, __//number// bg_col_A__, __//number// tint_col_R__, __//number// tint_col_G__, __//number// tint_col_B__, __//number// tint_col_A__ )''** 
-    *creates an image button, scary eh ;) ? Simple usage: GUI:ImageButton( //string// internalid, //string// filepath, //number// sizeX, //number// sizeY). 
-    * < 0 frame_padding uses default frame padding settings. 0 for no padding 
-  ***''Image(//string// filepath, //number// sizeX, //number// sizeY, __//number// UV0_x__, __//number// UV0_y__, __//number// UV1_x__, __//number// UV1_y__, __//number// bg_col_R__, __//number// bg_col_G__, __//number// bg_col_B__, __//number// bg_col_A__, __//number// tint_col_R__, __//number// tint_col_G__, __//number// tint_col_B__, __//number// tint_col_A__ )''** 
-    *Simple Usage: GUI:Image(//string// filepath, //number// sizeX, //number// sizeY) 
-  ***''CollapsingHeader( //string// label, __//string// id__, __//bool// display_frame__, __//bool// default_open__)''** 
-    *Returns: //bool// collapsed 
-  ***''Checkbox( //string// label, //bool// checked)''** 
-    *Returns: //bool// checked, //bool// pressed 
-  ***''CheckboxFlags( //string// label, //number// flags, //number// flags_value)''** 
-    *Returns: //number// flags, //bool// pressed 
-  ***''RadioButton( //string// label, //bool// active)''** 
-    *Returns: //bool// active 
-  ***''RadioButton( //string// label, //number// val, //bool// active)''** 
-    *Returns: //number// val, //bool// pressed 
-  ***''Combo( //string// label, //number// current_item_listindex, //table// itemlist, __//number// height_in_items__)''** 
-    *Returns: //number// current_item_listindex, //bool// changed 
-  ***''ColorButton( //number// R, //number// G, //number// B, //number// A, __//bool// small_height__, //bool// outline_border)''** 
-    *Returns: //bool// pressed 
-  ***''ColorEdit3( //string// label, //number// R, //number// G, //number// B)''** 
-    *Returns: //number// R, //number// G, //number// B, //bool// changed 
-  ***''ColorEdit4( //string// label, //number// R, //number// G, //number// B,  //number// A)''** 
-    *Returns: //number// R, //number// G, //number// B,  //number// A, //bool// changed 
-  ***''ColorEditMode( [[minionlib#ColorEditMode|ColorEditMode]] mode)''** 
-    *sets ColorEditMode 
-  ***''ProgressBar( //number// fraction, //number// SizeX, //number// SizeY, __//string// overlay__ )''** 
-    *Guess what it draws ;) 
- 
-===Widgets Drags=== 
-(tip: ctrl+click on a drag box to input text) 
-Usage: GUI:Text( ... ) 
-  ***''DragFloat( //string// label, //number// val, __//number// v_speed__, __//number// v_min__, __//number// v_max__, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //bool// changed 
-    *display_format example "%.3f", *If v_min >= v_max we have no bound 
-  ***''DragFloatRange2( //string// label, //number// v_current_min, //number// v_current_max, __//number// v_speed__, __//number// v_min__, __//number// v_max__, __//string// display_format__, __//string// display_format_max__, __//number// power__)''** 
-    *Returns: //number// val_min, //number// val_max, //bool// changed 
-    *display_format example "%.3f", *If v_min >= v_max we have no bound 
-  ***''DragInt( //string// label, //number// val, __//number// v_speed__, __//number// v_min__, __//number// v_max__, __//string// display_format__)''** 
-    *Returns: //number// val, //bool// changed 
-    *display_format example "%.3f", *If v_min >= v_max we have no bound 
-  ***''DragIntRange2( //string// label, //number// v_current_min, //number// v_current_max, __//number// v_speed__, __//number// v_min__, __//number// v_max__, __//string// display_format__, __//string// display_format_max__)''** 
-    *Returns: //number// val_min, //number// val_max, //bool// changed 
-    *display_format example "%.3f", *If v_min >= v_max we have no bound 
- 
- 
-===Widgets Input=== 
-Usage: GUI:InputText( ... ) 
-  ***''InputText( //string// label, //string// text, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //string// text, //bool// changed 
-  ***''InputTextMultiline( //string// label, //string// text, __//number// sizeX__, __//number// sizeY__ , __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //string// text, //bool// changed 
-  ***''InputFloat( //string// label, //number// val, __//number// step__, __//number// step_fast__, __//number// decimal_precision__, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''InputFloat2( //string// label, //number// val, //number// val2, __//number// decimal_precision__, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //number// val2, //bool// changed 
-    *Draws 2 Input fields behind each other in the same line 
-  ***''InputFloat3( //string// label, //number// val, //number// val2, //number// val3, __//number// decimal_precision__, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //bool// changed 
-    *Draws 3 Input fields behind each other in the same line 
-  ***''InputFloat4( //string// label, //number// val, //number// val2, //number// val3, //number// val4, __//number// decimal_precision__, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed 
-    *Draws 4 Input fields behind each other in the same line 
-  ***''InputInt( //string// label, //number// val, __//number// step__, __//number// step_fast__, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''InputInt2( //string// label, //number// val, //number// val2, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //number// val2, //bool// changed 
-    *Draws 2 Input fields behind each other in the same line 
-  ***''InputInt3( //string// label, //number// val, //number// val2, //number// val3, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //bool// changed 
-    *Draws 3 Input fields behind each other in the same line 
-  ***''InputInt4( //string// label, //number// val, //number// val2, //number// val3, //number// val4, __//[[minionlib#InputTextFlags|InputTextFlags]]// flags__)''** 
-    *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:SliderFloat( ... ) 
-  ***''SliderFloat( //string// label, //number// val, //number// v_min, //number// v_max, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''SliderFloat2( //string// label, //number// val, //number// val2, //number// v_min, //number// v_max, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //number// val2, //bool// changed 
-    *Draws 2 Input fields behind each other in the same line 
-  ***''SliderFloat3( //string// label, //number// val, //number// val2, //number// val3, //number// v_min, //number// v_max, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //bool// changed 
-    *Draws 3 Input fields behind each other in the same line 
-  ***''SliderFloat4( //string// label, //number// val, //number// val2, //number// val3, //number// val4, //number// v_min, //number// v_max, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed 
-    *Draws 4 Input fields behind each other in the same line 
-  ***''SliderAngle( //string// label, //number// v_rad, __//number// v_degrees_min__, __//number// v_degrees_max__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''SliderInt( //string// label, //number// val, //number// v_min, //number// v_max, __//string// display_format__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''SliderInt2( //string// label, //number// val, //number// val2, //number// v_min, //number// v_max, __//string// display_format__)''** 
-    *Returns: //number// val, //number// val2, //bool// changed 
-  ***''SliderInt3( //string// label, //number// val, //number// val2, //number// val3, //number// v_min, //number// v_max, __//string// display_format__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //bool// changed 
-  ***''SliderInt4( //string// label, //number// val, //number// val2, //number// val3, //number// val4, //number// v_min, //number// v_max, __//string// display_format__)''** 
-    *Returns: //number// val, //number// val2, //number// val3, //number// val4, //bool// changed 
-  ***''VSliderFloat( //string// label, //number// sizeX, //number// sizeY, //number// val, //number// v_min, //number// v_max, __//string// display_format__, __//number// power__)''** 
-    *Returns: //number// val, //bool// changed 
-  ***''VSliderInt( //string// label, //number// sizeX, //number// sizeY, //number// val, //number// v_min, //number// v_max, __//string// display_format__)''** 
-    *Returns: //number// val, //bool// changed 
- 
- 
-===Widgets Trees=== 
-Usage: GUI:TreeNode( ... ) 
-  ***''TreeNode( //string// label)''** 
-    *Returns: //bool// changed 
-    *if returning 'true' the node is open and the user is responsible for calling TreePop() 
-  ***''TreePush( //string// id)''** 
-    *already called by TreeNode(), but you can call Push/Pop yourself for layouting purpose 
-  ***''TreePop( )''** 
-    *needs to be callled at the end of TreePush() 
-  ***''SetNextTreeNodeOpened( //bool// opened, __//[[minionlib#SetCond|SetCond]]// cond__ )''** 
-    *set next tree node to be opened. 
- 
- 
-===Widgets Lists=== 
-Usage: GUI:Selectable( ... ) 
-  ***''Selectable( //string// label, //bool// selected, __//[[minionlib#SelectableFlags|SelectableFlags]]// flags__, __//number// sizeX__, __//number// sizeY__ )''** 
-    *Returns: //bool// changed 
-    *size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height 
-  ***''ListBox( //string// label, //number// current_listitem_index, //table// itemlist, __//number// height_in_items__ )''** 
-    *Returns: //number// current_item_index, //bool// changed 
-  ***''ListBoxHeader( //string// label, //number// items_count, __//number// height_in_items__ )''** 
-    *Returns: //bool// 
-    *use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards. 
-  ***''ListBoxFooter( )''** 
-    *terminate the scrolling region 
- 
- 
-===Widgets Tooltip=== 
-Usage: GUI:SetTooltip( ... ) 
-  ***''SetTooltip( //string// label )''** 
-    *set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins 
-  ***''BeginTooltip( )''** 
-    *use to create full-featured tooltip windows that aren't just text 
-  ***''EndTooltip( )''** 
-    *use to create full-featured tooltip windows that aren't just text 
- 
-===Widgets Menus=== 
-Usage: GUI:BeginMainMenuBar( ... ) 
-  ***''BeginMainMenuBar( )''** 
-    *Returns: //bool// opened 
-    *create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true! 
-  ***''EndMainMenuBar( )''** 
-    *End Menubar drawing 
-  ***''BeginMenuBar( )''** 
-    *Returns: //bool// opened 
-    *append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set). only call EndMenuBar() if this returns true! 
-  ***''EndMenuBar( )''** 
-    *End Menubar drawing 
-  ***''BeginMenu( //string// label, __//bool// enabled__ )''** 
-    *Returns: //bool// opened 
-    *create a sub-menu entry. only call EndMenu() if this returns true! 
-  ***''EndMenu( )''** 
-    *End Menubar drawing 
-  ***''MenuItem( //string// label, __//string// shortcut__, __//bool// selected__, __//bool// enabled__)''** 
-    *Returns: //bool// activated, //bool// selected 
-    *Shortcuts are currently only visual, aka not working, you need to add that yourself 
- 
-===Widgets Popup=== 
-Usage: GUI:OpenPopup( ... ) 
-  ***''OpenPopup( //string// id)''** 
-    *mark popup as open. popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).  
-  ***''BeginPopup( //string// id)''** 
-    *Returns: //bool// open 
-    *return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true! 
-  ***''BeginPopupModal( //string// name, __//bool// opened__, __//[[minionlib#WindowFlags|WindowFlags]]// flags__)''** 
-    *Returns //bool// visible, //bool// open 
-    *modal dialog (can't close them by clicking outside) 
-  ***''BeginPopupContextItem( //string// id, __//number// mouse_button__)''** 
-    *Returns //bool// open 
-    *helper to open and begin popup when clicked on last item 
-  ***''BeginPopupContextWindow( __//bool// also_over_items__, __//string// id__, __//number// mouse_button__)''** 
-    *Returns //bool// open 
-    *helper to open and begin popup when clicked on current window 
-  ***''BeginPopupContextVoid( __//string// id__, __//number// mouse_button__)''** 
-    *Returns //bool// open 
-    *helper to open and begin popup when clicked in void (no window) 
-  ***''EndPopup( )''** 
-    *needs to be called on opened popups 
-  ***''CloseCurrentPopup( )''** 
-    *close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. 
- 
- 
-===Widgets Utilities=== 
-Usage: GUI:IsItemHovered( ... ) 
-  ***''IsItemHovered( )''** 
-    *Results: //bool//  
-    *was the last item hovered by mouse? 
-  ***''IsItemHoveredRect( )''** 
-    *Results: //bool//  
-    *was the last item hovered by mouse? even if another item is active while we are hovering this 
-  ***''IsItemClicked(  __//int// mousebutton == 0__)''** 
-    *Results: //bool//  
-    *was the last item clicked? (e.g. button/node just clicked on) 
-  ***''IsItemActive( )''** 
-    *Results: //bool//  
-    *was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) 
-  ***''IsItemVisible( )''** 
-    *Results: //bool//  
-    *was the last item visible? (aka not out of sight due to clipping/scrolling.) 
-  ***''IsAnyItemHovered( )''** 
-    *Results: //bool//  
-  ***''IsAnyItemActive( )''** 
-    *Results: //bool//  
-  ***''GetItemRectMin( )''** 
-    *Results: //number// x, //number// y 
-    *get bounding rect of last item in screen space  
-  ***''GetItemRectMax( )''** 
-    *Results: //number// x, //number// y 
-    *get bounding rect of last item in screen space  
-  ***''GetItemRectSize( )''** 
-    *Results: //number// x, //number// y 
-  ***''SetItemAllowOverlap( )''** 
-    *Allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. 
-  ***''IsWindowHovered( )''** 
-    *Results: //bool//  
-    *is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others) 
-  ***''IsWindowFocused( )''** 
-    *Results: //bool//  
-    *is current window focused 
-  ***''IsRootWindowFocused( )''** 
-    *Results: //bool//  
-    *is current root window focused (top parent window in case of child windows) 
-  ***''IsRootWindowOrAnyChildFocused( )''** 
-    *Results: //bool//  
-    *is current root window or any of its child (including current window) focused 
-  ***''IsRectVisible( //number// x, //number// y)''** 
-    *Results: //bool//  
-    *test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side  
-  ***''IsPosHoveringAnyWindow( //number// x, //number// y)''** 
-    *Results: //bool//  
-    *is given position hovering any active imgui window 
-  ***''GetTime( )''** 
-    *Results: //number//  
-  ***''GetFrameCount( )''** 
-    *Results: //number//  
-  ***''CalcItemRectClosestPoint( //number// x, //number// y, __//bool// on_edge__, __//number// outward__)''** 
-    *Results: //number// x, //number// y  
-    *utility to find the closest point the last item bounding rectangle edge. useful to visually link items 
-  ***''CalcTextSize( //string// text)''** 
-    *Results: //number// sizex, //number// sizey 
-  ***''CalcListClipping( //number// items_count, //number// items_height, //number// out_items_display_start, //number// out_items_display_end)''** 
-    *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. 
-  ***''BeginChildFrame( //number// guiID, //number// sizex, //number// sizey, __//[[minionlib#WindowFlags|WindowFlags]]// flags__)''** 
-    *Results: //bool// 
-    *helper to create a child window / scrolling region that looks like a normal widget frame 
-  ***''EndChildFrame( )''** 
-    *needs to be called at the end of BeginChildFrame. 
-  ***''ColorConvertU32ToFloat4( //number// U32val)''** 
-    *Returns: //number// val1,//number// val2,//number// val3,//number// val4 
-  ***''ColorConvertFloat4ToU32( //number// val1,//number// val2,//number// val3,//number// val4 )''** 
-    *Returns: //number// U32val 
-  ***''ColorConvertRGBtoHSV( //number// r, //number// g, //number// b)''** 
-    *Returns: //number// h, //number// s, //number// v 
-  ***''ColorConvertHSVtoRGB( //number// h, //number// s, //number// v)''** 
-    *Returns: //number// r, //number// g, //number// b 
-  ***''GetScreenSize()''** 
-    *Returns: //number// x, //number// y 
-  ***''IsKeyDown( //number// virtualkey)''** 
-    *Returns: //bool//  
-    *https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx for all values, convert the hex to decimal values 
-  ***''IsKeyPressed( //number// virtualkey, __//bool// repeat__)''** 
-    *Returns: //bool//  
-    *https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx for all values, convert the hex to decimal values 
-  ***''IsKeyReleased( //number// virtualkey)''** 
-    *Returns: //bool//  
-    *https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx to for values, convert the hex to decimal values 
-  ***''IsMouseDown( //number// button)''** 
-    *Returns: //bool//  
-  ***''IsMouseClicked( //number// button, __//bool// repeat__)''** 
-    *Returns: //bool// 
-  ***''IsMouseDoubleClicked( //number// button)''** 
-    *Returns: //bool//  
-  ***''IsMouseReleased( //number// button)''** 
-    *Returns: //bool//  
-  ***''IsMouseHoveringWindow( //number// button)''** 
-    *Returns: //bool//  
-    *is mouse hovering current window ("window" in API names always refer to current window). disregarding of any consideration of being blocked by a popup. (unlike IsWindowHovered() this will return true even if the window is blocked because of a popup)  
-  ***''IsMouseHoveringAnyWindow( //number// button)''** 
-    *Returns: //bool//  
-  ***''IsMouseHoveringAnyWindow( //number// pos_minX, //number// pos_minY, //number// pos_maxX, //number// pos_maxY, __//bool// clip__)''** 
-    *Returns: //bool//  
-    *is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup. 
-  ***''IsMouseDragging( __//number// button__, __//number// lock_threshold__)''** 
-    *Returns: //bool//  
-  ***''GetMousePos( )''** 
-    *Returns: //number// x, //number// y  
-  ***''GetMousePosOnOpeningCurrentPopup( )''** 
-    *Returns: //number// x, //number// y  
-    *retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into 
-  ***''GetMouseDragDelta( __//number// button__, __//number// lock_threshold__)''** 
-    *Returns: //number// x, //number// y  
-    *dragging amount since clicking.  
-  ***''ResetMouseDragDelta( __//number// button__)''** 
-    *Banana ;) 
- 
- 
-\\ 
- 
- 
- 
-===Enums & Flags=== 
-These are registered values in the GUI metatable. //Usage: d(GUI.WindowFlags_NoMove)// will print "2" into the console. 
- 
-==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 
- 
-==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 
- 
-==ColorEditMode== 
-  * GUI.ColorEditMode_UserSelect 
-  * GUI.ColorEditMode_UserSelectShowButton 
-  * GUI.ColorEditMode_RGB 
-  * GUI.ColorEditMode_HSV 
-  * GUI.ColorEditMode_HEX 
- 
-==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 807: Line 59:
 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") 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")
 </code> </code>
 +
 ===Utility Functions=== ===Utility Functions===
 +
 +==General==
 +  ***''d(...)''**
 +    *Prints out the passed variable or the result of a function into the console.
 +  ***''stacktrace()''**
 +    *Prints out the current call stack into the console.
 +  ***''Exit()''**
 +    *Closes the current game instance
 +  ***''ml_debug( //string// str )''**
 +    *Prints our the passed variable or the result of a function into the console when gEnableLog == "1".
 +  ***''ml_error( //string// str )''**
 +    *Prints our the passed variable or the result of a function into the console.
 +  ***''ml_log( //string// str )''**
 +    *Adds the string to the statusbar-line which gets shown on each pulse.
 +  ***''Now()''**
 +    *Returns tickcount from ml_global_information.Now
 +  ***''RegisterEventHandler(//string// eventtoregisterfor,//function// handler, //string// customNameHereToIdentifyYourCode)''**
 +    *Registers a local handler to an event
 +  ***''Reload()''**
 +    *Returns //bool// , reloads all lua modules
 +  ***''TimeSince(//integer// previousTime)''**
 +    *Returns //integer// ml_global_information.Now - previousTime
 +  ***''Unload()''**
 +    *Returns //bool// , tries to unload the bot
 +  ***''QueueEvent( //string// eventname, //string// args, ...)''**
 +    *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings. 
 +    *Use RegisterEventHandler("eventname", handlerfunc) , to register a lua function which will handle the fired event.
 +    *Requires at least 1 argument, even if it's a blank string. (ex. QueueEvent("some event",""))
 +
 +
 ==File I/O== ==File I/O==
 For every I/O function, you need to use double dashes! Example: FolderExists("c:\\minionapp\\ILikeBeer\\Folder") For every I/O function, you need to use double dashes! Example: FolderExists("c:\\minionapp\\ILikeBeer\\Folder")
Line 826: Line 109:
   ***''FileDelete(//string// fullpathtofile)''**   ***''FileDelete(//string// fullpathtofile)''**
     *Returns //bool//      *Returns //bool// 
 +  ***''FileIsValidImage(//string// fullpathtofile)''**
 +    *Returns //bool// 
 +  ***''FileSize(//string// fullpathtofile)''**
 +    *Returns //number//
   ***''FolderExists(//string// fullpathtofolder)''**   ***''FolderExists(//string// fullpathtofolder)''**
     *Returns //bool//     *Returns //bool//
Line 926: Line 213:
  
  
-==General== 
-  ***''d(...)''** 
-    *Prints our the passed variable or the result of a function into the console. 
-  ***''Exit()''** 
-    *Closes the current game instance 
-  ***''ml_debug( //string// str )''** 
-    *Prints our the passed variable or the result of a function into the console when gEnableLog == "1". 
-  ***''ml_error( //string// str )''** 
-    *Prints our the passed variable or the result of a function into the console. 
-  ***''ml_log( //string// str )''** 
-    *Adds the string to the statusbar-line which gets shown on each pulse. 
-  ***''Now()''** 
-    *Returns tickcount from ml_global_information.Now 
-  ***''RegisterEventHandler(//string// eventtoregisterfor,//function// handler)''** 
-    *Registers a local handler to an event 
-  ***''Reload()''** 
-    *Returns //bool// , reloads all lua modules 
-  ***''TimeSince(//integer// previousTime)''** 
-    *Returns //integer// ml_global_information.Now - previousTime 
-  ***''Unload()''** 
-    *Returns //bool// , tries to unload the bot 
-  ***''QueueEvent( //string// eventname, //string// args, ...)''** 
-    *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings.  
-    *Use RegisterEventHandler("eventname", handlerfunc) , to register a lua function which will handle the fired event. 
  
 ==Navigation== ==Navigation==
Line 957: Line 220:
  
  
 +
 +==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// ''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''**\\
 +
 +==API==
 +
 +  ***''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)''**
 +
 +
 +===HTTPRequest===
 +Use this function to do any kind of asynchronous http calls. Example:
 +
 +<code lua>
 +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
 +</code>
minionlib.1507755203.txt.gz · Last modified: 2017/10/11 20:53 by mmoalt