### Create and Build a GUI Window with GUIBuilder (Lua) Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder Demonstrates the minimal usage of GUIBuilder to create a new instance, define a window with specific properties, and then build/display that window. It requires the Tinkr library and specifically the GUIBuilder utility. ```Lua local Tinkr = ... local GUIBuilder = Tinkr.Util.GUIBuilder   -- Create a new instance of GUIBuilder. local Builder = GUIBuilder:New { -- This is the name of your configs .json file, all settings will be stored in -- this file. GUIBuilder will manage this file, just make sure the name is -- unique enough that no other GUIs will share the same name. config = "example_empty" -- would be `configs/example_empty.json` }   -- Create a Window element, with no content. local Window = Builder:Window { key = "example_window", title = "Empty Window", width = 250, height = 350, content = { } }   -- Build the GUI element, this shows the window. Builder:Build(Window) ``` -------------------------------- ### Get Power Level - Lua Examples Source: https://docs.tinkr.site/Routine/Conditions/power Demonstrates how to use the 'power' function in Lua to retrieve various power types for the player or a target unit. It shows examples for fetching Lunar Power, default Mana, and target Mana. ```lua local playerAstral = power(PowerType.LunarPower) local playerMana = power() local targetMana = power(PowerType.Mana, 'target') ``` -------------------------------- ### Lua: Dropdown Menu Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Showcases the creation of dropdown menus using Tinkr's GUI builder. Dropdowns allow users to select an option from a list. This example demonstrates standard dropdowns and multi-select dropdowns, defining key-value pairs for the options. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local DropdownGroup = Builder:Group { title = "Standard Dropdowns", content = { Builder:Rows { Builder:Columns { Builder:Dropdown { key = 'dropdown_a', label = "Example Dropdown A", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D", option_e = "Option E", } }, Builder:Dropdown { key = 'dropdown_b', label = "Example Dropdown B", multi = true, ``` -------------------------------- ### Create Dropdowns Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Configures standard dropdown menus, supporting both single selection and multi-selection. Each dropdown is defined with a key, label, and a map of values. ```lua local DropdownGroup = Builder:Group { title = "Standard Dropdowns", content = { Builder:Rows { Builder:Columns { Builder:Dropdown { key = 'dropdown_a', label = "Example Dropdown A", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D", option_e = "Option E", } }, Builder:Dropdown { key = 'dropdown_b', label = "Example Dropdown B", multi = true, description = "This dropdown allows selecting multiple values.", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D", option_e = "Option E", } } } } } } ``` -------------------------------- ### Lua: Basic Checkbox Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Demonstrates the creation of simple checkboxes using Tinkr's GUIBuilder. Checkboxes allow for binary (yes/no) state selection, useful for enabling or disabling features. This example includes checkboxes with and without descriptions. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local SimpleCheckboxes = Builder:Group { title = "Simple Checkboxes", content = { Builder:Text "Checkboxes allow you to have 2 states (yes and no) which can be used for enabling or disabling functionality.", Builder:Spacer { }, Builder:Checkbox { key = "checkbox_a", label = "Checkbox A", description = "Description for Checkbox A." }, Builder:Checkbox { key = "checkbox_b", label = "Checkbox B", description = "Description for Checkbox B." }, Builder:Checkbox { key = "checkbox_c", label = "Checkbox C" } } } ``` -------------------------------- ### Build GUI Window with Tabs and Elements Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Constructs a GUI window titled 'GUI Example' containing a tab group. The tab group includes various input elements like EditBox, Dropdown, Slider, and ColorPicker. This code utilizes a 'Builder' pattern for UI construction. ```lua local TabGroup = Builder:TabGroup { key = "tab_group_a", tabs = { Builder:Tab { key = "tab_a", title = "Tab A", content = { Builder:EditBox { key = "editbox_a", label = "Example Edit Box A", placeholder = "Enter text here" }, Builder:Spacer { }, Builder:EditBox { key = "editbox_b", label = "Example Edit Box B", placeholder = "Enter password here", password = true }, Builder:Spacer { }, Builder:Dropdown { key = 'dropdown_b', label = "Example Dropdown B", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D" } }, Builder:Spacer { }, Builder:EditBox { key = "editbox_c", label = "Edit Box C", placeholder = "Placeholder Value", description = "This input requires you to click " .. OKAY, button = true }, Builder:Spacer { }, Builder:Dropdown { key = 'dropdown_a', label = "Example Dropdown A", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D", option_e = "Option E", } }, Builder:Spacer { }, Builder:Slider { key = 'slider_a', label = "Example Slider A", description = "This slider ranges from 0% (0) to 100% (1).", }, Builder:Spacer { }, Builder:ColorPicker { key = 'color_a', label = "Example Color Picker A", description = "This does not include an alpha value." }, } } } } local Window = Builder:Window { key = "gui_example", title = "GUI Example", width = 350, height = 500, content = { TabGroup } } Builder:Build(Window) ``` -------------------------------- ### Movement Utility Usage Example (Lua) Source: https://docs.tinkr.site/Modules/Util/Movement Demonstrates the basic usage of the Tinkr.Util.Movement functions by hooking into movements and toggling their state. This example assumes Tinkr and its Movement utility are properly initialized. ```lua local Tinkr = ... local Movement = Tinkr.Util.Movement Movement:Hook() Movement:Toggle() ``` -------------------------------- ### Tinkr HTTP Module: Deprecated methods for GET and POST Source: https://docs.tinkr.site/Modules/Util/HTTP Provides examples of deprecated HTTP methods like HTTP:GET and HTTP:POST, intended for legacy code. It also shows the usage of the HTTP:Params helper for constructing POST request parameters. These methods are not recommended for new development. ```lua -- An example of a HTTP GET HTTP:GET('https://example.com', function (status, res) if status == 200 then print(res) end end) -- An example of the HTTP Params helper local params = HTTP:Params({ foo = 'bar', baz = 'bang'}) -- An example of a HTTP POST HTTP:POST('https://example.com', params, function (status, res) if status == 200 then print(res) end end) ``` -------------------------------- ### TTT Function Usage Example Source: https://docs.tinkr.site/Routine/Conditions/ttt Demonstrates how to use the ttt function in a conditional statement. The example checks if the time to target for 'pet' to reach 'target' is greater than 3 seconds, implying a need to wait for the pet to get closer. ```lua if ttt('pet', 'target') > 3 then -- Let's take a second, let our pet get closer. end if ttt('pet', 'target') > 3 then -- Let's take a second, let our pet get closer. end ``` -------------------------------- ### Slider Component Examples Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Demonstrates the creation of slider components with different configurations. It includes a basic slider ranging from 0% to 100% and a more customized slider with specific min, max, step, and default values, and without percentage display. These sliders are part of a larger UI builder system. ```lua local SliderGroup = Builder:Group { title = "Sliders", content = { Builder:Rows { Builder:Columns { Builder:Slider { key = 'slider_a', label = "Example Slider A", description = "This slider ranges from 0% (0) to 100% (1).", }, Builder:Slider { key = 'slider_b', label = "Example Slider B", description = "This slider ranges from 25 to 75.", min = 25, max = 75, step = 1, default = 50, percent = false } } } } } ``` -------------------------------- ### Lua: Multi-Line Edit Box Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Demonstrates the implementation of multi-line text input fields using Tinkr's GUI builder. These are suitable for longer text entries such as comments or descriptions. The example shows how to configure the number of lines, placeholder text, and include an optional button. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local MultiLineEditBoxGroup = Builder:Group { title = "Multi-Line EditBoxes", content = { Builder:Rows { Builder:Columns { Builder:EditBox { key = "multi_editbox_a", label = "Edit Box A", multiline = true, lines = 6, placeholder = "Placeholder value", description = "This is a multi-line edit box.", button = true, }, Builder:EditBox { key = "multi_editbox_b", label = "Edit Box B", multiline = true, lines = 6, placeholder = "Placeholder value", description = "This is a multi-line edit box." } } } } } ``` -------------------------------- ### Create Simple Checkboxes Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Implements basic checkboxes with labels and optional descriptions. These are used for binary state selections (e.g., enabling/disabling features). ```lua local SimpleCheckboxes = Builder:Group { title = "Simple Checkboxes", content = { Builder:Text "Checkboxes allow you to have 2 states (yes and no) which can be used for enabling or disabling functionality.", Builder:Spacer { }, Builder:Checkbox { key = "checkbox_a", label = "Checkbox A", description = "Description for Checkbox A." }, Builder:Checkbox { key = "checkbox_b", label = "Checkbox B", description = "Description for Checkbox B." }, Builder:Checkbox { key = "checkbox_c", label = "Checkbox C" } } } ``` -------------------------------- ### Deprecated HTTP Helper Methods (GET, POST) Source: https://docs.tinkr.site/Modules/Util/HTTP These methods are older convenience functions for making GET and POST requests. They are deprecated and should not be used in new code. ```APIDOC ## Deprecated HTTP Helper Methods ### Description These are older, deprecated helper methods for making basic HTTP GET and POST requests. It is recommended to use the more flexible `HTTP:Request` method instead. ### Method `HTTP:GET(url, callback)` ### Parameters - **url** (string) - The URL to fetch. - **callback** (function) - A function to handle the response (`status`, `res`). ### Request Example (GET) ```lua HTTP:GET('https://example.com', function (status, res) if status == 200 then print(res) end end) ``` ### Method `HTTP:POST(url, params, callback)` ### Parameters - **url** (string) - The URL to send the POST request to. - **params** (table) - A table of parameters to send as form data. Use `HTTP:Params` to format. - **callback** (function) - A function to handle the response (`status`, `res`). ### Request Example (POST) ```lua local params = HTTP:Params({ foo = 'bar', baz = 'bang'}) HTTP:POST('https://example.com', params, function (status, res) if status == 200 then print(res) end end) ``` ### Helper `HTTP:Params(params_table)` ### Description Helper function to format a table of parameters for use with `HTTP:POST`. ### Request Example ```lua local params = HTTP:Params({ foo = 'bar', baz = 'bang'}) ``` ``` -------------------------------- ### Aura Function Example (Lua) Source: https://docs.tinkr.site/Routine/Conditions/aura This example demonstrates how to use the 'aura' function in Lua to check if a 'BlazingBarrier' buff is active ('HELPFUL') on the 'player'. If the aura is present, it attempts to cast the 'BlazingBarrier' spell. The example is repeated, highlighting potential redundancy in usage. ```lua if aura('player', BlazingBarrier, 'HELPFUL') then return cast(BlazingBarrier, 'player') end if aura('player', BlazingBarrier, 'HELPFUL') then return cast(BlazingBarrier, 'player') end ``` -------------------------------- ### Lua: Single-Line Edit Box Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Showcases the creation of single-line text input fields (edit boxes) using Tinkr's GUI builder. This example includes edit boxes with labels, descriptions, placeholder text, and an optional button. These are suitable for short text inputs like names or search queries. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local SingleLineEditBoxGroup = Builder:Group { title = "Single Line EditBoxes", content = { Builder:EditBox { key = "editbox_a", label = "Edit Box A", description = "This editbox has a description with it." }, Builder:EditBox { key = "editbox_b", label = "Edit Box B", placeholder = "This editbox has a placeholder value" }, Builder:EditBox { key = "editbox_c", label = "Edit Box C", placeholder = "Placeholder Value", description = "This input requires you to click " .. OKAY, button = true } } } ``` -------------------------------- ### Lua: Radio Button Group Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Demonstrates the implementation of radio button groups using Tinkr's GUI builder. Radio buttons allow users to select one option from a predefined set. This example shows both inline and stacked radio button layouts with custom option labels. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local RadioCheckboxes = Builder:Group { title = "Radio Checkboxes", content = { Builder:Text "Radios allow you to select between a set of options, much like a dropdown but presented in a different way.", Builder:Spacer { }, Builder:Radio { key = "radio_a", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D" } }, Builder:Spacer { }, Builder:Text "You can also force radios to be stacked instead of displayed inline.", Builder:Spacer { height = 14 }, Builder:Radio { key = "radio_b", stacked = true, values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D" } } } } ``` -------------------------------- ### Lua: Tri-State Checkbox Implementation with Tinkr Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Illustrates the use of tri-state checkboxes in Tinkr's GUI builder. These checkboxes support three states: 'yes', 'no', and 'half', which are useful for indicating partial states. The example shows how to set the default state for each tri-state checkbox. ```lua local Tinkr = ... local Builder = Tinkr.Util.GUIBuilder:New { config = "example_builder" } local TriStateCheckboxes = Builder:Group { title = "Tri State Checkboxes", content = { Builder:Text "Tri State checkboxes allow you to have 3 states (yes, no and half) which can be useful for showing that something is partially enabled.", Builder:Spacer { }, Builder:Checkbox { tristate = true, key = "tribox_a", label = "Tri State A", default = "yes" }, Builder:Checkbox { tristate = true, key = "tribox_b", label = "Tri State B", default = "half" }, Builder:Checkbox { tristate = true, key = "tribox_c", label = "Tri State C", default = "no" } } } ``` -------------------------------- ### Interrupt Channeling Spell Example (Lua) Source: https://docs.tinkr.site/Routine/Conditions/channeling Example demonstrating how to cast 'Rebuke' on a target if the target is channeling. This snippet checks the channeling status and conditionally casts a spell. ```Lua if channeling('target') then return cast(Rebuke, 'target') end ``` -------------------------------- ### Create Multi-Line Edit Boxes Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Defines a group of multi-line edit boxes with customizable labels, placeholders, and line counts. These are used for capturing larger text inputs from users. ```lua local MultiLineEditBoxGroup = Builder:Group { title = "Multi-Line EditBoxes", content = { Builder:Rows { Builder:Columns { Builder:EditBox { key = "multi_editbox_a", label = "Edit Box A", multiline = true, lines = 6, placeholder = "Placeholder value", description = "This is a multi-line edit box.", button = true, }, Builder:EditBox { key = "multi_editbox_b", label = "Edit Box B", multiline = true, lines = 6, placeholder = "Placeholder value", description = "This is a multi-line edit box.", } } } } } ``` -------------------------------- ### Configure Radio Button Groups Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Sets up radio button groups for selecting one option from a predefined set. Supports both inline and stacked layouts, with options defined by key-value pairs. ```lua local RadioCheckboxes = Builder:Group { title = "Radio Checkboxes", content = { Builder:Text "Radios allow you to select between a set of options, much like a dropdown but presented in a different way.", Builder:Spacer { }, Builder:Radio { key = "radio_a", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D" } }, Builder:Spacer { }, Builder:Text "You can also force radios to be stacked instead of displayed inline.", Builder:Spacer { height = 14 }, Builder:Radio { key = "radio_b", stacked = true, values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D" } } } } ``` -------------------------------- ### Specific Channeling Spell Check Example (Lua) Source: https://docs.tinkr.site/Routine/Conditions/channeling Example showing how to check if a target is specifically channeling the 'Hearth' spell. This allows for targeted interruptions based on the spell name. ```Lua if channeling('target') == "Hearth" then return cast(Rebuke, 'target') end ``` -------------------------------- ### ScreenToWorld Function Signature and Example Usage Source: https://docs.tinkr.site/Lua/Utility/ScreenToWorld This snippet shows the function signature for ScreenToWorld, which takes screen coordinates (x, y) and hit flags to return world coordinates (x, y, z). It also includes an example demonstrating how to call the function with sample values and bitwise OR operations for hit flags. ```lua ScreenToWorld(x, y, hitFlags) : x, y, z ScreenToWorld(x, y, hitFlags) : x, y, z ``` ```lua local sx, sy = 0, 0 local hitFlags = bit.bor(0x1, 0x10, 0x100, 0x100000) local x, y, z = ScreenToWorld(sx, sy, hitFlags) local sx, sy = 0, 0 local hitFlags = bit.bor(0x1, 0x10, 0x100, 0x100000) local x, y, z = ScreenToWorld(sx, sy, hitFlags) ``` -------------------------------- ### Create Single Line Edit Boxes Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Defines single-line input fields with labels, descriptions, and placeholder text. An optional button can be appended to the edit box. ```lua local SingleLineEditBoxGroup = Builder:Group { title = "Single Line EditBoxes", content = { Builder:EditBox { key = "editbox_a", label = "Edit Box A", description = "This editbox has a description with it." }, Builder:EditBox { key = "editbox_b", label = "Edit Box B", placeholder = "This editbox has a placeholder value" }, Builder:EditBox { key = "editbox_c", label = "Edit Box C", placeholder = "Placeholder Value", description = "This input requires you to click " .. OKAY, button = true } } } ``` -------------------------------- ### Implement Tri-State Checkboxes Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Creates checkboxes with three states: 'yes', 'no', and 'half'. Useful for representing partial states, such as a setting that is partially enabled. ```lua local TriStateCheckboxes = Builder:Group { title = "Tri State Checkboxes", content = { Builder:Text "Tri State checkboxes allow you to have 3 states (yes, no and half) which can be useful for showing that something is partially enabled.", Builder:Spacer { }, Builder:Checkbox { tristate = true, key = "tribox_a", label = "Tri State A", default = "yes" }, Builder:Checkbox { tristate = true, key = "tribox_b", label = "Tri State B", default = "half" }, Builder:Checkbox { tristate = true, key = "tribox_c", label = "Tri State C", default = "no" } } } ``` -------------------------------- ### Use Healthstone Source: https://docs.tinkr.site/Routine/Conditions/clickitem Provides an example of using a Healthstone on the player, demonstrating item usage. ```APIDOC ## POST /websites/tinkr_site/use_healthstone ### Description Checks if the player has a Healthstone and, if so, uses it on the player. This is an example snippet. ### Method POST ### Endpoint /websites/tinkr_site/use_healthstone ### Parameters None directly for this endpoint, logic is within the example. ### Request Body None ### Response #### Success Response (200) - **used** (boolean) - Indicates if the Healthstone was used. #### Response Example ```json { "used": true } ``` ``` -------------------------------- ### TraceLine Example: Check Line of Sight Source: https://docs.tinkr.site/Lua/Utility/TraceLine An example demonstrating how to use the TraceLine function to check the line of sight between two objects. It retrieves object positions, sets hit flags using bitwise OR operations, and then calls TraceLine. ```lua local x1, y1, z1 = ObjectPosition('player') local x2, y2, z2 = ObjectPosition('target') local hitFlags = bit.bor(0x1, 0x10, 0x100, 0x100000) local x, y, z = TraceLine(x1, y1, z1, x2, y2, z2, hitFlags) ``` -------------------------------- ### Example of Using Click Item with Item Check (Tinkr Script - Placeholder) Source: https://docs.tinkr.site/Routine/Conditions/clickitem A placeholder example demonstrating how the clickitem function might be used in conjunction with checking for item availability. This pseudocode indicates a conditional use of the 'use' function based on item presence, intended to be replaced with actual code. ```Tinkr Script -- if items(HealthStone) >= 0 then -- return use(Healthstone, 'player') -- end -- if items(HealthStone) >= 0 then -- return use(Healthstone, 'player') -- end ``` -------------------------------- ### Embed HTML Content Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Includes raw HTML content within the UI, allowing for rich text formatting, images, and links. This is useful for displaying static information or styled text. ```html local HTMLTypographyGroup = Builder:SimpleGroup { Builder:HTML [[

