Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Action wheel (tutorial): Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
m PenguinEncounter moved page Tutorials/ActionWheel to Action wheel (tutorial): Adjust title
PenguinEncounter (talk | contribs)
No edit summary
Tag: 2017 source edit
Line 1: Line 1:
{{Notice/Warning|This page is under construction.}}
{{Notice/Warning|This page is under construction.}}
{{Notice/Warning
|<span style="font-size: 1.4rem;">Untested scripts</span><br>Handle with care.
}}
The Action Wheel is a GUI element added by Figura which allows you to add additional functionality to your avatar.
By default, the action wheel is opened with the <kbd>B</kbd> key. This can be changed in Figura's Settings.
The Action Wheel consists of a set of [[Page|Pages]], of which only one can be active at a time.
Each page can have an unlimited number of [[Action|Actions]]. Only 8 Actions can be rendered at a time, however &mdash; if more than 8 Actions are active on a page, the scroll wheel can be used to navigate between the sets of Actions (8 at a time.)
For full documentation, see:
* {{type|ActionWheelAPI}} for the global <code>action_wheel</code>,
* {{type|Page}} for pages, and
* {{type|Action}} for actions.
== Example ==
The first step to using the Action Wheel is to create a page to hold the Actions, via <code>[[ActionWheelAPI#newPage|newPage]]</code>.
<syntaxhighlight lang="lua" line="1" highlight="1">
local mainPage = action_wheel:newPage()
</syntaxhighlight>
This creates a new page, but doesn't do anything else. If you save the script and try to open the Action Wheel (<kbd>B</kbd>), you will see a message stating that there is no active page. Using <code>[[ActionWheelAPI#setPage|setPage]]</code> with the newly created page will change the current active page:
<syntaxhighlight lang="lua" line="1" highlight="2">
local mainPage = action_wheel:newPage()
action_wheel:setPage(mainPage)
</syntaxhighlight>
The message about not having an active page should be gone now, but the page is still empty. Let's add some actions.
=== Adding actions ===
Create a new action by calling <code>[[Page#newAction|newAction]]</code> on a Page, like so:
<syntaxhighlight lang="lua" line="1" highlight="4">
local mainPage = action_wheel:newPage()
action_wheel:setPage(mainPage)
local action = mainPage:newAction()
</syntaxhighlight>

Revision as of 03:03, 1 December 2024

This page is under construction.

{{{1}}}

The Action Wheel is a GUI element added by Figura which allows you to add additional functionality to your avatar.

By default, the action wheel is opened with the B key. This can be changed in Figura's Settings.

The Action Wheel consists of a set of Pages, of which only one can be active at a time. Each page can have an unlimited number of Actions. Only 8 Actions can be rendered at a time, however — if more than 8 Actions are active on a page, the scroll wheel can be used to navigate between the sets of Actions (8 at a time.)

For full documentation, see:

  • ActionWheelAPI for the global action_wheel,
  • Page for pages, and
  • Action for actions.

Example

The first step to using the Action Wheel is to create a page to hold the Actions, via newPage.

local mainPage = action_wheel:newPage()

This creates a new page, but doesn't do anything else. If you save the script and try to open the Action Wheel (B), you will see a message stating that there is no active page. Using setPage with the newly created page will change the current active page:

local mainPage = action_wheel:newPage()
action_wheel:setPage(mainPage)

The message about not having an active page should be gone now, but the page is still empty. Let's add some actions.

Adding actions

Create a new action by calling newAction on a Page, like so:

local mainPage = action_wheel:newPage()
action_wheel:setPage(mainPage)

local action = mainPage:newAction()