Skip to content

Instantly share code, notes, and snippets.

Toribash Scripting Tutorial

Programming Basics

So here begins your journey into how to create some simple programs. We will first start out by saying how Toribash runs the script file. If we take the example in the last tutorial:

echo("Hello!")
result = 4+4
echo("4 + 4 is " .. result)

How does the text become a program?

@blam23
blam23 / Toribash-Tutorial-Introduction.md
Last active December 19, 2015 23:08
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

@blam23
blam23 / silatnu.py
Last active December 18, 2015 19:18
Enables you to watch any toribash server that isn't password protected, while keeping your name out of the bout list. Note: The only people that can tell you are on the server are those that have access to the servers themselves. To use: First launch the .py file, type in the name of the server you want to join, in Toribash type '/co 127.0.0.1:9…
import socket
import threading
# Shamelessly stolen from: http://stackoverflow.com/questions/5179467/equivalent-of-setinterval-in-python
def setInterval(interval):
def decorator(function):
def wrapper(*args, **kwargs):
stopped = threading.Event()
def loop(): # executed in another thread
@blam23
blam23 / timer.lua
Created June 20, 2013 14:13
A timer class for Toribash Comes with helper functions that relate to javascript timing: setInterval, setTimeout, clearInterval, clearTimeout
Timer = { }
Timer.__index = Timer
Timer.Count = 0
function Timer.New(Time, Recurring,Function)
Timer.Count = Timer.Count + 1
local timer = { }
setmetatable(timer,Timer)
timer.ref = Timer.Count
timer.interval = Time
@blam23
blam23 / bot.py
Last active December 18, 2015 17:29
Toribash <-> IRC bot
# Made by Blam of the Toribash community
# Anyone is free to use, modify and do whatever they want to this code
import socket, threading, re
import string
import datetime
print "Announce Bot 1.0"
# Shamelessly stolen from http://stackoverflow.com/questions/1551382/user-friendly-time-format-in-python
@blam23
blam23 / getbouts.py
Last active December 18, 2015 16:08
Gets all users in specified room, and the max count. Returns: * (maxCount, ip, [users], desc) * If it doesn't find anything it returns: * (-1, None, None, None) *
def getBouts(name):
bsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
bsocket.connect(("176.9.64.22", 22000))
buffer = bsocket.recv(4096)
done = False
inserver = False
ip = ""
lastCount = 0
clients = None
while not done:
@blam23
blam23 / graph.lua
Last active May 1, 2017 14:52
Graphs in Toribash using Lua.
--dofile("dbg.lua")
-- start of graph class
graph = {
LINE = 0, BAR = 1,
Colors = { {1,0,0,0.4}, {0,0,1,0.7}, {0,1,1,0.7}, {1, 0, 1,0.7}, {1, 1, 0, 0.7}, {0, 0.7, 0, 0.7}, {1, 0.5, 0, 0.7}}
}
graph.__index = graph
function graph.new(gtype, x, y, width, height, max)
@blam23
blam23 / tbbot-irc.rb
Last active December 18, 2015 14:59 — forked from Eleeleth/tbbot-irc.rb
#!/usr/bin/env ruby
## Bot, sits in TB server and pings periodically to
## remain connected. Parses SAY strings for globals
require 'socket'
require 'digest/md5'
require 'io/wait'
def resolver(server)
puts "Trying to resolve #{server} to IP..."
@blam23
blam23 / REPL.ax3
Created September 15, 2012 23:38
axScript3 REPL
//REPL Script 1.1
#module <Ax/STD.dll> // Needed for console output
#module <Ax/Exit.dll> // Needed for exit hook
// Exit Handler function.
// Whenever the script is stopped this function is called.
// It can be used to catch errors and continue the script.
~(exit: type error |
(
List<String> groups = new ArrayList<String>();
groups.add(strLine);