Click.lua
A small library for the cursor. You can find its coordinates in the scene, find the speed's cursor, or set an image cursor.
Installation
Place the file click.lua into the LuaScriptsLib folder.
How to Use
To enable the click.lua, add this line to lunadll.lua:
local click = API.load("click");
This will load the API.
Example
local click = API.load("click")
click.setCursor("example.png")
function onTick()
if click.click() then
click.setCursorOn()
click.setCursorOff(15)
NPC.spawn(1,click.sceneX(),click.sceneY(),player.section)
end
end
This example will spawn a goomba where the cursor is placed and show the cursor for 15 frames when the mouse is clicked.
Documentation
| click() | |||||
|---|---|---|---|---|---|
| Returns true for the first frame the mouse was clicked. | |||||
| hold() | |||||
| Returns true if the mouse is being clicked. | |||||
| released() | |||||
| Returns true for the first frame the mouse was released. | |||||
| x() | |||||
| Returns the X-coordinate relative to the screen. | |||||
| y() | |||||
| Returns the Y-coordinate relative to the screen. | |||||
| sceneX() | |||||
| Returns the X-coordinate relative to the scene. | |||||
| sceneY() | |||||
| Returns the Y-coordinate relative to the scene. | |||||
| speedX() | |||||
| Returns the X-speed of the cursor. | |||||
| speedY() | |||||
| Returns the Y-speed of the cursor. | |||||
| setCursor() | Image Path | Priority | X offset | Y Offset | |
| Sets the cursor with an image. Note: This doesn't turn on the image, it simply loads it. | Required, string
Provide a file path to the image |
Optional, number.
Provide the priority for the cursor. Default: 5 |
Optional, number.
Provide an X-offset for the image. Default: 0 |
Optional, number.
Provide a Y-offset for the image. Default: 0 | |
| setCursorOn() | Time | ||||
| Turns on the image for the cursor. | Optional, number
A delay for when the image should be turned on. Default: 0 | ||||
| setCursorOff() | Time | ||||
| Turns off the image for the cursor. | Optional, number
A delay for when the image should be turned off. Default: 0 | ||||
| curserTimer() | Type | ||||
| Returns the timer until the cursor image is turned on/off | Required, string
Have either "on", or "off". | ||||
| isCursor() | |||||
| Returns true if the cursor is being displayed |