Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The first in my Toribash Script tutorials.

Toribash Scripting Tutorial

What is this tutorial about?

This tutorial is about using and creating 'scripts' in Toribash. In this first tutorial I will be covering what scripts are, how to use them, how they are made and what tools you will need to make them.

There is a very simple exercise at the end of the tutorial that will test what you have learned.

The proceeding tutorials will then go into detail about how to make scripts, including going over the basics of programming.

These tutorials are created for people with no experience in programming, but are also recommended for people who know programming but are not sure in how to create scripts specifically for Toribash

What is a script?

A script in Toribash terms is a program that will run inside of Toribash. Scripts are very powerful and can be used to do anything:

How do I use scripts?

Well it's simple enough, you can easily run scripts using the in-game menu by going Setup -> Utils -> Scripts and you'll get a little menu like this:

Scripts Menu

You just pick a script and click load. Alternatively you can use the chat box, it's a lot quicker and simpler if you already know the script's name:

/ls graph.lua

Will run the script graph.lua

How are scripts made?

Well scripts are all made using a programming language called Lua. Don't let this talk of programming put you off, it is a lot easier than people think, especially when using Lua. It is designed to be simple and easy to use. In this set of tutorials I will slowly walk you through how programming works, and how you can create scripts for Toribash that perform various tasks.

Scripts are stored in plain text, meaning if you open them up in a program like notepad you can see how they work. However if you don't have any programming experience it won't make much sense yet. Here is an example script:

result = 4+4

This is a very basic script, but you can see that it's not made of ones and zeros, it's readable and you could take some guesses at what it does.

What it does to is it puts in the chat Hello and 8. I'll get more into how scripts work in the next tutorial. For now I'll go over the setup.

How can I make scripts?

Well you've already got everything you need. However if you want to make life easier for yourself you can download some tools that will help the process.

Text Editors

A text editor is a program that edits text (funnily enough). What you want is a programming text editor, that will help you to create lua scripts. There are two very good editors that I recommend:

  • Sublime Text (Windows, Mac, Linux). Has an unlimited free version, with a nag screen like WinRAR.
  • Notepad++ (Windows). Completely free, not quite as sexy as Sublime Text.

Creating a 'Lua' file

It's very easy in both programs to create a lua file, simply create a new document by pressing Ctrl+N or going File -> New File and then save it as a lua file by giving it a .lua extension, ex: 'script.lua'. Saving can be done by the File -> Save File option or Ctrl+S in both editors.

That's it, you're done. If you want this script to be usable by Toribash however, you need to save it to your toribash/data/scripts directory. This can normally be found on Windows in the C:/Games directory, each version of Toribash will have it's own folder. Example the scripts directory for me on version 4.4 of Toribash is:


To see if you have created the script successfully, open up Toribash and go to the scripts menu, the process has been outlined in the 'How do I use Scripts' section above, and see if the file you created is showing up in the list with the other scripts. If it isn't make sure you saved in the right directory, are using the same version of Toribash that you saved the script in, and that the script ends in .lua


After reading through this starter for the tutorials to come, I hope you have a basic understanding of what a script is, how you can use them, and how to create a Lua script file that Toribash can see.

Your first test

As a test, to see that you have understood all you've been taught in this section I want you to create a Lua script file, write the following in it:

echo("You have passed")

And then run the script in Toribash. If the chat displays You have passed then you have passed your first test! Any questions about this first tutorial should be posted in the corresponding forum thread.

If you fail the test, and aren't sure why, you can post in the thread asking for help, and I or anyone else will try to help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.