GoldenEye: Source Forums

  • November 23, 2024, 11:13:53 am
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: How To Get Output From In-Game Console Command?  (Read 12449 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, 12:32:18 pm »

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: 346
  • 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 21, 2016, 01:40:09 am »

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 21, 2016, 09:42:05 am »

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 21, 2016, 10:43:41 am by Phivex »
Logged
Pages: [1]   Go Up