OpenTTD GameScript API
20240906-master-gd5ff6b4156
|
Class that handles story page related functions. More...
Public Types | |
enum | StoryPageID { STORY_PAGE_INVALID } |
The story page IDs. More... | |
enum | StoryPageElementID { STORY_PAGE_ELEMENT_INVALID } |
The story page element IDs. More... | |
enum | StoryPageElementType : int { SPET_TEXT, SPET_LOCATION, SPET_GOAL, SPET_BUTTON_PUSH, SPET_BUTTON_TILE, SPET_BUTTON_VEHICLE } |
Story page element types. More... | |
enum | StoryPageButtonFlags : int { SPBF_NONE, SPBF_FLOAT_LEFT, SPBF_FLOAT_RIGHT } |
Formatting and layout flags for story page buttons. More... | |
enum | StoryPageButtonCursor : int { SPBC_MOUSE, SPBC_ZZZ, SPBC_BUOY, SPBC_QUERY, SPBC_HQ, SPBC_SHIP_DEPOT, SPBC_SIGN, SPBC_TREE, SPBC_BUY_LAND, SPBC_LEVEL_LAND, SPBC_TOWN, SPBC_INDUSTRY, SPBC_ROCKY_AREA, SPBC_DESERT, SPBC_TRANSMITTER, SPBC_AIRPORT, SPBC_DOCK, SPBC_CANAL, SPBC_LOCK, SPBC_RIVER, SPBC_AQUEDUCT, SPBC_BRIDGE, SPBC_RAIL_STATION, SPBC_TUNNEL_RAIL, SPBC_TUNNEL_ELRAIL, SPBC_TUNNEL_MONO, SPBC_TUNNEL_MAGLEV, SPBC_AUTORAIL, SPBC_AUTOELRAIL, SPBC_AUTOMONO, SPBC_AUTOMAGLEV, SPBC_WAYPOINT, SPBC_RAIL_DEPOT, SPBC_ELRAIL_DEPOT, SPBC_MONO_DEPOT, SPBC_MAGLEV_DEPOT, SPBC_CONVERT_RAIL, SPBC_CONVERT_ELRAIL, SPBC_CONVERT_MONO, SPBC_CONVERT_MAGLEV, SPBC_AUTOROAD, SPBC_AUTOTRAM, SPBC_ROAD_DEPOT, SPBC_BUS_STATION, SPBC_TRUCK_STATION, SPBC_ROAD_TUNNEL, SPBC_CLONE_TRAIN, SPBC_CLONE_ROADVEH, SPBC_CLONE_SHIP, SPBC_CLONE_AIRPLANE, SPBC_DEMOLISH, SPBC_LOWERLAND, SPBC_RAISELAND, SPBC_PICKSTATION, SPBC_BUILDSIGNALS } |
Mouse cursors usable by story page buttons. | |
enum | StoryPageButtonColour : int { SPBC_DARK_BLUE, SPBC_PALE_GREEN, SPBC_PINK, SPBC_YELLOW, SPBC_RED, SPBC_LIGHT_BLUE, SPBC_GREEN, SPBC_DARK_GREEN, SPBC_BLUE, SPBC_CREAM, SPBC_MAUVE, SPBC_PURPLE, SPBC_ORANGE, SPBC_BROWN, SPBC_GREY, SPBC_WHITE } |
Colour codes usable for story page button elements. More... | |
Static Public Member Functions | |
static bool | IsValidStoryPage (StoryPageID story_page_id) |
Check whether this is a valid story page ID. More... | |
static bool | IsValidStoryPageElement (StoryPageElementID story_page_element_id) |
Check whether this is a valid story page element ID. More... | |
static bool | IsValidStoryPageElementType (StoryPageElementType type) |
Check whether this is a valid story page element type. More... | |
static StoryPageID | New (GSCompany::CompanyID company, Text *title) |
Create a new story page. More... | |
static StoryPageElementID | NewElement (StoryPageID story_page_id, StoryPageElementType type, int reference, Text *text) |
Create a new story page element. More... | |
static bool | UpdateElement (StoryPageElementID story_page_element_id, int reference, Text *text) |
Update the content of a page element. More... | |
static int | GetPageSortValue (StoryPageID story_page_id) |
Get story page sort value. More... | |
static int | GetPageElementSortValue (StoryPageElementID story_page_element_id) |
Get story page element sort value. More... | |
static GSCompany::CompanyID | GetCompany (StoryPageID story_page_id) |
Get the company which the page belongs to. More... | |
static GSDate::Date | GetDate (StoryPageID story_page_id) |
Get the page date which is displayed at the top of each page. More... | |
static bool | SetDate (StoryPageID story_page_id, GSDate::Date date) |
Update date of a story page. More... | |
static bool | SetTitle (StoryPageID story_page_id, Text *title) |
Update title of a story page. More... | |
static bool | Show (StoryPageID story_page_id) |
Opens the Story Book if not yet open and selects the given page. More... | |
static bool | Remove (StoryPageID story_page_id) |
Remove a story page and all the page elements associated with it. More... | |
static bool | RemoveElement (StoryPageElementID story_page_element_id) |
Removes a story page element. More... | |
static bool | IsValidStoryPageButtonColour (StoryPageButtonColour colour) |
Check whether this is a valid story page button colour. More... | |
static bool | IsValidStoryPageButtonFlags (StoryPageButtonFlags flags) |
Check whether this is a valid story page button flag. More... | |
static bool | IsValidStoryPageButtonCursor (StoryPageButtonCursor cursor) |
Check whether this is a valid story page button cursor. More... | |
static StoryPageButtonFormatting | MakePushButtonReference (StoryPageButtonColour colour, StoryPageButtonFlags flags) |
Create a reference value for SPET_BUTTON_PUSH element parameters. More... | |
static StoryPageButtonFormatting | MakeTileButtonReference (StoryPageButtonColour colour, StoryPageButtonFlags flags, StoryPageButtonCursor cursor) |
Create a reference value for SPET_BUTTON_TILE element parameters. More... | |
static StoryPageButtonFormatting | MakeVehicleButtonReference (StoryPageButtonColour colour, StoryPageButtonFlags flags, StoryPageButtonCursor cursor, GSVehicle::VehicleType vehtype) |
Create a reference value for SPET_BUTTON_VEHICLE element parameters. More... | |
Class that handles story page related functions.
To create a page:
Pages can be either global or company specific. It is possible to mix, but the only mixed solution that will work is to have all global pages first. Once you create the first company specific page, it is not recommended to add additional global pages unless you clear up all pages first.
Page elements are stacked vertically on a page. If goal elements are used, the element will become empty if the goal is removed while the page still exist. Instead of removing the goal, you can mark it as complete and the Story Book will show that the goal is completed.
Mind that users might want to go back to old pages later on. Thus do not remove pages in the story book unless you really need to.
enum GSStoryPage::StoryPageButtonColour : int |
Colour codes usable for story page button elements.
Place a colour value in the lowest 8 bits of the reference
parameter to the button.
enum GSStoryPage::StoryPageButtonFlags : int |
Formatting and layout flags for story page buttons.
The SPBF_FLOAT_LEFT and SPBF_FLOAT_RIGHT flags can not be combined.
enum GSStoryPage::StoryPageElementType : int |
Story page element types.
|
static |
Get the company which the page belongs to.
If the page is global, GSCompany::COMPANY_INVALID is returned.
story_page_id | The story page to get the company for. |
|
static |
Get the page date which is displayed at the top of each page.
story_page_id | The story page to get the date of. |
|
static |
Get story page element sort value.
Each page element has a sort value that is internally assigned and used to sort the page elements within a page of the story book. OpenTTD maintains this number so that the sort order is perceived. This API exist only so that you can sort GSStoryPageList the same order as in GUI. You should not use this number for anything else.
story_page_element_id | The story page element to get the sort value of. |
|
static |
Get story page sort value.
Each page has a sort value that is internally assigned and used to sort the pages in the story book. OpenTTD maintains this number so that the sort order is perceived. This API exist only so that you can sort GSStoryPageList the same order as in GUI. You should not use this number for anything else.
story_page_id | The story page to get the sort value of. |
|
static |
Check whether this is a valid story page ID.
story_page_id | The StoryPageID to check. |
|
static |
Check whether this is a valid story page button colour.
colour | The StoryPageButtonColour to check. |
|
static |
Check whether this is a valid story page button cursor.
cursor | The StoryPageButtonCursor to check. |
|
static |
Check whether this is a valid story page button flag.
flags | The StoryPageButtonFlags to check. |
|
static |
Check whether this is a valid story page element ID.
story_page_element_id | The StoryPageElementID to check. |
|
static |
Check whether this is a valid story page element type.
type | The StoryPageElementType to check. |
|
static |
Create a reference value for SPET_BUTTON_PUSH element parameters.
colour | The colour for the face of the button. |
flags | The formatting and layout flags for the button. |
|
static |
Create a reference value for SPET_BUTTON_TILE element parameters.
colour | The colour for the face of the button. |
flags | The formatting and layout flags for the button. |
cursor | The mouse cursor to use when the player clicks the button and the game is ready for the player to select a tile. |
|
static |
Create a reference value for SPET_BUTTON_VEHICLE element parameters.
colour | The colour for the face of the button. |
flags | The formatting and layout flags for the button. |
cursor | The mouse cursor to use when the player clicks the button and the game is ready for the player to select a vehicle. |
vehtype | The type of vehicle that will be selectable, or VT_INVALID to allow all types. |
|
static |
Create a new story page.
company | The company to create the story page for, or GSCompany::COMPANY_INVALID for all. |
title | Page title (can be either a raw string, a GSText object, or null). |
|
static |
Create a new story page element.
story_page_id | The page id of the story page which the page element should be appended to. |
type | Which page element type to create. |
reference | A reference value to the object that is referred to by some page element types. When type is SPET_GOAL, this is the goal ID. When type is SPET_LOCATION, this is the TileIndex. When type is a button, this is the ID returned by MakePushButtonReference, MakeTileButtonReference, or MakeVehicleButtonReference. |
text | The body text of page elements that allow custom text. (SPET_TEXT and SPET_LOCATION) |
|
static |
Remove a story page and all the page elements associated with it.
story_page_id | The story page to remove. |
|
static |
Removes a story page element.
story_page_element_id | The story page element to remove. |
|
static |
Update date of a story page.
The date is shown in the top left of the page
story_page_id | The story page to set the date for. |
date | Calendar-date to display at the top of story page or GSDate::DATE_INVALID to disable showing date on this page. (also, |
|
static |
Update title of a story page.
The title is shown in the page selector drop down.
story_page_id | The story page to update. |
title | Page title (can be either a raw string, a GSText object, or null). |
|
static |
Opens the Story Book if not yet open and selects the given page.
story_page_id | The story page to update. If it is a global page, clients of all companies are affecetd. Otherwise only the clients of the company which the page belongs to are affected. |
|
static |
Update the content of a page element.
story_page_element_id | The page id of the story page which the page element should be appended to. |
reference | A reference value to the object that is referred to by some page element types. See also NewElement. |
text | The body text of page elements that allow custom text. See also NewElement. |