GoldenEye: Source Forums

  • September 23, 2018, 12:51:11 AM
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: How To Get Output From In-Game Console Command?  (Read 1487 times)

0 Members and 1 Guest are viewing this topic.

Phivex

  • Agent
  • *
  • Posts: 21
  • Reputation Power: 3
  • Phivex has no influence.
  • Offline Offline
How To Get Output From In-Game Console Command?
« 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.
Logged

killermonkey

  • GES Programmer
  • Retired Lead Developer
  • GE:S Fanatic
  • *
  • Posts: 5,473
  • Reputation Power: 327
  • killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!
  • Offline Offline
    • DroidMonkey Apps
Re: How To Get Output From In-Game Console Command?
« Reply #1 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()


Logged

Phivex

  • Agent
  • *
  • Posts: 21
  • Reputation Power: 3
  • Phivex has no influence.
  • Offline Offline
Re: How To Get Output From In-Game Console Command?
« Reply #2 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?
« Last Edit: September 20, 2016, 11:43:41 PM by Phivex »
Logged
Pages: [1]   Go Up