====== crossfire.py ======
A small library of convenience functions for writing Crossfire client-side script in Python. I blatantly ripped this off from [[user:mhoram:scripts:subs.pl]]--but hey, imitation's the sincerest form of flattery, right?
To use:
from crossfire import *
====== Code ======
"""library for handling Crossfire scripting
License: GPL v3
"""
import sys
def getline():
return sys.stdin.readline()
def putline(line):
print line
sys.stdout.flush()
def wait_for_server():
putline("watch comc")
getline()
putline('unwatch comc')
return
def draw(colour, line):
putline('draw %s %s' % (colour, line))
def issue(command):
putline('issue 1 1 %s' % command)
wait_for_server()
def log(line):
print >>sys.stderr, line