Page 1 of 3
How Do I Get Game Data Out
Posted: Mon Mar 22, 2004 2:56 am
by Slopester
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?
Posted: Mon Mar 22, 2004 4:06 am
by kai0ty
i wouldnt know how to grab that info, but if u want it to transfer though levels u can use cvars. why not look at the source code of that particualr site tha tu was this on and see what it contains.
Posted: Mon Mar 22, 2004 11:12 pm
by M&M
yeah ,i would like 2 know that 2 .i run tournys from time 2 time on my lan and it would be very cool 2 add that (ive been doing it manually b4

).
if any1 can figure it out or tell me how 2 (i know nothing about source codes) then i would be very grateful

Posted: Mon Mar 22, 2004 11:54 pm
by Bjarne BZR
To the best of my knowledge, those apps get that info from sending the server the "serverinfo" and "status" querys from an external application. No idea how they get it back into MOHAA however.
Posted: Tue Mar 23, 2004 12:21 am
by blue60007
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. No idea how they get it back into MOHAA however.
A localization file maybe??

Posted: Tue Mar 23, 2004 3:42 am
by kai0ty
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.....
Posted: Tue Mar 23, 2004 3:49 am
by blue60007
kai0ty wrote: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.....
sounds like a plan

...
Posted: Tue Mar 23, 2004 4:00 am
by dcoshea
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.
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.
No idea how they get it back into MOHAA however.
Slopester was talking about putting the information on a web site, not using it in the game, so that's not an issue, right?
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
Posted: Tue Mar 23, 2004 4:05 am
by dcoshea
kai0ty wrote:well if u could somehow gather the players scor u could make it a cvar.
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.
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
Posted: Tue Mar 23, 2004 4:11 am
by kai0ty
u shud just go to one of the sites u mentioned and look at the source. its probably tyhe easiest way.
Posted: Tue Mar 23, 2004 4:22 am
by dcoshea
kai0ty wrote:u shud just go to one of the sites u mentioned and look at the source. its probably tyhe easiest way.
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.
Regards,
David
Posted: Tue Mar 23, 2004 4:50 am
by bdbodger
Just a guess but some guys were takeing about writeing a rcon program a while ago either here or at tmt . If you somehow monitor the serverlog and could write a program like that then you could set a cvar through rcon and use some huddraw commands to display it .
Posted: Tue Mar 23, 2004 5:15 am
by Slopester
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

Posted: Tue Mar 23, 2004 12:13 pm
by dcoshea
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?
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.
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
Is this like a record of what's output to console?
Sure is.
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
Posted: Tue Mar 23, 2004 7:35 pm
by Slopester
genius.
thx m8.
dunno nuthin bout cvars so gonna do a bit of reading - thx for pointers
