-
Notifications
You must be signed in to change notification settings - Fork 18
Home
qqtnn edited this page Jul 1, 2024
·
3 revisions
- Install your Lua scripts in
loader_folder_name\scripts
. - Name your script files as
main.lua
(e.g.,scripts\test\main.lua
). - Reload Lua files in-game with the default key:
F5
. - Console Toggle Keybind:
F1
Explore various components of Lua scripting:
- Actors Manager: Get quick pre-filtered gameobjects lists.
- Callbacks: Register your code on game events callbacks.
- Color: Utilize color in your scripts for enhanced visual representation.
- Console: Learn about printing and debugging in the console.
- Enums: Enumerators to improve your code readability.
- Orbwalker: Interact with the orbwalker core module.
- Evade: Interact with the evade core module.
- Game Object: Interacting with gameobjects and their properties.
- Global Functions: Access global handy functions.
- Graphics: Implementing graphical elements in your scripts.
- Loot Manager: Interact with the loot manager core module.
- Menu Elements: Creating and handling menu elements in scripts.
- Pathfinder: Interact with the Pathfinder core module.
- Prediction: Interact with the Prediction core module.
- Target Selector: Interact with the Target Selector core module.
- Utility: Essential utility functions for scripting.
- Cast Spell: Spell casting functions.
- Vector2: 2D Geometry.
- Vector3: 3D Geometry.
- World: Interacting with the game's world and environment.
- Auto Play: Interact with the auto play core module.
Start with the Global Functions to understand basic Lua functionality in Diablo. Then, explore Game Object to interact with in-game elements. Target Selector to refine target acquisition and Graphics for custom UI elements. As you advance, integrate various components for complex scripting.
-- register on_update callback to call the code each frame
on_update(function()
-- filter the code to work only with orbwalker runing some mode
if orbwalker.get_orb_mode() == orb_mode.none then
return
end
-- get player position
local player_position = get_player_position()
-- get the closest target to player position
local target = target_selector.get_target_closer(player_position , 10)
if target then
-- Execute actions
end
end)
local developer_id = "rename_me"
-- local variable holding the combo_box options
local combo_options = {"Disabled", "Orbwalker", "Always"}
-- create combo_box menu element, default value 0 which is diabled
-- unique menu_element id hashing a concatenated sctring developer_id + literal string
local mode_selector = combo_box:new(0, get_hash(developer_id .. "mode_selector_placeholder_id"))
-- register on_render_menu callback to render the menu elements
on_render_menu(function()
-- render combo_box menu element
mode_selector:render("Mode", combo_options, "Select Mode")
end)