Watch
-
Add Favorite
Currently usable modules are:
console
In other words, currently this has any value only on Linux servers. Valve has made the Windows servers not use standard ways to input and output data in the console, so it is not possible to directly manipulate them without hacking the function in the engine level, which in turn is not possible with EventScripts.
EXAMPLES
A simple example demonstrating how to capture the output of a Python function and that the text is not visible in console at all:
The above example will output this on a Linux server:
Another example that makes some real use of console output capture feature, it captures output of the console command "status" and parses it.
With the test part in previous example this is the output in console:
Note: This has been tested only on Linux Source Dedicated Server for Counter-Strike: Source. It should work in Orange Box version of the dedicated server too, but I have not been able to test it on one yet.
First release containing console output capture for Linux servers.
( Previous Versions )
Description
This Python module package will contain some advanced functions to interact more with the Source server itself. For any ideas on what to add, please post in the forum topic.Currently usable modules are:
console
- This module contains functions for directly interacting with the server console.
- NOTE: Console functions work on Linux servers only!
- dbgmsg(text)
- Prints selected text on stderr stream. This will make the text appear in the console even if output capture was active.
- text - the text you want to print, a new line character is appended by the function
- get_concmd_output(command, callback, args=(), kw={}, bufsize=1024)
- Executes a console command and captures whatever it outputs to the server console and calls the callback function with the data. The captured output will not visible in the server console.
- command - the command string to be executed using es.ServerCommand (equal to es.server.queuecmd)
- callback - a Python callable object that should accept at least one parameter, the captured text string
- args - optional parameter containing extra parameters that should be used with the callback function in a tuple
- kw - optional parameter containing the keyword parameters that should be used with the callback function in a dict
- bufsize - optional parameter specifying the maximum length of output to be saved from the console (no, there is no 'unlimited' option)
- get_console_output(function, args=(), kw={}, bufsize=1024)
- Calls a Python function with given parameters, captures any console output the function creates and returns a tuple of type (return_value, captured_output) where return_value is whatever the Python function returned and captured_output is the text that would had appeared on the server console during executing the function.
- function - the Python callable object to execute
- args - optional parameter being a tuple of parameters for the function
- kw - optional parameter being a dictionary of keyword arguments for the function
- bufsize - optional parameter specifying the maximum length of output to be saved from the console (no, there is still no 'unlimited' option)
In other words, currently this has any value only on Linux servers. Valve has made the Windows servers not use standard ways to input and output data in the console, so it is not possible to directly manipulate them without hacking the function in the engine level, which in turn is not possible with EventScripts.
EXAMPLES
A simple example demonstrating how to capture the output of a Python function and that the text is not visible in console at all:
import es |
The above example will output this on a Linux server:
| First message! Third message! es.dbgmsg returned None and the text it put was: "Second message!" |
Another example that makes some real use of console output capture feature, it captures output of the console command "status" and parses it.
import es |
With the test part in previous example this is the output in console:
| {'address': '192.168.11.150:27015', 'build': '3224', 'hostname': 'Counter-Strike: Source', 'map': 'de_dust', 'maxplayers': 32, 'players': 0, 'secure': True, 'version': '1.0.0.34/7'} |
Note: This has been tested only on Linux Source Dedicated Server for Counter-Strike: Source. It should work in Orange Box version of the dedicated server too, but I have not been able to test it on one yet.
Installation
- Download the ZIP file: http://addons.eventscripts.com/addons/download/srcds
- Extract it to your game folder
- Load some scripts that utilize this package or create your own!
Version Notes For 0.8.0811
Updated on: 2008-08-11 14:45:24 EST by GODJonezFirst release containing console output capture for Linux servers.
( Previous Versions )
Discussion
Forum Link: http://forums.mattie.info/cs/forums/viewtopic.php?t=25426
Addon Details
Upload Addon