[Crossfire-wiki] [Crossfire DokuWiki] page added: user:eadmund:scripts:crossfire.py

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sat Aug 25 11:56:34 CDT 2007


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2007/08/25 11:56
User        : eadmund
Edit Summary: created

====== 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:

<code python>from crossfire import *</code>

====== Code ======

<code python>
"""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
</code>

IP-Address  : 66.7.168.156
Old Revision: none
New Revision: http://wiki.metalforge.net/doku.php/user:eadmund:scripts:crossfire.py

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list