This is an H1 element

This is a paragraph element. It contains text.


This is an H2 element

This is yes another paragraph element. It contains even more text.


Here is an H3 element

This is a link, clicking it will open the URL in your browser.


]] } ``` -------------------------------- ### aroundunit Function Documentation Source: https://docs.tinkr.site/Routine/Conditions/aroundunit Provides details on the aroundunit function, its parameters, return values, and usage examples. ```APIDOC ## aroundunit Function ### Description Returns the amount of party members around the unit, and their total health pool percentage for a given range. ### Method Function call ### Parameters #### Path Parameters - **unita** (unit) - Required - The unit to measure proximity from. - **range** (number) - Required - The range within which to count party members. #### Query Parameters None #### Request Body None ### Request Example ```lua local count, pool = aroundunit('player', 30) if count > 3 and pool < 60 then return cast(Effloresence, 'player'):click(playerx, playery, playerz) end ``` ### Response #### Success Response (200) - **count** (number) - The number of party members found within the specified range. - **pool** (number) - The total health pool percentage of the found party members. #### Response Example ```json { "count": 5, "pool": 55.2 } ``` ``` -------------------------------- ### Example Usage of GeneratePath Source: https://docs.tinkr.site/Lua/Movement/GeneratePath Demonstrates how to call the GeneratePath function to find a path between the player and a target. It includes retrieving positions, map ID, calling the function, and iterating through the path points if a normal path is found. ```lua local x1, y1, z1 = ObjectPosition('player') local x2, y2, z2 = ObjectPosition('target') local mapId = GetMapID() local path, pathType = GeneratePath(x1, y1, z1, x2, y2, z2, mapId) if pathType == PathTypes.PATHFIND_NORMAL then for index, point in ipairs(path) do -- do something with each point -- point.x, point.y, point.z end end local x1, y1, z1 = ObjectPosition('player') local x2, y2, z2 = ObjectPosition('target') local mapId = GetMapID() local path, pathType = GeneratePath(x1, y1, z1, x2, y2, z2, mapId) if pathType == PathTypes.PATHFIND_NORMAL then for index, point in ipairs(path) do -- do something with each point -- point.x, point.y, point.z end end ``` -------------------------------- ### Check Player Channeling Status (Lua) Source: https://docs.tinkr.site/Routine/Conditions/channeling Example for checking if the player unit is channeling. If the player is channeling, the function returns, potentially preventing further actions. ```Lua if channeling('player') then return end ``` -------------------------------- ### Example: Get Player Name using ObjectType Source: https://docs.tinkr.site/Lua/Objects/ObjectType Demonstrates how to get the type of the 'player' object using the ObjectType function. The result can then be used to identify the player's type within the game. ```lua local name = ObjectType('player') ``` -------------------------------- ### Config Module Usage Example Source: https://docs.tinkr.site/Modules/Util/Config Demonstrates how to use the Util.Config module in Lua. It shows creating a new configuration, writing key-value pairs, and reading values, including handling default values when a key is not found. Assumes the Tinkr.Util.Config module is accessible. ```lua local Tinkr = ... local Config = Tinkr.Util.Config   local my_config = Config:New('my_config')   my_config:Write('foo', 'something') my_config:Write('bar', 'awesome')   local foo = my_config:Read('foo', 'default value') local baz = my_config:Read('baz', 'default value')   print(foo) -- something print(baz) -- default value ``` -------------------------------- ### Example Usage of Party Density Centroid (Lua) Source: https://docs.tinkr.site/Routine/Conditions/partydensitycentroid Demonstrates how to use party density calculations to determine if a spell should be cast. It checks party member count and health before calculating the density centroid and casting an ability. ```lua local partyhealtharoundlowest = parthyhealth(lowest, 30) local partycountlowest = partyaround(lowest, 30) if partycountlowest > 3 and partyhealtharoundlowest <= 60 then local densityCentroid = partydensity(LowestHealth, 30) return cast(Effloresence, lowest):click(densityCentroid.x, densityCentroid.y,densityCentroid.z) end local partyhealtharoundlowest = parthyhealth(lowest, 30) local partycountlowest = partyaround(lowest, 30) if partycountlowest > 3 and partyhealtharoundlowest <= 60 then local densityCentroid = partydensity(LowestHealth, 30) return cast(Effloresence, lowest):click(densityCentroid.x, densityCentroid.y,densityCentroid.z) end ``` -------------------------------- ### Multi-Select Dropdown Configuration Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Defines a dropdown component that allows users to select multiple options from a predefined list. It includes configuration for the dropdown's description and the available values. No external dependencies are explicitly mentioned. ```lua local DropdownGroup = Builder:Group { title = "Dropdowns", content = { Builder:Rows { Builder:Columns { Builder:Dropdown { key = 'dropdown_a', label = "Example Dropdown A", description = "This dropdown allows selecting multiple values.", values = { option_a = "Option A", option_b = "Option B", option_c = "Option C", option_d = "Option D", option_e = "Option E", } } } } } } ``` -------------------------------- ### GeneratePathWeighted Function Signature and Example Source: https://docs.tinkr.site/Lua/Movement/GeneratePathWeighted Defines the signature for GeneratePathWeighted, which takes start and end coordinates, a map ID, and a callback function for custom edge weighting. The example demonstrates its usage in Lua to find a path with dynamically calculated weights. ```lua GeneratePathWeighted(x1, y1, z1, x2, y2, z2, mapId, callback) : {{ x, y, z }}... local px, py, pz = ObjectPosition('player') local tx, ty, tz = ObjectPosition('target') local mapID = GetMapID() local weighted = function(ax, ay, az, bx, by, bz) local extraWeight = 0.0 -- float -- poly edge A is ax, ay, az -- poly edge B is bx, by, bz -- callback is for movement between poly edge A and B -- higher weights are avoided return extraWeight end local path = GeneratePathWeighted(px, py, pz, tx, ty, tz, mapID, weighted) ``` -------------------------------- ### Build and Manage Configuration GUI Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/integration Implements a '/config' command to show or hide a custom GUI configuration window built using `Builder:Build`. It manages the window's state, creating it if it doesn't exist or releasing (closing) it if it's already shown. This relies on `MyCommands`, `Builder`, and a `MyRoutineConfig` table. ```lua -- This will be used to keep a reference to the opened GUI local MyRoutineWindow -- Next, add a command to show the config GUI MyCommands:Register("config", function() -- We don't have a window, lets build one if not MyRoutineWindow then MyRoutineWindow = Builder:Build(MyRoutineConfig) -- We have a window, lets release it, this also closes it elseif MyRoutineWindow:IsShown() then MyRoutineWindow:Release() MyRoutineWindow = false end end, "Shows the config options window") ``` -------------------------------- ### UI Typography Formatting Options Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Demonstrates various text formatting and layout options within a tabbed interface. It includes blocks of text, spacers, images, and nested padding, showcasing how to structure and style textual content and images using the Builder components. ```lua local TypographyTabGroup = Builder:TabGroup { key = "typography_tabs", tabs = { Builder:Tab { title = "Formatting", content = { Builder:Padding { padding = 5, content = { Builder:Rows { Builder:Text [[ This is a simple block of text, you can write words here. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ]], Builder:Spacer {}, Builder:Text "Ut enim ad minim veniam, quis nostrud ... in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", Builder:Spacer {}, Builder:Columns { Builder:Image { image = "Interface\Glues\PROMOTIONS\enUS-SBC-Logo", width = 256, height = 128, fit = true }, Builder:Padding { padding = 5, content = { Builder:Text "Ut enim ad minim veniam, quis nostrud exercitation ullamco ... in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." } } } } } } } } } } ``` -------------------------------- ### Example: Iterate Through Objects and Get Types Source: https://docs.tinkr.site/Lua/Objects/ObjectType Shows how to iterate through all available objects in the game using the Objects() function and then determine the type of each object using ObjectType. This is useful for processing multiple game objects. ```lua for i, object in ipairs(Objects()) do local name = ObjectType(object) -- do something with name end ``` -------------------------------- ### Example: Iterate Through Objects and Get Names Source: https://docs.tinkr.site/Lua/Objects/ObjectName Shows how to loop through all available objects in the game using the Objects() function and retrieve the name of each object using ObjectName. This pattern is useful for performing actions on all objects or for debugging. ```Lua for i, object in ipairs(Objects()) do local name = ObjectName(object) -- do something with name end ``` ```Lua for i, object in ipairs(Objects()) do local name = ObjectName(object) -- do something with name end ``` -------------------------------- ### Build GUI Window with Tree Structure Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Constructs a main GUI window titled 'GUI Builder Kitchen Sink'. The window's content is organized using a tree structure with branches for 'Input' and 'Typography', each containing tab groups. ```lua local Window = Builder:Window { key = "example_window", title = "GUI Builder Kitchen Sink", width = 800, height = 480, content = { TreeGroup } } Builder:Build(Window) ``` -------------------------------- ### Example: Get Player Name using ObjectName Source: https://docs.tinkr.site/Lua/Objects/ObjectName Demonstrates how to retrieve the name of the player object. This is a common use case for the ObjectName function. It takes the string 'player' as an argument to identify the player's game object. ```Lua local name = ObjectName('player') ``` ```Lua local name = ObjectName('player') ``` -------------------------------- ### Retrieve Object GUID (Lua) Source: https://docs.tinkr.site/Lua/Objects/ObjectGUID This function returns the GUID of a WowGameObject. It takes an object reference as input, which can be a unit or another game object. The function returns a string representing the GUID or false if the object reference is invalid. ```lua ObjectGUID(--[[(1)]]objectReference) : string | false ``` ```lua local guid = ObjectGUID('target') local guid = ObjectGUID('target') ``` ```lua local pguid = ObjectGUID('player') return pguid == guid local pguid = ObjectGUID('player') return pguid == guid ``` -------------------------------- ### Create Text Elements with Formatting Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Defines and configures various text elements within a UI layout. Allows for rich text content, font styling, size adjustments, and color application. Dependencies include the Builder module for UI components. ```lua local TypographyTabGroup = Builder:TabGroup { key = "typography_tabs", tabs = { Builder:Tab { title = "Formatting", content = { Builder:Padding { padding = 5, content = { Builder:Rows { Builder:Text [[ This is a simple block of text, you can write words here. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ]], Builder:Spacer {}, Builder:Text "Ut enim ad minim veniam, quis nostrud ... in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", Builder:Spacer {}, Builder:Columns { Builder:Image { image = "Interface\\Glues\\PROMOTIONS\\enUS-SBC-Logo", width = 256, height = 128, fit = true }, Builder:Padding { padding = 5, content = { Builder:Text "Ut enim ad minim veniam, quis nostrud exercitation ullamco ... in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." } } }, Builder:Columns { Builder:Text { text = "You can change the font and size of the text using options. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", size = 14, font = "Fonts\\MORPHEUS.TTF" }, Builder:Text { text = "Color can be applied by passing a hex value. This is optional and text will be white by default.", size = 14, font = "Fonts\\FRIZQT__.TTF", color = "3489eb", } }, }, } } } }, Builder:Tab { title = "HTML", content = { HTMLTypographyGroup } } } } ``` -------------------------------- ### Perform Deprecated HTTP GET and POST Requests Source: https://docs.tinkr.site/Lua/Network/HTTP These methods (`HTTP:GET`, `HTTP:POST`) are deprecated and should not be used in new code. They provide simpler interfaces for basic GET and POST requests. The `HTTP:Params` helper can be used to format parameters for POST requests. ```lua -- An example of a HTTP GET HTTP:GET('https://example.com', function (status, res) if status == 200 then print(res) end end)   -- An example of the HTTP Params helper local params = HTTP:Params({ foo = 'bar', baz = 'bang'})   -- An example of a HTTP POST HTTP:POST('https://example.com', params, function (status, res) if status == 200 then print(res) end end) ``` -------------------------------- ### Build Main Window with Tree and Tab Structures Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/examples Constructs the main application window, incorporating a tree group and tab group for navigation and content display. The window has defined dimensions and a title. It relies on the Builder module for UI element creation. ```lua local TreeGroup = Builder:TreeGroup { key = "example_tree", branches = { Builder:TreeBranch { title = "Input", icon = 134063, content = { TabGroup } }, Builder:TreeBranch { title = "Typography", icon = 134332, content = { TypographyTabGroup } } } } local Window = Builder:Window { key = "example_window", title = "GUI Builder Kitchen Sink", width = 800, height = 480, content = { TreeGroup } } Builder:Build(Window) ``` -------------------------------- ### Lua: Registering Routine Options and GUI Events Source: https://docs.tinkr.site/Modules/Util/GUI%20Builder/integration This snippet demonstrates registering custom routine logic, including a 'checked' function for option validation, and setting up a GUI builder to listen for and apply configuration changes to a local 'my_options' table. It covers the core setup for a Tinkr routine's options and their interaction with the GUI. ```lua local Tinkr = ... local Routine = Tinkr.Routine local Commands = Tinkr.Util.Commands local GUIBuilder = Tinkr.Util.GUIBuilder   -- Create your /myroutine slash command. local MyCommands = Commands:New("myroutine")   -- A simple table to store your config options -- -- You can now keep your default values here, just remember to -- use the GUI builder values, like "yes" and "no" instead of -- true or false. local my_options = { aoe = "yes" }   -- Add a custom routine method to aid in the checking of "yes"/"no" values. Routine:RegisterLibrary({ checked = function(option) if my_options[option] == "yes" then return true end return false end })   -- Register your routine with Tinkr Routine:RegisterRoutine(function() -- here we check the new checked('aoe') before casting an AoE spell -- if checked('aoe') and castable(Consecration) then return cast(Consecration) end end, Routine.Classes.Paladin, "my_routine")   -- Create a new GUI Builder instance for your routine local Builder = GUIBuilder:New { config = "my_routine" }   -- Listen to all GUI option changes, call our Apply function each time -- -- This acts as a proxy, sending all changes in the GUI, to our local -- my_options table. There are many ways to do this, this is just the -- most simple. You may find you need more control, in which case you -- can listen to specific key values and handle them differently. Builder:Listen('*', function(key, value) my_options[key] = value end)   -- Create a new Window with a single Checkbox element inside it local MyRoutineConfig = Builder:Window { key = "my_window", title = "My Routine Config", width = 350, height = 100, content = { Builder:Checkbox { key = "aoe", label = "Use AoE Spells", description = "Toggles the use of AoE spells", default = "yes" } } }   -- This will be used to keep a reference to the opened GUI local MyRoutineWindow   -- Next, add a command to show the config GUI MyCommands:Register("config", function() -- We don't have a window, lets build one if not MyRoutineWindow then MyRoutineWindow = Builder:Build(MyRoutineConfig) -- We have a window, lets release it, this also closes it elseif MyRoutineWindow:IsShown() then MyRoutineWindow:Release() MyRoutineWindow = false end end, "Shows the config options window")   -- We've moved this down to be after the GUI code. -- -- Register a command for toggling AoE on or off MyCommands:Register("aoe", function() -- flips or "toggles" the value my_options.aoe = my_options.aoe == 'yes' and 'no' or 'yes'   if my_options.aoe == 'yes' then Tinkr:log("AoE Enabled") Builder:Emit('aoe', 'yes') -- send the new value to the GUI else Tinkr:log("AoE Disabled") Builder:Emit('aoe', 'no') -- send the new value to the GUI end end, "Toggles AoE on or off") ``` -------------------------------- ### Get ObjectPosition (Lua) Source: https://docs.tinkr.site/Lua/Objects/ObjectPosition Retrieves the x, y, and z coordinates of a specified WowGameObject. Accepts an 'objectReference' as input. Useful for getting the position of specific entities like the player. ```lua local x, y, z = ObjectPosition('player') local x, y, z = ObjectPosition('player') ``` -------------------------------- ### Example Usage of spellInRange Source: https://docs.tinkr.site/Routine/Conditions/spellInRange Demonstrates how to use the spellInRange function within a conditional statement to cast a spell if it's within range and off cooldown. The example uses FrostNova and checks against 'arena1'. ```lua if spellInRange(FrostNova, 'arena1') and cooldown(FrostNova) == 0 then return cast(FrostNova) end if spellInRange(FrostNova, 'arena1') and cooldown(FrostNova) == 0 then return cast(FrostNova) end ```