Action
An action in the Figura Action Wheel
Actions are either interacted by clicking and scrolling, which also being able to be toggleable
For the entire page assume:
local myPage = action_wheel:newPage()
local myAction = myPage:newAction()
Action Events
setOnLeftClick()
Aliases: onLeftClick()
Sets the function that is executed when the left mouse button is clicked
The function has one argument
The first argument is this action itself
See the action wheel tutorial for a full example.
setOnLeftClick(leftFunction)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
leftFunction | Function | The function that will be run when the action is left clicked | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
function pings.lefty()
print("I left clicked this button!")
end
myAction:setOnLeftClick(pings.lefty)
setOnRightClick()
Aliases: onRightClick()
Sets the function that is executed when the right mouse button is clicked
The function has one argument
The first argument is this action itself
setOnRightClick(rightFunction)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rightFunction | Function | The function that will be run when the action is right clicked | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
function pings.righty()
print("I right clicked this button!")
end
myAction:setOnRightClick(pings.righty)
setOnToggle()
Aliases: onToggle()
Sets the function that is executed when the Action is toggled
The function has two arguments
The first argument is toggle state of this action
The second argument is this action itself
See the action wheel tutorial for a full example.
setOnToggle(toggleFunction)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggleFunction | Function | The function that will be run when the action is toggled | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
function pings.setVisible(state)
models:setVisible(state) -- toggles the visibility of the entire avatar because state swaps between true and false every click
end
myAction:setOnToggle(pings.setVisible)
setOnUntoggle()
Aliases: onUntoggle()
This method is a noob trap, anything it can do setOnToggle
does better because setOnToggle
also runs its function when untoggled
Sets the function that is executed when the Action is untoggled
The function has two arguments
The first argument is toggle state of this action
The second argument is this action itself
setOnUntoggle(toggleFunction)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggleFunction | Function | The function that will be run when the action is untoggled | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
function pings.toggley(bool)
print('This is always true: ', .. bool) -- this is always true because setOnUnToggle changes the behavior of setOnToggle. Without setOnUnToggle this would swap between true and false
end
function pings.untoggley(bool)
print('This is always false: ' .. bool)
end
local myAction = myPage:newAction()
:setOnToggle(pings.toggley)
:setOnUntoggle(pings.untoggley)
setOnScroll()
Aliases: onScroll()
Sets the function that is executed when the mouse is scrolled
The function has two arguments
The first argument is mouse wheel direction
The second argument is this action itself
setOnScroll(scrollFunction)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scrollFunction | Function | The function that will be run when the action is scrolled over | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
function pings.scrolling(dir)
log(dir)
if dir > 0 then
log("Scrolled up")
else
log("Scrolled down")
end
end
myAction:setOnScroll(pings.scrolling)
Appearance
setColor()
Aliases: color()
Sets the background color of the Action
- Overload 1
- Overload 2
Example (Overload 2):
myAction:setColor(255 / 255, 192 / 155, 203 / 255)
getColor()
Gets this Action's background color
getColor()
Returns:
Type | Description |
---|---|
Vector3 | The RGB background color for this action |
Example:
myAction:getColor()
setHoverColor()
Aliases: hoverColor()
Sets the background color of the Action when it is being hovered
- Overload 1
- Overload 2
Example:
myAction:setHoverColor(255 / 255, 192 / 155, 203 / 255)
getHoverColor()
Gets this Action's background hover color
getHoverColor()
Returns:
Type | Description |
---|---|
Vector3 | The RGB background hover color for this action |
Example:
myAction:getHoverColor()
setHoverItem()
Aliases: hoverItem()
Sets the item of the Action when it is being hovered
- Overload 1
- Overload 2
Example (Overload 2):
myAction:setHoverItem("diamond")
setHoverTexture()
Aliases: hoverTexture()
Sets a Custom Texture to render while this Action is being hovered
All values are measured in pixels
Default UV is 0, 0, the default dimensions are the texture dimensions and the default scale of 1
- Overload 1
- Overload 2
- Overload 3
- Overload 4
setHoverTexture(texture)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setHoverTexture(texture, u, v)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setHoverTexture(texture, u, v, width, height)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setHoverTexture(texture, u, v, width, height, scale)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
scale | Number | The scale of the texture | 1 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
-- basic
myAction:setHoverTexture(textures["myTexture"])
-- advanced
myAction:setHoverTexture(textures["myTexture"], 16, 32, nil, nil, 2)
setItem()
Aliases: item()
Sets the item of the Action
- Overload 1
- Overload 2
Example (Overload 2):
myAction:setItem("minecraft:stone")
setTexture()
Aliases: texture()
Sets a Custom Texture to render in this Action
All values are measured in pixels
Default UV is 0, 0, the default dimensions are the texture dimensions and the default scale of 1
- Overload 1
- Overload 2
- Overload 3
- Overload 4
setTexture(texture)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setTexture(texture, u, v)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setTexture(texture, u, v, width, height)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setTexture(texture, u, v, width, height, scale)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
scale | Number | The scale of the texture | 1 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
-- basic
myAction:setTexture(textures["myTexture"])
-- advanced
myAction:setTexture(textures["myTexture"], 16, 32, nil, nil, 2)
setTitle()
Aliases: title()
Sets the title of the Action
- Overload 1
- Overload 2
Example (Overload 2):
myAction:setTitle("Click me!")
getTitle()
Gets this Action title
getTitle()
Returns:
Type | Description |
---|---|
String | The title of the action, shown when the action is hovered over |
Example:
myAction:getTitle()
Toggle Specific
setToggleColor()
Aliases: toggleColor()
Sets the color of the Action when it is toggled
- Overload 1
- Overload 2
setToggleColor(color)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color | Vector3 | The RGB value of the toggle background, with each value between 0 and 1 | `vec(0,0,0) |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setToggleColor(r, g, b)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r | Number | The red value of the toggle background, between 0 and 1 | 0 |
g | Number | The green value of the toggle background, between 0 and 1 | 0 |
b | Number | The blue value of the toggle background, between 0 and 1 | 0 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
myAction:setToggleColor(0, 128 / 255, 128 / 255)
getToggleColor()
Gets this Action toggled color
getToggleColor()
Returns:
Type | Description |
---|---|
Vector3 | The RGB value of the toggle background, with each value between 0 and 1 |
Example:
myAction:getToggleColor()
setToggleItem()
Aliases: toggleItem()
Sets the item of the Action when it is toggled
- Overload 1
- Overload 2
Example (Overload 2):
myAction:setToggleItem("armor_stand")
setToggleTexture()
Aliases: toggleTexture()
Sets a Custom Texture to render in this Action when it is toggled
All values are measured in pixels
Default UV is 0, 0, the default dimensions are the texture dimensions and the default scale of 1
- Overload 1
- Overload 2
- Overload 3
- Overload 4
setToggleTexture(texture)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setToggleTexture(texture, u, v)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setToggleTexture(texture, u, v, width, height)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
setToggleTexture(texture, u, v, width, height, scale)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texture | Texture | The texture that's shown in the action | Required |
u | Number | The u position of the uv | 0 |
v | Number | The v position of the uv | 0 |
width | Integer | The width of the uv | Texture width |
height | Integer | The height of the uv | Texture height |
scale | Number | The scale of the texture | 1 |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
-- basic
myAction:setToggleTexture(textures["myToggleTexture"])
-- advanced
myAction:setToggleTexture(textures["myTexture"], 16, 32, nil, nil, 2)
setToggleTitle()
Aliases: toggleTitle()
Sets the title of the Action when it is toggled
setToggleTitle(title)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title | String | The title of the action, shown when the action is hovered over | nil |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
myAction:setToggleTitle("Stand")
getToggleTitle()
Gets this Action toggled title
getToggleTitle()
Returns:
Type | Description |
---|---|
String | The title of the action, shown when the action is hovered over |
Example:
myAction:getToggleTitle()
setToggled()
Aliases: toggled()
Sets the toggle state of the Action
setToggled(bool)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bool | Boolean | If true the toggle will be on, and if false it will be off | false |
Returns:
Type | Description |
---|---|
Action | Returns self for chaining |
Example:
myAction:setToggled(true)
isToggled()
Checks if the Action is toggled or not
isToggled()
Returns:
Type | Description |
---|---|
Boolean | If true the toggle is on, and if false it is off |
Example:
myAction:isToggled()
Fields
leftClick
Function that is executed when the left mouse button is clicked
The function has one argument
The first argument is this action itself
Examples:
-- pingless example
function myAction.leftClick()
log("Left click")
end
-- pinged example
function pings.example()
log("Left click")
end
myAction.leftClick = pings.example
rightClick
Function that is executed when the right mouse button is clicked
The function has one argument
The first argument is this action itself
Example:
function myAction.rightClick()
log("Right click")
end
toggle
Function that is executed when the Action is toggled
The function has two arguments
The first argument is toggle state of this action
The second argument is this action itself
Example:
function myAction.toggle(bool)
log("The toggle is " .. tostring(bool))
end
untoggle
Function that is executed when the Action is untoggled
The function has two arguments
The first argument is toggle state of this action
The second argument is this action itself
Example:
function myAction.untoggle(bool)
log("The toggle is " .. tostring(bool))
end
scroll
Function that is executed when the mouse is scrolled
The function has two arguments
The first argument is mouse wheel direction
The second argument is this action itself
Example:
function myAction.scroll(dir)
log(dir)
if dir > 0 then
log("Scrolling up")
else
log("Scrolling down")
end
end