ClickPosition
The ClickPosition function simulates a mouse click at a specified position in the game world. This function can be used to interact with objects or locations by simulating either a left-click or a right-click.
Parameters
x: The X coordinate of the position to click.y: The Y coordinate of the position to click.z: The Z coordinate of the position to click.rightClick(optional): A boolean value indicating whether to perform a right-click. Iftrue, a right-click is performed. Iffalseor not specified, a left-click is performed.
Example Usage in Lua
Here is a detailed example of how to use the ClickPosition function in Lua:
local api = ...
-- Function to perform a left-click at a specified position
function LeftClickAtPosition(x, y, z)
api.ClickPosition(x, y, z)
print("Performed a left-click at position (" .. x .. ", " .. y .. ", " .. z .. ").")
end
-- Function to perform a right-click at a specified position
function RightClickAtPosition(x, y, z)
api.ClickPosition(x, y, z, true)
print("Performed a right-click at position (" .. x .. ", " .. y .. ", " .. z .. ").")
end
-- Example usage: Left-click at position (100, 200, 300)
LeftClickAtPosition(100, 200, 300)
-- Example usage: Right-click at position (150, 250, 350)
RightClickAtPosition(150, 250, 350)