(This site is still a WIP)
Current Version: 1.1.0
This guide is meant to explain how to use the many features and capabilities of SquAPI, as well as go over some basic ways to understand how to use Figura.
To get started, make sure you have an Avatar folder at the ready that contains all the basic foundations(model, json, script, etc. that Figura auto generates); Keep in mind this guide assumes you know the basics of creating a Figura avatar and modeling.
After downloading SquAPI and SquAssets from the GitHub, place both files inside your avatar folder. It’s important to know that you should never modify the actual SquAPI or SquAssets files themselves unless you know what you are doing and are looking to mod them yourself.
Inside your main script file, place the following line:
local squapi = require("SquAPI")
This will “activate” SquAPI inside your script and you now have the ability to run SquAPI functions, any functions you run for SquAPI should come after this line. Remember that you can run functions multiple times, for example, the eye function can be run multiple times depending on how many eyes your avatar has.
An example snippet of a script file with a basic function, yours will vary:
(for further info on the functions used check out the Main Functions)
PLAYER_MODEL:setVisible(false)
local squapi = require("SquAPI")
-- copy-pasted from the feature description
--replace each nil with the value/parmater you want to use, or leave as nil to use default values :)
--parenthesis are default values for reference
squapi.ear:new(
models.exampleModel.exampleLeftEar, --leftEar
models.exampleModel.exampleRightEar, --(nil) rightEar
nil, --(1) rangeMultiplier
nil, --(false) horizontalEars
nil, --(2) bendStrength
nil, --(true) doEarFlick
nil, --(400) earFlickChance
nil, --(0.1) earStiffness
nil --(0.8) earBounce
)
If you’re not experienced with scripting, here is how you can tell SquAPI what to do.
For an easier plug-and-play way, go into the function descriptions on this site, and they will have a “copy-paste” function that has all the setup done for you. Each parameter is automatically filled with a “nil”, this nil will just tell the function to use the default value(indicated in the parenthesis); To modify this value, just replace the nil with the value of your choice.
An example with the ears function:
--replace each nil with the value/parmater you want to use, or leave as nil to use default values :)
--parenthesis are default values for reference
squapi.ear:new(
models.exampleModel.exampleLeftEar, --leftEar
nil, --(nil) rightEar
0.5, --(1) rangeMultiplier
nil, --(false) horizontalEars
nil, --(2) bendStrength
false, --(true) doEarFlick
nil, --(400) earFlickChance
nil, --(0.1) earStiffness
nil --(0.8) earBounce
)
--this runs ear with only one ear and no second ear, sets the range to 0.5, and disables ear flick
Most SquAPI functions ask for an input “Element”, this refers to the model part you want to be affected. So for example the “smoothHead” function requires your model's head element. How do you specify what element you want? Well, Figura has a specific way to access these elements using a formatting like this:
models.[model name].[element path]
--Brackets are for demonstration purposes and would not actually be there
Every time you call an element you start with “models” to tell Figura that you are accessing a model part; next you put your model name, which is of course the name of your model; and lastly you put the element path. The element path refers to the structuring of the different folders inside your actual model, which could look something like this:
Let’s say in this above example we were trying to access the “head” element, and the model's name is “Tank”, in order to access the element in Figura you’d run this:
models.Tank.whole.body.head
And it’s as simple as that! Whenever you modify or call a model element, you will always use this method. (remember it is case sensitive)
As one last example, let’s try running the “smoothHead” function(which requires a head element) using the above example:
--replace each nil with the value/parmater you want to use, or leave as nil to use default values :)
--parenthesis are default values for reference
squapi.smoothHead:new(
{
models.Tank.whole.body.head --element(you can have multiple elements in a table)
},
nil, --(1) strength(you can make this a table too)
nil, --(0.1) tilt
nil, --(1) speed
nil --(true) keepOriginalHeadPos
)
calling an animation is quite similar to calling an element in its base structure, with a couple of minor tweaks. Here’s the formatting:
animations.[model name].[animation name]
--Brackets are for demonstration purposes and would not actually be there
It will always start with “animations” to tell Figura that you are accessing an animation. then you do your model's name, and lastly, you put the animation's name.
For example, if we have a model named “Tank” and an animation named “move” we would do:
animations.Tank.move
This explains the default SquAPI functions, classes, and features and how to use them.
This explains some of the features found in SquAssets
If you’re using SquAPI versions 0.3.0 or below, check the legacy guide: