|
|||||||
| OOTP Mods Logos, roster packs, historical databases, OOTP tools, FaceGen files... it's all here! |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Bat Boy
Join Date: Jan 2005
Location: Frisco, TX
Posts: 14
Thanks: 0
Thanked 1x in 1 post
|
Carya Game Log Viewer
Download
http://www.glass4.com/hbl/carya_log/carya_log.zip What is it? A while back I wrote a utility for my league (Hickory Baseball League) for managing our live playoff simulations. I received a request for its use in another league so I'm packaging it up for anyone that wants to use it. As you can see from the screenshot below, this web app allows for up to 4 games to be "watched" at once - each section of the screen will update every 5 seconds with the next action of the game. ![]() How does it work? When a game is simulated, a game log is generated in your \Documents\Out of the Park Developments\OOTP Baseball 9\saved_games\HBL.lg\news\txt\leagues\ directory. This program parses that file and reads the events of a game into a database. Then, when you inform the system to start the display of the game, it will begin showing the game in the screen above. Setting it up First, you'll need a website with some a database and PHP support. I use mySQL. Here is the script you'll need to run to generate the required tables. Code:
-- -------------------------------------------------------- -- -- Table structure for table `carya_log_event` -- CREATE TABLE `carya_log_event` ( `eventID` int(11) NOT NULL default '0', `gameID` int(11) NOT NULL default '0', `eventText` varchar(255) NOT NULL default '', `inning` int(11) NOT NULL default '0', `baseState` char(3) NOT NULL default '', `outs` int(11) NOT NULL default '0', `batter` varchar(30) NOT NULL default '', `pitcher` varchar(30) NOT NULL default '', `runs` int(11) NOT NULL default '0', `hits` int(11) NOT NULL default '0', `errors` int(11) NOT NULL default '0', PRIMARY KEY (`eventID`,`gameID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `carya_log_game` -- CREATE TABLE `carya_log_game` ( `gameID` int(11) NOT NULL default '0', `awayTeam` varchar(50) NOT NULL default '', `homeTeam` varchar(50) NOT NULL default '', PRIMARY KEY (`gameID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `carya_log_timer` -- CREATE TABLE `carya_log_timer` ( `id` int(11) NOT NULL default '0', `gameID` int(11) NOT NULL default '0', `startTime` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO carya_log_timer VALUES (1, -1, -1); INSERT INTO carya_log_timer VALUES (2, -1, -1); INSERT INTO carya_log_timer VALUES (3, -1, -1); INSERT INTO carya_log_timer VALUES (4, -1, -1); Code:
$filePath = "/$HTML_PATH$/carya_log/logs/";
$imagePath = "http://$URL$/";
function connect_database() {
$user="$USER_NAME$";
$password="$PASSWORD$";
$database="$DATABASE$";
mysql_connect("$DB_SERVER$", $user, $password, FALSE, MYSQL_CLIENT_COMPRESS);
@mysql_select_db($database) or die("db error");
}
$URL$: This is the URL to your website, for example 'www.glass4.com/hbl'. This path is used to show the team icons (16x16, png). The icons will be the same as the team name in the game log file (for instance, 'Baltimore Orioles.png'). $USER_NAME$: User name for your database connection. $PASSWORD$: Password for your database connection. $DATABASE$: Name of your database. $DB_SERVER$: Name of the server your database is on. So once you've made those modifications you should be ready to go. Starting a game for viewing is a 5 step process: 1) Upload up to 4 log_$ID$.txt files from your OOTP folder to http://yourwebsite.com/carya_log/logs/ directory. 2) Navigate to http://yourwebsite.com/carya_log/load.php. This will parse the .txt files and save the events into the database. 3) Delete the log_$ID$.txt files. 4) Navigate to http://yourwebsite.com/carya_log/start.php. For each field on the screen, type in the id of the game you want to view ($ID$ in the txt file name). 5) Tell your users to navigate to http://yourwebsite.com/carya_log/ to watch the games! That should be it. If you have any comments or questions feel free to post them in the thread and I'll get back to them when I can. This code is fairly old and I had some plans to eventually rewrite the thing to make it a bit more elegant, but I haven't found the time yet. There probably needs to be some security measures on the load and start pages so you could rename them or put them in a password-protected directory if you want. So use at your own risk in the meantime. Anyway, enjoy.
__________________
Hickory Baseball League http://www.hblbaseball.com/ Last edited by rglass95; 04-24-2011 at 11:34 AM. |
|
|
|
| Thank you for this post: | diamondreplays (08-05-2011) |
|
|
#2 (permalink) |
|
Hall Of Famer
Join Date: Aug 2007
Posts: 2,179
Thanks: 1,110
Thanked 562x in 298 posts
|
You just sold me on upgrading our league to a website that supports mySQL.
__________________
Commissioner of the Planetary Extreme Baseball Alliance (PEBA) and the League of the Rising Sun (LRS) Premiere OOTP fictional leagues where creativity counts and imagination is your only limitation Check for openings - contact us today! |
|
|
|
|
|
#3 (permalink) |
|
Hall Of Famer
Join Date: Nov 2004
Posts: 5,940
Thanks: 236
Thanked 207x in 103 posts
|
This is awesome!!!
John, I should get you squared away with your new account as soon as we can decide on a domain name for you.
__________________
Fidel Montoya Asahi2 Baseball Commissioner(Historical League Since 2004) www.allsimbaseball.com (OOTP web hosting - Customized sites for online leagues - Sign up, Connect OOTP and Play!) Share Your Mods - Free, unlimited and easy to upload to share your Mods instantly(free site registration required) AllYouSports - "Because Facebook don't do baseball stats" |
|
|
|
|
|
#4 (permalink) |
|
All Star Reserve
Join Date: Dec 2001
Location: NY
Posts: 585
Thanks: 2
Thanked 4x in 2 posts
|
This utility rules. It makes simming the playoffs a hell of a lot of fun.
__________________
------------------- Montreal Expos / Calgary Storm, HBL HBL Baseball - Currently in 50th season with OOTP, Began March 2001. HBL Waiting List |
|
|
|
|
|
#5 (permalink) |
|
Bat Boy
Join Date: Jan 2005
Location: Frisco, TX
Posts: 14
Thanks: 0
Thanked 1x in 1 post
|
Edit - took the demo down for a bit.
__________________
Hickory Baseball League http://www.hblbaseball.com/ Last edited by rglass95; 05-12-2009 at 12:28 AM. |
|
|
|
|
|
#6 (permalink) |
|
All Star Starter
Join Date: Nov 2009
Location: AZ Via VA
Posts: 1,321
Thanks: 211
Thanked 198x in 170 posts
|
having issues getting this to work
i get sql errors when i load the table into the sql data base abd then i get this when i go to load.php singles. Error ("Single . Outs: 0 INSERT INTO carya_log_event (eventID, gameID, eventText, inning, baseState, outs, batter, pitcher, runs, hits, errors) VALUES (1, load.php, ' singles. Error ("Single .', 0, '010', 0, '', '', 0, 1, 0); Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/hrb.soa-skateboards.com/carya_log/load.php on line 238 then i get a bunch of error when i goto watch the game Carya Game Log Viewer i welcome any help |
|
|
|
|
|
#7 (permalink) |
|
Hall Of Famer
Join Date: Dec 2001
Location: Union City, TN
Posts: 6,126
Thanks: 59
Thanked 568x in 336 posts
|
Its looking for files in the following line of code:
/home/www/hrb.soa-skateboards.com/carya_log/view.php the part between the www and the carya_log should be your account username, not your url. I'm not even sure the www is needed. I don't use that in my paths. Secondly, how did I miss this post for the past two years? My buddy who runs the BBS' sister league pointed it out to me today. This a great tool. I'll be installing tonight. Last edited by Cooleyvol; 04-19-2011 at 11:40 AM. |
|
|
|
|
|
#8 (permalink) |
|
Hall Of Famer
Join Date: Dec 2001
Location: Union City, TN
Posts: 6,126
Thanks: 59
Thanked 568x in 336 posts
|
After looking at this, from what I can tell you can only load a max of four games. You cannot choose from many games as I first thought.
It'd be great if all the logs of the recent sim could be uploaded and the user could choose the games he wanted to watch. |
|
|
|
| Thank you for this post: | sdodd (07-23-2011) |
|
|
#10 (permalink) |
|
Minors (Triple A)
Join Date: Jan 2011
Posts: 266
Thanks: 50
Thanked 67x in 31 posts
|
Ok.. I need just a little help. Here is the error I'm getting
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/mlob/public_html/carya_log/view.php on line 273 |
|
|
|
|
|
#13 (permalink) |
|
All Star Starter
Join Date: Nov 2009
Location: AZ Via VA
Posts: 1,321
Thanks: 211
Thanked 198x in 170 posts
|
This utility rules. and my League Home-Run Baseball League will use this for its playoffs for both leagues . i love this app a lot have been using it for a long time .
my league its fictional league with 2 leagues in one league file the HRBL and the Puro Yakyu (PY), just opened for gms like 2 dyas ago chk us out and join http://www.ootpdevelopments.com/boar...apply-now.html
__________________
Jerseys and caps/logos and more http://s39.photobucket.com/albums/e1...%20and%20caps/ Leagues POTD: Vermont/Co-Commish: http://potd.pterodactyl.ca/ MTBL: Daytona Bombers: http://mtblcentral.com/Board/ RFTP : Braves/co-commish: http://rftp.tuckermade.net Application for membership into RFTP The Show: Miami Marlins: http://theshow.ootpleagues.com/index.php |
|
|
|
|
|
#14 (permalink) | |
|
Minors (Double A)
Join Date: Feb 2010
Posts: 138
Thanks: 2
Thanked 48x in 29 posts
|
Pbp
Quote:
Will this work for that purpose? Thanks |
|
|
|
|
|
|
#15 (permalink) |
|
All Star Starter
Join Date: Nov 2009
Location: AZ Via VA
Posts: 1,321
Thanks: 211
Thanked 198x in 170 posts
|
u can just go into the game logs and pull the data out and do what u need to with it .
the logs are in the news folder under text or html depending on which u want to use
__________________
Jerseys and caps/logos and more http://s39.photobucket.com/albums/e1...%20and%20caps/ Leagues POTD: Vermont/Co-Commish: http://potd.pterodactyl.ca/ MTBL: Daytona Bombers: http://mtblcentral.com/Board/ RFTP : Braves/co-commish: http://rftp.tuckermade.net Application for membership into RFTP The Show: Miami Marlins: http://theshow.ootpleagues.com/index.php |
|
|
|
|
|
#16 (permalink) |
|
Hall Of Famer
Join Date: Dec 2001
Location: Union City, TN
Posts: 6,126
Thanks: 59
Thanked 568x in 336 posts
|
Some threads should just be pinned. This is one of those threads.
So many pinned threads are no longer useful while nuggets like this fall through the cracks. |
|
|
|
|
|
#17 (permalink) |
|
All Star Starter
Join Date: Nov 2009
Location: AZ Via VA
Posts: 1,321
Thanks: 211
Thanked 198x in 170 posts
|
Yea its still very usefull
Sent from my DROID X2 using Tapatalk 2
__________________
Jerseys and caps/logos and more http://s39.photobucket.com/albums/e1...%20and%20caps/ Leagues POTD: Vermont/Co-Commish: http://potd.pterodactyl.ca/ MTBL: Daytona Bombers: http://mtblcentral.com/Board/ RFTP : Braves/co-commish: http://rftp.tuckermade.net Application for membership into RFTP The Show: Miami Marlins: http://theshow.ootpleagues.com/index.php |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|