[bf1942] We REALLY need the BF2 Python API
"Einar S. Idsø"
esi at itk.ntnu.no
Sun Jun 26 08:55:48 EDT 2005
Sure, that was our intention all along. We're just cleaning up the code
a bit, adding comments and such.
If by "callback registration" you mean calls on the form
host.registerHandler('EventName', pythonEventHandler[, parameter]), then
yes, we have that working. We have no idea what "parameter" is, but so
far it seems like it's necessary to put a 1 there. Additionally, the
function specified by pythonEventHandler needs to have the correct
number of arguments, a number which depends on the actual event.
We'll be posting more later on (hopefully today) when we've got
everything put together.
Forrest Thiessen wrote:
> Your script sounds really great--any change you would be willing to
> share it?
> Does this mean you solved the problem with getting callback registration
> to work? I'm still messing with it--I think I've tried around 64 of the
> 190 ;-) possible variations I've thought of, and so far none have
> worked. This is slow going, trying to figure everything out in reverse.
> On the other hand, I've had very good luck with
> host.registerGameStatusHandler(pythonEventHandler). . . it works exactly
> like you would expect it to. You can only get so far with game status
> changes, though!
> --Forrest (aka "Woody")
> Einar S. Idsø wrote:
>>Shamelessly following up on my own post here:
>>We've just finished a script to perform autokick of players based on
>>ping (measure every 30 seconds, if ping goes above limit three times,
>>you're out). This was a lot of hard work w/o any documentation on the
>>API. Thank goodness for the Wiki-page!
>>But to my question: We all know about the game.sayall command by now. It
>>will spam some text in green at the top left. We use this to inform
>>players when they exceed the ping-limit and when they are about to be
>>kicked. We think it would be much better to have text in a red
>>warning-color for this, and possibly placed in the middle of the screen
>>instead of the top corner. It would also be nice to send the message
>>directly to the player instead of spamming it to the entire server.
>>So does anyone know of any other rcon- og Py-functions for sending
>>messages to the server/individual players? We were able to find a
>>function called bf.gameLogic.sendServerMessage() in
>>python/bf2/stats/stats.py, but it seems like it's not working right (the
>>function in stats.py where it is used seems to be unfinished as well).
More information about the Bf1942