How Do I Get Game Data Out

Post your scripting questions / solutions here

Moderator: Moderators

Slopester
Lance Corporal
Posts: 16
Joined: Tue Feb 03, 2004 12:08 am

How Do I Get Game Data Out

Post 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?
escuchame
Image
kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Post 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.
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post 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 :wink:
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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.
Admin .MAP Forums
Image
Head above heels.
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post 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?? :?
Image
kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Post 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.....
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post 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 :? :? ...
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post 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
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post 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
kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Post by kai0ty »

u shud just go to one of the sites u mentioned and look at the source. its probably tyhe easiest way.
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:

Post 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
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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 .
Image
Slopester
Lance Corporal
Posts: 16
Joined: Tue Feb 03, 2004 12:08 am

Post 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 :D
escuchame
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post 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
Slopester
Lance Corporal
Posts: 16
Joined: Tue Feb 03, 2004 12:08 am

Post by Slopester »

genius.

thx m8.

dunno nuthin bout cvars so gonna do a bit of reading - thx for pointers :D
escuchame
Image
Post Reply