Editing and Customization > Modding Help

How To Get Output From In-Game Console Command?


Is that something that's possible? I saw there is a GetCVarValue() function, but I'd like to run the "status" command in the console and then grab all the output.

You will just have to enumerate all the players and get their information from there like name, etc. There is no way to redirect console output into Python.

Utils.GetPlayers() is a useful tool to do this. You can loop it very easily:

--- Code: ---
from .Utils import GetPlayers

for player in GetPlayers():

--- End code ---

Oh I've already got a function that does that except that it iterates from 1 onwards until it finds an index where the player reference is None. That's how I'm currently getting the after round results. If you think it's better/more efficient to do it the other way, though, then I'll modify it. It works as is, so I'm happy. I was mainly trying to find a way to get the current map. I've yet to find a function or variable that returns that info. I just knew that when I run "status", it shows up in the output. I was going to parse it from there. Is there not a way to get that? Is it not stored in a CVar or something that I can reference?


[0] Message Index

Go to full version