How Do I Get Game Data Out
Moderator: Moderators
How Do I Get Game Data Out
Not sure this is scripting exactly but anyone know how i can get and reuse game data, like player scores at the end of maps.
I've seen websites with "xxx is todays top fragger with yyy score" - this must be collecting that data. Like running a status command in the console and dumping it somewhere to reuse (txt file?).
Any ideas?
I've seen websites with "xxx is todays top fragger with yyy score" - this must be collecting that data. Like running a status command in the console and dumping it somewhere to reuse (txt file?).
Any ideas?
escuchame


-
Bjarne BZR
- Site Admin
- Posts: 3298
- Joined: Wed Feb 05, 2003 2:04 pm
- Location: Sweden
- Contact:
well if u could somehow gather the players scor u could make it a cvar. in a config file u could grab the cvar to get in on ur comp, stor it as a variable then grab it through javascript. i dont know how to go about the .cfg to java conversion though.....
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
-
dcoshea
- Colour Sergeant
- Posts: 94
- Joined: Thu Mar 04, 2004 3:00 am
- Location: Sydney, Australia
- Contact:
Yes, or alternatively they could monitor the server log file, looking for "<some name> was rifled by <some other name> in the <body part>" text, or they could do both together.Bjarne BZR wrote:To the best of my knowledge, those apps get that info from sending the server the "serverinfo" and "status" querys from an external application.
Slopester was talking about putting the information on a web site, not using it in the game, so that's not an issue, right?No idea how they get it back into MOHAA however.
If you happen to want to get information into the game from an external program, you could pass it in via setting cvars via rcon. If it's not important that the map scripts get the information right away, you could write to a script file that is 'exec'd; the file won't be re-loaded until the next map is loaded, though.
Regards,
David
-
dcoshea
- Colour Sergeant
- Posts: 94
- Joined: Thu Mar 04, 2004 3:00 am
- Location: Sydney, Australia
- Contact:
I don't believe you can get player's scores within the game unless you want to spawn triggers around the players and try and figure out who killed who that way (see the "kill cam" thread), but then I know you definitely can't get the player names within the game. The gathering of the player's score would happen outside of the game.kai0ty wrote:well if u could somehow gather the players scor u could make it a cvar.
There are already tools out there which do this kind of thing - do a Google search for "mohstats" for starters. Here's a sample of the output of that tool: http://mohstats.fragism.com/output/index.html
Regards,
David
-
dcoshea
- Colour Sergeant
- Posts: 94
- Joined: Thu Mar 04, 2004 3:00 am
- Location: Sydney, Australia
- Contact:
The sites almost certainly use server-side scripting to get the information, so the source won't be of any assistance since it will just have the tables and stuff used to display the statistics.kai0ty wrote:u shud just go to one of the sites u mentioned and look at the source. its probably tyhe easiest way.
Regards,
David
Hi & thx for all the replies.
You're right about source code dcoshea - can't see anything worth viewing as all the main scripting is serverside.
I know enough PHP to strip lines from a server log file and reuse that info, assuming that info is in the log file. Can anyone tell me what's written to the logfile and where it is on the server? Is this like a record of what's output to console?
Thx also for link to mohstats - gonna look at that now
You're right about source code dcoshea - can't see anything worth viewing as all the main scripting is serverside.
I know enough PHP to strip lines from a server log file and reuse that info, assuming that info is in the log file. Can anyone tell me what's written to the logfile and where it is on the server? Is this like a record of what's output to console?
Thx also for link to mohstats - gonna look at that now
escuchame


-
dcoshea
- Colour Sergeant
- Posts: 94
- Joined: Thu Mar 04, 2004 3:00 am
- Location: Sydney, Australia
- Contact:
You need to set the cvar 'logfile' to enable logging, which goes to main/qconsole.log (or mainta, maintt, etc.). 'logfile 2' causes each line that is sent to the server console to be written to the log file immediately, whereas 'logfile 1' causes them to be buffered a bit before being written. If you don't care about up-to-the-second statistics, you could probably use the buffered option to decrease file/disk access.Slopester wrote:I know enough PHP to strip lines from a server log file and reuse that info, assuming that info is in the log file. Can anyone tell me what's written to the logfile and where it is on the server?
What actually gets written depends on what cvars you set. I'm not sure what you have to set to see the '<player> was <weapon>ed by <player>' messages you see as a player, but I'm pretty certain it's possible. Setting developer mode might help. You can probably find information on what settings need to be set on the mohstats site
Sure is.Is this like a record of what's output to console?
Apparently you can get statistics which record each time a player is injured too. I think if you look through the cvar list you can find some debug logging options which will record that kind of stuff.
There is a fairly recent thread on www.modtheater.com's MOH scripting forum regarding sending rcons to the server if you are interested in using that to set cvars.
Regards,
David


