Introduction
The StatsPlus app is designed to run on the same computer as the OOTP app while the sim is running.
After launching the app the first time, click the
icon in the upper right, or choose Edit->Preferences menu to launch the configuration page.
Once you complete the configuration, return to the main screen, enable one or both of the enhanced sim page and Slack integration options, and press "Start"!
Main Page
Screenshot of the main screen of the StatsPlus app:
There are only a few clickable items on the main page. Besides the
icon for config, there is also a
icon to be used for exiting the app.
After configuration, select one or both of the checkboxes to enable the enhanced real-time sim page generation and/or Slack integration, then press Start. Once you've started the real-time sim in the game, the Upload and Slack Post counts will update, along with the time of the last update.
If you enable the enhanced real-time sim functionality, the URL for the page will be {REPORTS_URL}/rt_sim/index.html
For example, if the current real-time sim page URL is https://usba14.us/reports/real_time_sim/index.html, the new URL will be https://usba14.us/reports/rt_sim/index.html. Both URLs will be active during the sim as long as the app is running, but of course, you'll quickly prefer the new version.
Local Config
Screenshot of the "local" tab of the configuration page:
The local config is used to configure the OOTP game directory, enable certain features, and set the league info for the enhanced web page.
Option |
Description |
League Dir |
The "League Dir" setting must be set to the directory where the world.dat files are stored in the OOTP saved_games folder. It is recommended to use the icon to open a file browser to navigate to the league directory. On Windows, most league files are located in ...\Blah\Blah\saved_games, and on Mac, league files are located in /Users/username/Library/Application Support/Out of the Park Developments/OOTP Baseball 17/saved_games. |
SQL Box Scores |
Only enable this option if you use the SQL reports option in OOTP, and want live box scores during the real-time sim. If you don't use SQL reports, do not enable this. |
WPA Graphs |
Enabling will trigger the app to upload WPA graphs being generated during the sim. Currently, each WPA graph is uploaded every 4th time it is updated locally, and also at the end of each game. |
League Name |
Enter the league name to be used in the enhanced web page HTML. |
Association |
If your league is an "association", where multiple leagues comprise the overall major leagues, enable this box, which enables the "# of Leagues" option below.
An example of an association is a league that uses promotion-relegation, or is split into separate leagues where teams do not play regular season games against each other. |
# of Leagues |
Only used if league is an association, select the number of major leagues that are simmed during typical real-time sims. |
Lg #x Name |
Each entry here must match exactly the name of the league shown on the OOTP real-time sim page, it's case-sensitive. |
Abbr |
The league abbreviation used on the tabs on the enhanced real-time sim page. |
Button |
Description |
Save |
You must hit the Save button after making any changes on this page. If the league directory is not valid, a notice will appear, and the settings will not be saved. |
FTP Setup
Screenshot of the "FTP" tab of the configuration page:
To use the enhanced real-time sim functionality, on this page you must enter the FTP info that is used for game reports on the server. The current version of the app only supports regular FTP, and not SFTP.
Option |
Description |
Server |
FTP server name used for the FTP connection (for example, usba14.us)
No need to add any prefix like ftp://, or any port number like :21. Only FTP is supported in the current version, and only on default port 21.
|
Login |
FTP user name for league reports |
Password |
FTP password for league reports |
Reports Dir |
Full path from the FTP root directory for the specified user, where the reports are stored. The enhanced real-time sim creates an additional sub-directory called rt_sim.
The path should include a leading "/" character, and it should match the path you need to go to on the server to see the top-level index.html, styles.css, images directory. Example:
Note that you may not see all these directories if you are using the SQL option for reports, but you should at least see the images directory and the real_time_sim directory that is being used for your current real-time sims.
|
Reports URL |
Used for creating links in Slack posts, and in the future may be used for in-place enhancements of the real-time sim page content.
If your league reports top-level page is at https://usba14.us/reports/index.html, then enter https://usba14.us/reports |
Button |
Description |
Save |
Must press "Save" to commit any changes on this page. Settings will be validated before you can save them. |
Test |
To check if your settings are entered correctly, press the "Test" button. |
Create |
Press this button one time after setup to create the new rt_sim directory if using the enhanced web page feature. This option will also create the .../images/wpa directory if it does not exist. |
Slack Config
Screenshot of the "Slack" tab of the configuration page:
To configure Slack integration, you need to do two steps on the Slack website. The StatsPlus app uses both the Incoming Webhook integration, and the Web API accessed with a Slack token.
Option |
Description |
Slack Token |
First, you must have Slack issue a token for you to use for getting the user and group lists via the Web API. Follow these steps to get a token:
- Go to https://api.slack.com/docs/oauth-test-tokens
- Click on the “Create Token” button for the Slack team you wish to integrate with
- You may be asked to enter your password to validate
- After a token is issued, the oauth-test-tokens link will show something like
“xoxp-37355598005-....”
in the Token column.
You need to copy and paste the entire xoxp-... string into the StatsPlus app UI, in the Slack Token box. On Windows, you can use Ctrl-V to paste the token copied from the Slack web page into the box.
DO NOT SHARE this token, it is equivalent to your login and password for Slack, and anyone that has it can impersonate you 100%.
|
Webhook URL |
You must enable the Incoming Webhook Integration in your Slack group, and get the associated URL.
- Go to https://my.slack.com/services/new/incoming-webhook/
- Pick any channel, #general works fine
- Click “Add Incoming Webhooks Integration” button
- The next page will give a long URL that is to be used to post to Slack from the program, it looks something like:
https://hooks.slack.com/services/T13A1111/B1921111/bGk....
After you have entered the Slack Token and the Webhook URL for your Slack group, press the "Test" button to verify that you've copied the info correctly for the StatsPlus app to have the required access.
|
Post Highlights |
Highly recommended to enabled this feature, turn it on if you want the app to post league-wide highlights like no-hitters, injury updates, etc.
This option also enables posting a summary of all the day's scores to the highlight channel when the games are complete.
|
Highlight Channel |
If highlights are enabled, this dropdown will be enabled, and you should pick the Slack channel for the app to post highlights. You might want to consider using a dedicated channel for this, something like #breaking-news. |
Post Finals |
Enable if you want the app to post the final score of each game as soon as it goes final. Only recommended if you are running real-time sims. If you sim a full day at a time, do not enable this. |
Final Score Channel |
If final scores are enabled, this dropdown will be enabled, and you should pick the Slack channel for the app to post final scores. You might want to consider using a dedicated channel for this, something like #real-time-scores. |
More Highlights |
In v0.7.0 release, enabling this option tells the app to treat all home runs as league highlights. |
Live Table |
Recommended only for leagues with no sub-leagues or divisions, and where the schedule is set up for all teams to play games every sim day. If enabled, the app will wait until all games for a league are finished during each game day of the sim, and then post the current win total for each team. Example:
|
Watch Injuries |
When enabled, the app will watch for the Injury Log created by OOTP to be updated, and post new injuries to the highlight channel. You must visit the injury page in OOTP manually for the page to be created, or generate reports. |
Msg Delay(s) |
When this is set to 0, you may find that the app is posting highlights to Slack before people see them on the web during an actual
real-time sim. Not necessary to set this option if you are always simming one day at a time with "Finish Today".
Recommended setting if you are doing real-time sims is to match the upload rate set in OOTP, like 15s or 30s.
|
Team Highlights |
If enabled, the app will watch for every score change and highlights for the users entered, and post them to a channel intended to be dedicated for that user/team. This is very verbose, and should only be enabled for teams that want to get multiple messages for every change.
It's really verbose - you've been warned. |
User |
Pick the Slack username from the drop-down |
Channel |
Pick the Slack channel to send team highlights.
IMPORTANT: You may enter a Slack channel ID directly here, not choosing from a drop-down. An example of this would be something like G3AG0GK6G. The recommended procedure for setting up a private score channel is:
- In Slack, create a private channel named like #van-scores (for team with abbrev VAN)
- Invite the GM for the VAN team to that private channel
- In the StatsPlus app, use the drop-down to choose #van-scores for that team/user
- After you confirm that score updates are working for that team, you can leave the private channel, and the app will remember the group ID
By design, Slack allows Incoming Webhook to continue to post to a private channel even if you left it, as long as you know the Group ID, which the StatsPlus app will remember.
|
Abbrev |
Enter the case-sensitive OOTP team abbreviation here. These need to be unique for each team with games played in the real-time sim. |
Team ID |
Maybe the trickiest piece of info to find, the app needs the OOTP team ID for each team getting highlights. An easy way to find the ID would be to go to the league reports, and go to that team's home page. The URL for the team contains the ID, so a team URL like reports/teams/team_127.html would be for team ID 127.
You can also see all the human-controlled team IDs in the Commissioner Office, when clicking on "Check Team Exports". Screenshot of an example with list of teams and their IDs:
|
Button |
Description |
Save |
Must press "Save" to commit any changes on this page. Settings will be validated before you can save them. |
Test |
To check if your settings are entered correctly, press the "Test" button. Pressing test will validate both the Slack token (auth.test API), and also the Webhook, by sending a test message to the user that owns the Slack token. |
Refresh |
Press this button any time to refresh all the drop-downs that contain Slack usernames or channels. |
Multi-League Config
Screenshot of the "configs" tab of the configuration page:
This section is
only needed if you are simming for multiple leagues, or if you have multiple people
running sims for your league(s). If you only sim for one league, and you are the only simmer that will be
running the S+ app, you can igore this section completely.
Option |
Description |
Add Another League |
This button is used to add an empty config for a new league. After pressing, a new row will be added to the table at the top of the page.
|
Active |
The radio selection under "Active" is used to switch between league configs. Choosing a new option here will back up the current league config,
and switch the config to the new league.
|
Export |
After clicking, you will be prompted for a file name to save the league config. The config will be saved in a file with extension .splus.
Important: The saved league config is not 100% complete. It does not contain the local directory or the user Slack token.
The directory is not included to make sure that the proper directory is chosed on import on target machine, and the Slack token is
not included for security reasons, as it gives complete access to Slack for the user owning the token.
|
Import |
After clicking, you will be prompted with a File Dialog to select a file with a .splus extension to import a config that was exported
from another computer running S+. As noted in Export above, the config does not included the local directory or Slack token by design.
To complete import of a league, after import, follow these three steps:
- Select the imported league so it is "Active"
- Go to Local settings page, choose the correct directory, and hit "Save"
- Go to Slack settings page, paste in the Slack token for the user, and hit "Save"
|
Delete |
If you are certain you will never need a league config again, and want to permanently remove the settings, use the "Delete" button.
By design, you may not delete the active config.
|
Clear App Database |
This option should only be needed in very rare circumstances, the most common of which is that you simmed ahead with your league
to test the app, and then reverted to a backup and are simming the same game dates again. If you ever go "backwards" in league
date after using the app, use this option to clear the app storage of games, to prevent unexpected posts to Slack.
|