On this page
Console, log and RCON
3 functions of the host module. Generated from the bf2-rs sources; see the reference index for the cross-game table.
log#
host.log(text)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x0042a050, BF2.exe!0x0045e3a0, BFHeroes.exe (1.89)!0x004923e3 |
What it does (from the original code). Appends text+"\n" to the error-capture stream (state+0x48) only while PythonHost::fetchErrorString (0x00429db0) runs PyErr_Print; otherwise the text is dropped. bf2.fake_stream routes sys.stdout/sys.stderr here, so print output never reaches a log in retail except inside captured tracebacks.
Shipped scripts use it like this:
host.log("".join (self.buf))host.log("".join (self.buf))host.log("".join (self.buf))rcon_invoke#
host.rcon_invoke(cmd)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 |
| Returns | str |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x00429ba0, BF2.exe!0x0045de70, BFHeroes.exe (1.89)!0x00493618 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:422 |
What it does (from the original code). returns "" (0x0078375c). Otherwise appends "\n" if missing, runs the console command line through console vt+0x08(cmd, &out, 0,0,0,0,0) (PTR_DAT_00834ce4) and returns the captured output, forced to end with "\n" (empty output -> "\n").
Shipped scripts use it like this:
ctx.write(host.rcon_invoke(cmd))ctx.write(host.rcon_invoke(cmd))rcon_feedback#
host.rcon_feedback(playerId, text)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 s@1 |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x00429cb0, BF2.exe!0x0045df60, BFHeroes.exe (1.89)!0x004921b4 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:463 |
What it does (from the original code). Posts EventManager (DAT_00892d5c) vt+0x10(6, 0x13, &{int playerId; std::string "rcon: "+text}, 0).
Shipped scripts use it like this:
host.rcon_feedback(ctx.player, feedback)host.rcon_feedback(ctx.player, feedback)tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.