Home
Name Modified Size InfoDownloads / Week
Zipped 2010-11-22
warbot.template 2010-11-22 1.6 kB
warbot.pl 2010-11-22 38.4 kB
readme.txt 2010-11-22 9.1 kB
Totals: 4 Items   49.1 kB 0
Flash's Warbot for Irssi :: http://digdilem.org

v.1.2 - November 2010

About:
======
An irssi script to manage wars for a clan. 

Credits to warmanager.tcl (by kalhimeo). No code or copy taken from that (other 
than the base for the html template), but the general idea taken and expanded 
upon. I loathe eggdrop, find its defaults are very undesirable, and love irssi 
- so rewrote the whole thing in perl. :)

The bot requires no additional libraries to run and tries to be simple to use. 
It can accomodate an unlimited number of wars and several games and gametypes 
concurrently. 

It will create a simple html file showing your war history, scores, who played 
and what maps were most played.

Installing: 
===========
1. Install irssi, run it and have it join your war channel automatically. If 
you have a channel password, set it in irssi. There are many great docs on 
setting up irssi, google's your man. You can run irssi in screen on a shell 
quite happily, or host locally. Would possibly even run on a windows machine 
with ActivePerl and a windows binary of Irssi.

2. Copy the files somewhere that irssi can find them. If you want warbot 
running automatically, create the directory ~/.irssi/scripts/autorun/ and copy 
or link it there. 

3. Edit warbot.pl and change the top section of confiration values. Warbot will 
NOT run happily until you do this (unless you're also called flash...). Details 
on configuration values follow below. 

4. From within irssi, type: "/script load warbot.pl" without quotes. Warbot 
should start and provided the config is okay, will announce in the privchan 
that it's a new bot being run for the first time. Now you can use the commands 
in the public channel. The first you'll want is !help

Configuration:
==============
Edit warbot.pl to change the following. After editing and saving you'll need to 
reload the script with "/script load warbot.pl" to pickup the changes.

I'll explain each variable. 

my $clanname = 'My Super Leet Clan'; 
# The full name of your clan. Used in the html warstats file.

my $clantag = 'mslc'; 
# Your clantag. Used for short versions of the above, warstats and in irc.

my $privchan = '#sekritchan';  
# What's the clan's private chan? Passwords are handled by irssi, this setting 
just tells the bot which channel to listen for commands in.

my $warfile = '/home/USERNAME/warbot.war'; 
# Where to save the war details. Change this to your homedir or wherever you 
like. War details are saved here.

my $cfgfile = '/home/USERNAME/warbot.ply'; 
# As above, but other config settings saved in here as well as player stats.

my $htmlfileout = '/home/USERNAME/warstats.html'; 
# What html file to create (hourly or by !dostats) - if you save it to a web 
dir ensure you have privalidges to do so, or link to it, or create the file and 
chmod 777 so that warbot can write to it.

my $html_template = '/home/flash/scripts/warbot.template'; 
# Template file for creation of above. Mostly compatible with Warmanager's, but 
more info on that below under "Html Template"

my $html_url = 'http://your.webserver.com/warstats.html';  
# Human readable link to where the stats file is created. This is displayed 
when somebody types !dostats

my $default_players = 5; 
# How many players needed for a war? Note that this can be over-ridden per war 
with the number() tag.

my $default_gametype = 'Ctf'; 
# What gametype to use unless specified? Again, can be over-ridden with the 
gametype() tag.

my $warning_time = 15; 
# How many minutes before the war should I post a message reminding those added 
to join? If not enough players have joined then the bot will also highlight all 
the players in the chan and ask them to join.

my $upcoming_default = 3; 
# How many upcoming games should I show by default when somebody types 
!upcoming ?

my $hour_offset = 0; 
# If the bot is supposed to be working in a different timezone, change it here. 
#Eg, if running in gmt and you want to bot to operate in cet, set to 1. For 
most people, 0 will be ok.

my $timezone = 'cet'; 
# Human readable bit to put in forthcoming wars. if not needed, leave blank

Colours: Use 2-digit numbers matching the MIRC colour code system.
my $color1 = '07'; # Two digit colour code for new announcements
my $color2 = '02'; # Main description text colour
my $color3 = '09'; # To highlight nicks etc.
my $color4 = '10'; # Enemy colors etc.

my @nohighlight = ( 'Q', 'Bodkin' ); 
# A list of nicks the bot shouldn't highlight when I need more players. Eg, 
bots or non-playing idlers.

my $trigger1='\!';  
# What to preceed the commands with (escape please) Best to leave this be.
my $trigger2='\.';  
# What to preceed the commands with (If you only want one trigger, make them 
the same)  Best to leave this be.

