Docs
Search…
Quick Start
API -

How to create a new script

To begin you must create a custom command to hold the script. To do this you will need to navigate to:
  1. 1.
    Bot Commands
  2. 2.
    Edit Custom Commands
Next you need to create a new command.
Make sure to give it a good name. Try not to name it after a regular command that already exists. If you want this script to fire based off a command you will have to title it !command_name otherwise the name doesn't matter.
Click the option button on your newly created script, and then select "Edit"
Now that you have a custom command created, you can turn it into an advanced script holder.
  1. 1.
    Restriction - This is who can activate the command in chat. (This is only relevant if the script is fired by a command in chat. Setting it to caster makes it so only the streamer/broadcaster is able to run this command. If you are linking this to a twitch redemption, leave it on caster.)
  2. 2.
    Run as - This is the trigger start for your script, simple scripts often run as "On Command Call" while more advanced and technical scripts use "On Connect" (Note: "On Connect" makes the script name and Restriction irrelevant.
  3. 3.
    Create Script - This will create the script files and open the folder where they are held so that you can edit them. (Note: the .lua is for code, the .json is for storing settings for the code!)
  1. 1.
    Your Lua script file. You can edit the code in this script while connected! Just press F5 while focusing on the Stream Avatars window to reload the script!
  2. 2.
    Your JSON settings file. This is where you can have data persist between sessions of running Stream Avatars.

Editing the Script

When you open the script in a text editor, you will be greeted by the boilerplate LUA script which will print out "hello world" to the console log. You can now click Connect in Stream Avatars so your avatars can spawn and your scripts can run!
.lua
return function()
log('hello world'); --this will print out 'hello world'
end
To view the console log, focus Stream Avatars, and press Alt+C, then type: Lua After hitting enter, a console logger will come up showing you the logs. Once it is open, you can close the command input by pressing Alt+C again.
You can close the console log by repeating this process.
To replay the script or refresh and reload it, focus Stream Avatars, and press the F5 key.
If your custom command is set to Run on: "Command Call", you will need to enter the command into chat. In this example you would type: my_new_script
Copy link
On this page
How to create a new script
Editing the Script