[bfprog] announcement script

Ronald Pompa wizzler at lokalen.nu
Tue Jun 28 16:56:03 PDT 2005


I've recently dived into the word of Python and tried to make a simple
announcement script and this is what I've got so far:

 

import bf2

import host

from bf2 import g_debug

 

# announce every 5 min

announceTime = 300

 

# announce text

announceText = "Hello world"

 

def init():

    global announceTime

 

    if g_debug: print 'initialising announce script'

            

 

    # timer set to 5 min

    announcer = bf2.Timer(announceIt, announceTime, 1)

    announcer.setRecurring(10)

 

    host.rcon_invoke('echo "announce_le.py loaded"')

 

def announceIt():

    global announceText

 

    host.rcon_invoke('game.sayAll "\" + announceText + "\"')

 

The problem is it does not work. Anyone else got any ideas on how to make it
work? What am I doing wrong ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.matureasskickers.net/pipermail/bfprog/attachments/20050629/a5e034d6/attachment.html


More information about the BFProg mailing list