Irc Commands:
=============
Note that every war has a warid, a number starting from 1. This will be shown 
in several places and is used to identify clearly which war is which. Below 
this will be listed as warid and should be replaced with the id of the war.

!help - Shows the current help via PM
-----

!addmatch team(clantag) date(hh:mm-dd/MM/yy) 
---------

Optional: maps(mapname1 mapname2 etc) number(NumPlayers) info(Anything) 
gametype(GameOrType) chan(WarChannel) 

Okay, looks confusing, but don't panic. 

All you NEED to add are two tags, team and date. The team is the enemy team and 
the date tells the bot when the war is. Every other tag is optional and can be 
added on later without re-doing the whole war.

Eg: !addmatch team(Bunny Hunters) date(21:00-15/7/10)

This creates a new war against Bunny Hunters at 9pm on the 15th July, 2010. 

If you wanted to also specify 3 players and say what maps where listed to play, 
and mention it's DM gametype you could use:

# Admin Commands

!addmatch team(Bunny Hunters) date(21:00-15/7/10) number(3) maps(Gauntlet 
Deck16) gametype(DM)

If number or gametype aren't specified, the bot will simply use the default 
settings in warbot.pl

If chan() is added, bot will also ask players to join that channel before the 
game at it's pre-match warning.

(Also !new / !addwar)

!delete warid 
-------
Delete war entirely. Eg: '!delete 5' (Also !del, !d) - there's no undelete so 
be sure.

!clear warid
------
Remove all the added players for that warid.warid 

!chinfo warid field(value)
-------
A very powerful command allowing you to change any tag of any war. 
Eg: '!chinfo 7 number(4)' would change the number of players needed for warid 7 
to 4. Works with any tag - date to reschedule.

!addscore warid yourscore theirscore
---------
Add a score to a war for the html stats file.
Eg: '!addscore 10 5 2' would say that in warid 10, we won by 5 
points/caps/flags/games/maps to their 2.

!dostats
--------
Force a rebuild of the html stats file. (Otherwise done hourly) Useful for the 
impatient who've changed details or added a score to check. /dostats in irssi 
itself will also do this.

# Player Commands:

!add {n}
----
Add to a war. If warid {n} is omitted it will add you to the next game. 
Eg: '!add 4' will join you to warid 4. (Also !join/!a/!j)

!remove {n}
-------
Remove yourself from the war. Reverse of !add (Also !bye/!leave/!r)

!upcoming {n}
---------
Shows next {n} wars. Eg: '!upcoming 2' (Also !up / !l / !list) If {n} is 
omitted, shows the default number of upcoming wars.

!next
-----
As !upcoming, but only show the next game. (Also !n)

!last {n} 
-----
Show the last {n} games. (Also !l)

!info {n}
-----
Show war details for that warid. Eg: '!info 12' to show info about warid 12.

!stats {nick}
------
Show some simple stats about yourself or {nick}. If {nick} is omitted, tells 
you about yourself. Eg: '!stats Flash_' 


Html Template:
==============
Use warbot.template as an example and modify as you want.

Certain macros used in the template are expanded by warbot when the stats file 
is created. These are;

%clanname = Long name of your clan.
%winnumber = How many games your clan has won.
%losenumber = How many games your clan has lost.
%drawnumber = How many games your clan has drawn.
%totalwars = Total number of wars your clan has had.

%winavg = Your win average.
%loseavg = Your loss average.
%winpc = Your winning percent.
%losepc = Your loss percent.
%drawpc = Your draw percent.

%wartable = Expanded into a table containing a list of all wars. 
%maptable = Expanded into a table showing what maps have been played in order.
%playertable = Expanded into a table showing games per player.

%misc = Not supported. Used by warmanager

%help = Gives a badly formatted help screen of irc commands.

FUTURE IDEAS:
=============
- Store players by hostmask instead of nick with ability to register a handle.
- Limit topic update to reduce spammy changes.
- Announce players and wars to a public irc channel.
- !agenda - show which upcoming wars that you have already joined to. 
Source: readme.txt, updated 2010-11-22