Find in this manual | ||
Replace with |
Schedule File Layout
Alright, now that you've learned a bit about how schedules work, and the file naming conventions, what about the contents of the schedule file itself? Let's go over the layout of a schedule file. OOTP schedule files are XML files, which are simple text files using a special markup language with "tags" similar to those found in HTML. XML files can be opened in any text editor. Here is a sample of the contents of an OOTP schedule file with most of the contents removed:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SCHEDULE type="ILY_BGN_G162_SL1_D1_T5_D2_T5_D3_T4_SL2_D1_T5 _D2_T6_D3_T5_C_" inter_league="1" balanced_games="0" games_per_team="162">
<GAMES>
<GAME day="1" time="1905" away="1" home="8" />
<GAME day="1" time="1905" away="2" home="12" />
<GAME day="1" time="1905" away="3" home="18" />
<GAME day="1" time="1905" away="4" home="13" />
<GAME day="1" time="1905" away="5" home="7" />
(...)
<GAME day="176" time="1305" away="8" home="9" type="0" />
<GAME day="177" time="1305" away="8" home="9" />
<GAME day="178" time="1305" away="8" home="9" />
</GAMES>
</SCHEDULE>
The file is broken up into several components, described below.
<SCHEDULE type="ILY_BGN_G162_SL1_D1_T5_D2_T5_D3_T4_SL2_D1_T5_D2_T6_D3_T5_C_" inter_league="1" balanced_games="0" games_per_team="162">
The Schedule Element has four required attributes, and four optional attributes, as follows:
Note: Attribute values must always appear in quotes (" ").
<GAMES>
This is immediately followed by one individual Game Element for every game in the entire schedule. Here is an example of a Game Element:
<GAME day="1" time="1905" away="5" home="1" />
The Game Element has four required attributes, as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SCHEDULE type="ILY_BGN_G162_SL1_D1_T5_D2_T5_D3_T4_SL2_D1_T5 _D2_T6_D3_T5_C_" inter_league="1" balanced_games="0" games_per_team="162">
<GAMES>
<GAME day="1" time="1905" away="1" home="8" />
<GAME day="1" time="1905" away="2" home="12" />
<GAME day="1" time="1905" away="3" home="18" />
<GAME day="1" time="1905" away="4" home="13" />
<GAME day="1" time="1905" away="5" home="7" />
(...)
<GAME day="176" time="1305" away="8" home="9" type="0" />
<GAME day="177" time="1305" away="8" home="9" />
<GAME day="178" time="1305" away="8" home="9" />
</GAMES>
</SCHEDULE>
The file is broken up into several components, described below.
Declaration
The first line of the file (<?xml version="1.0" encoding="ISO-8859-1"?>) is called the declaration. It defines the XML version (1.0) and the encoding used. In the case of OOTP's schedule files, this should always be exactly as shown above. There is no need to adjust this line.Schedule Element
The second line in a schedule file is the Schedule Element. (Also known as the "root element" in XML terminology.) Here is an example of a Schedule Element line:<SCHEDULE type="ILY_BGN_G162_SL1_D1_T5_D2_T5_D3_T4_SL2_D1_T5_D2_T6_D3_T5_C_" inter_league="1" balanced_games="0" games_per_team="162">
The Schedule Element has four required attributes, and four optional attributes, as follows:
- type - Defines the type of schedule, following the code naming convention. The one difference here is that in the "type" attribute, no comment is required as is required in a schedule file name. The type attribute is required.
- inter_league - Set to "1" if there is interleague play, "0" if not. The inter_league attribute is required.
- balanced_games - Set to "1" if the schedule is balanced, "0" if not. The balanced_games attribute is required.
- games_per_team - The number of games per team in the regular season. The games_per_team attribute is required.
- start_month - The numeric month in which the schedule should begin. Use "1" for January, "2" for February, etc. The start_month attribute is optional. This value can also be set on the Options page.
- start_day - The day of the month in which the schedule should begin. Use "1" for the 1st of the month, etc. The start_day attribute is optional. (See also the start_day_of_week attribute below.) This value can also be set on the Options page.
- start_day_of_week - The day of the week in which the schedule should begin. (1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=Fri, 7=Sat) Use "1" for the 1st of the month, etc. When this attribute is used, the game will start the schedule on the first occurrence of that day of the week on or after the defined start_month and start_day for the current game year. For example, if start_month="4", start_day="1", and start_day_of_week="6", the schedule will start on the first Friday on or after April 1st. The start_day attribute is optional. This value can also be set on the Options page.
- allstar_game_day - The day from the beginning of the schedule when the All-Star Game will be scheduled. For example, if allstar_game_day="100", the All-Star Game will be held on the 100th day of the schedule, where day 1 is the start_month, start_day, and start_day_of_week as described above. The allstar_game_day attribute is optional.
Note: Attribute values must always appear in quotes (" ").
"Auto-Adjust Date if Matching XML Schedule Found"
The Options page has an option called "Auto adjust date if matching XML schedule found." If this is enabled, then the settings in the OOTP schedule file will override any values that were entered in the Options page. If this is not selected, then the values from the Options page will take precedence over those in the schedule file.About All-Star Games
If no All-Star Game is defined in the schedule file, and the options to "Hold All-Star Game" and "Automatically Schedule All-Star Game" on the Options page are enabled, then OOTP will pick a point around the middle of the schedule and insert a 3-day break with the All-Star Game in the middle of it. If you have constructed your own schedule file, take care with the "Automatically Schedule All-Star Game" option, because using this delays the start of the second half of the season by three days. This can result in your key weekend series being played instead on a Mon-Tues-Weds.Games Element
The bulk of the remainder of a schedule file are individual Game Elements, each of which defines a single game. (These are known as "child elements" in XML terminology.) First comes a container element that looks like this:<GAMES>
This is immediately followed by one individual Game Element for every game in the entire schedule. Here is an example of a Game Element:
<GAME day="1" time="1905" away="5" home="1" />
The Game Element has four required attributes, as follows:
- day - The number of the day of the game beginning at 1 with the start date set in the Schedule Element or within the Options page. If day="1", this game would be on the first day of the schedule (Opening Day). The day attribute is required.
- time - The start time of the game in military time. For example, time="1905" would be a 7:05 pm start time. The time attribute is required.
- away - The team ID of the visiting team. For example, away="1" would mean team # 1 is the away team. The away attribute is required.
- home - The team ID of the home team. For example, home="1" would mean team # 1 is the home team. The home attribute is required.
- type - The type of game. (0=Regular Season, 1=Exhibition, 2=Spring Training, 3=Playoffs, 4=All-Star Game) For example, type="0" would mean a regular season game. The type attribute is optional, and if it is not included, the game is assumed to be a regular season game.
Syntax Notes
XML is particular about formatting. Be sure to follow these rules, or else your file may not work:- Each Game Element line must end with a closing tag, like this: />.
- The last two lines of the file must be closing tags for the Games and Schedule Elements, like this:
</GAMES>
</SCHEDULE>
The case of these tags must match the case of the opening tags. So, if the file started with "<Schedule..." and the closing tag was "/SCHEDULE>", it would cause the file not to work.