GoldenEye: Source Forums

Editing and Customization => Modding Help => Topic started by: Phivex on September 20, 2016, 01:32:18 am

Title: How To Get Output From In-Game Console Command?
Post by: Phivex on September 20, 2016, 01:32:18 am
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.
Title: Re: How To Get Output From In-Game Console Command?
Post by: killermonkey on September 20, 2016, 02:40:09 pm
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: [Select]
from .Utils import GetPlayers

for player in GetPlayers():
    player.GetPlayerName()


Title: Re: How To Get Output From In-Game Console Command?
Post by: Phivex on September 20, 2016, 10:42:05 pm
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?