To begin you must create a custom command to hold the script. To do this you will need to navigate to:
- 1.Bot Commands
- 2.Edit Custom Commands
Next you need to create a new command.
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.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.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.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.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.Your JSON settings file. This is where you can have data persist between sessions of running Stream Avatars.
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!
log('hello world'); --this will print out 'hello world'