Alliedassault           
FAQ Calendar
Go Back   Alliedassault > FPS Gaming General Discussion > MoH General Discussion
Reload this Page What does i take to make a MOH stats program???
MoH General Discussion General Discussion about Medal of Honor: Allied Assault, expansions and Pacific Assault

Reply
 
Thread Tools Display Modes
Re: What does i take to make a MOH stats program???
Old
  (#1)
[NBK] G.I. Jerk is Offline
Senior Member
 
Posts: 292
Join Date: Apr 2002
Location: Calgary, Ab. CanaDUH
 Send a message via ICQ to [NBK] G.I. Jerk Send a message via MSN to [NBK] G.I. Jerk  
Default Re: What does i take to make a MOH stats program??? - 10-03-2002, 09:56 PM

[quote="Badass Joe"]

I know the program need some sort of parser, what is a parser, what kind of language is i written in, can a parser be found on the net and where??[\quote]

To parse something basically means that you have a huge list of garbage intermingled with what you want to find. You can parse in many ways if you know how. VBS (visual basic script) Perl, Python and even DOS can be used to get to the goodies. Where can one be found? Beats me I'd write my own.


[quote="Badass Joe"]How is it possible to have the stats program out put the result from the log file as HTML?[\quote]

You parse what you wish....take the good stuff and encapsulate it between html TAGS. (can't show you here...php wont accept it in a post)

(simplified for your benefit using DOS since that's my old trusty fallback which I understand the best)

EXAMPLE

You run a server with DEFAULT death messages (predicatable lines of text called STRINGS make it MUCH easier) and you wish to compile a list of kills and methods of kills for each clan member. ie: how many kills by bashing, sniping, rocket etc etc.

In a DOS script (called a batchfile) I'd have it look through a list (1 line at a time) for each clan members name. (using Your name this example)

FIND /I "Badass Joe" qconsole.log >badassjoe.txt

This finds EVERY line that your name appears on IN qconsole.log and the ">" sends those lines to a new text file that I delve into deeper.
The "/I" tells the FIND command to ignore upper/lower case differences.
At this stage it includes BOTH your kills and deaths.

Then to distinuish your kills from your deaths (this is where text predicatability comes into play) I FIND "by Badass Joe" The default death messages say things like GI Jerk was sniped "by Badass Joe"

FIND /I "by Badass Joe" badassjoe.txt >joeskills.txt

You'd have to repeat these steps for a few other death messages such as:

"took Badass Joe's rocket in the kisser"
"is pulling Badass Joe's shrapnel out of his teeth"


Anyway you dump all of these kills into the same text file. Then I'd use the DOS FIND command again to NUMBER every line with your name in it using the "/N" SWITCH built into the FIND command into yet another text file.

FIND /I /N "Badass Joe" joeskills.txt >joeskills2.txt

The text file would look like:

[1] GI Jerk was sniped BY Badass Joe in the head
[2] GI Jerk took Badass Joe's rocket right in the kisser
[3] GI Jerk is pulling Badass Joe's shrapnel out of his teeth

and so on...

Then to find out how many kills it is in total I FIND [x] where "x" is a number.

FIND "[20]" joeskills2.txt (i'd start with a much higher number but to illustrate...)
IF ERRORLEVEL 1 GOTO 19 (19 is a LABEL that tells script to jump to a line in the script that has ":19" on a line of its own..errorlevel1 means NOT FOUND)
:19
FIND "[19]" joeskills2.txt
IF ERRORLEVEL 1 GOTO 18
:18 (and so on and so forth)

So the script runs through until it "counts" (dos can't count ...has no math functions but figuratively) down to a number it can find. (the highest number since we're counting DOWN) Once it is found, the script (by weeding out the "[]" leaves you with JUST the number between them) ie: "[12]" becomes "12"

Then I turn "Badass Joe" and "12" into VARIABLES called %%1 and %%2


The script can then ECHO (echo means print on screen or into a text file) what it needs to make a webpage from it. (greater than/less than signs reversed to not screw up php forum....also you can't ECHO a greater then sign to a file because greater than sign is a DOS redirector.....you echo ANOTHER symbol then use a DOS prog called BFR to replace it later)

ECHO >html< >joeskills.html (a single ">" creates or overwrites a file ">>" APPENDS to it)
ECHO >head< >>joeskills.html
ECHO >title< %%1's Kills >/title< >>joeskills.html
ECHO >body< >>joeskills.html
ECHO %%1 has %%2 kills today >>joeskills.html
[b]ECHO >/body< >>joeskills.html
ECHO >/html< >>joeskills.html

Then you need to take this webpage and update your website with it. DOS FTP command is scriptable so it does just fine.

ECHO OPEN >upload.txt (open is an FTP command...not DOS's)
ECHO TO >>upload.txt (same as above)
ECHO ftp.your-web-host.com >>upload.txt (same)
ECHO your-user-name >>upload.txt
ECHO your-password >>upload.txt
ECHO cd /whatever/folder/you want >>upload.txt (cd = change directory)
ECHO PUT joeskills.html (FTP PUT command.... well PUT means upload)
ECHO BYE >>upload.txt (BYE means close the connection)

Then you execute another script or manually issue the command that says:

FTP :s upload.txt (:s tells FTP read the script and do what it says....all of this you COULD do yourself from a DOS prompt)


Sorry for being so long winded here....it's hard to make it understandable to a scripting noobie without being so.

That's the VERY basics.... it's quite doable. You DON'T need any special programming language. You just need DOS at the VERY LEAST.

Before you ask me to make this for you (have a feeling you will...and I'd do it for the practice)you'd NEED to give me your servers FTP username and password so I can READ the qconsole.log file to parse it in the first place. I'd ALSO need your username and password of your clan's website to update the stats page. That's up to you....

(edited)

Actually now that I re-read this post I wouldn't need user/pass at all. BUT you'd have to fill in a couple blanks in the script.
  
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.12 by ScriptzBin
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBulletin Skin developed by: vBStyles.com
© 1998 - 2007 by Rudedog Productions | All trademarks used are properties of their respective owners. All rights reserved.