Skip to content

SteamSystem

Extends EngineObject.

Objects of this class are refused to mods.

Properties

  • is_cloud_enabled: boolean Whether the cloud works: Steam is running, and the player has the cloud on for their account and for this game. Read-only.
  • is_active: boolean True when Steam started: the calls are real. False means every call does nothing. Read-only.
  • status: string What state Steam is in, in words a player can read: running, off, or why it did not start. Read-only.
  • restart_requested: boolean True when SteamOptions.AppId was set and the game was not started by Steam: Steam is starting it again, and this process should exit. Read-only.
  • user_id: string The player's SteamID64 as a decimal string, "" when Steam is not running. Read-only.
  • user_name: string The player's Steam name. Read-only.
  • app_id: number The game's Steam app id (0 when Steam is not running). Read-only.
  • build_id: number The build of the game Steam installed (changes with every upload to a branch). Read-only.
  • language: string The language the player chose for the game in Steam, as Steam names it (english, french, schinese…); "" when Steam is not running. Read-only.
  • ui_language: string The language of Steam's own interface. Read-only.
  • country: string The player's country (two letters), from their address. Read-only.
  • is_subscribed: boolean Whether the player owns the game (false for a family-shared or free-weekend copy that Steam still lets them play: IsSubscribed is about that account). Read-only.
  • is_steam_deck: boolean The game runs on a Steam Deck (Steam sets the SteamDeck environment variable there). Read-only.
  • is_big_picture: boolean Steam is in Big Picture mode (or the Deck's game mode). Read-only.
  • is_overlay_enabled: boolean Whether the overlay works in this run (Steam is running and the player did not switch it off). Read-only.

Signals

  • overlay_activated: Signal<boolean> The overlay opened (true) or closed: pause the game while it is open.
  • shutdown_requested: Signal<()> Steam wants the game to exit (the client is shutting down).
  • stats_received: Signal<boolean> The player's stats and achievements arrived from Steam (true) or could not be loaded.
  • stats_stored: Signal<boolean> A StoreStats finished.
  • achievement_stored: Signal<string, number, number> An achievement was unlocked or progressed, with its name and progress (0 and 0 for a plain unlock).
  • text_input_dismissed: Signal<boolean, string> Steam's on-screen keyboard closed, with whether the text was submitted and the text.
  • leaderboard_found: Signal<string, boolean> A leaderboard was looked up by name (true when it exists).
  • score_uploaded: Signal<string, boolean, number> A score was sent: the leaderboard, whether it worked, and the player's new global rank (0 when unchanged or failed).
  • scores_downloaded: Signal<string, { string }, { number }, { number }> Entries arrived: the leaderboard, then for each entry the player's id, global rank and score, in rank order.
  • workshop_item_installed: Signal<string> A Workshop item finished installing or updating on the disk (its id). Mods are read when the game starts: tell the player to restart for it to apply.
  • workshop_item_downloaded: Signal<string, boolean> A download that DownloadWorkshopItem started ended: the item id and whether it worked.
  • workshop_subscribed: Signal<string, boolean> A Subscribe finished: the item id and whether it worked.
  • workshop_unsubscribed: Signal<string, boolean> An Unsubscribe finished: the item id and whether it worked.

Methods

cloud_quota

function cloud_quota(self): (number, number)

The cloud space of the game for this player, in bytes: the total, then what is left. 0 and 0 without Steam.

update

function update(self): ()

Once a frame: runs Steam's callbacks and call results and emits their signals. Nothing else runs on another thread.

owns_dlc

function owns_dlc(self, appId: number): boolean

The player owns the DLC appId.

is_dlc_installed

function is_dlc_installed(self, appId: number): boolean

The DLC appId is owned and installed.

activate_overlay

function activate_overlay(self, dialog: string?): ()

Opens a part of the overlay: friends, community, players, settings, officialgamegroup, stats or achievements; "" opens it as Shift+Tab does.

open_web_page

function open_web_page(self, url: string): ()

Opens the overlay's browser on a web page.

open_store

function open_store(self, appId: number): ()

Opens the store page of an app in the overlay (the game's own page, or a DLC's).

set_rich_presence

function set_rich_presence(self, key: string, value: string): boolean

Sets a rich presence key, which friends see in their list (status is the line shown; others are for steam_display localization). An empty value removes the key.

clear_rich_presence

function clear_rich_presence(self): ()

Removes all of this game's rich presence.

trigger_screenshot

function trigger_screenshot(self): ()

Asks Steam to take a screenshot of the game's window (the player's screenshot key does it too).

add_screenshot

function add_screenshot(self, path: string, width: number, height: number): boolean

Adds a screenshot file the game wrote (a JPEG, PNG or TGA on the disk) to the player's Steam library. False when Steam refused it.

add_timeline_event

function add_timeline_event(self, title: string, description: string?, icon: string?, priority: number?, offsetSeconds: number?, featured: boolean?): ()

Marks a moment in the player's Steam timeline (the game recording): a title, a description, one of Steam's icon names (steam_achievement, steam_death, steam_marker…), a priority among the icons, and an offset in seconds from now (negative: something that just happened). A featured event is offered first as a clip.

set_timeline_state

function set_timeline_state(self, description: string): ()

Sets the line of text that describes what the player is doing now on the timeline (a tooltip); "" clears it.

set_timeline_mode

function set_timeline_mode(self, mode: string): ()

Tells the timeline what the game is doing: playing, staging (a lobby, a briefing), menus or loading; the recording skips menus and loading screens.

show_text_input

function show_text_input(self, description: string, maxLength: number?, multiline: boolean?, password: boolean?): boolean

Opens Steam's on-screen keyboard (the overlay's, for a Deck or a controller) for a line of text; TextInputDismissed follows. False when it cannot be shown (the overlay is off).

achievement

function achievement(self, name: string): boolean

Whether the achievement is unlocked (false when Steam is not running, or the name is not one of the game's).

unlock_achievement

function unlock_achievement(self, name: string): boolean

Unlocks an achievement and sends it to Steam at once (it shows the pop-up). False when there is no such achievement or Steam is not running.

clear_achievement

function clear_achievement(self, name: string): boolean

Locks an achievement again (for testing).

achievement_progress

function achievement_progress(self, name: string, current: number, max: number): boolean

Shows a progress pop-up for an achievement that counts (current of max) without unlocking it; it also stores the progress.

achievement_names

function achievement_names(self): { string }

The names of the game's achievements, as set up in Steamworks.

stat_int

function stat_int(self, name: string): number

The value of an integer stat (0 when there is none).

stat_float

function stat_float(self, name: string): number

The value of a float stat (0 when there is none).

set_stat_int

function set_stat_int(self, name: string, value: number): boolean

Sets an integer stat in memory; StoreStats sends the changes.

set_stat_float

function set_stat_float(self, name: string, value: number): boolean

Sets a float stat in memory; StoreStats sends the changes.

store_stats

function store_stats(self): boolean

Sends the changed stats and achievements to Steam; StatsStored says when it is done. Do not call it more than once a few minutes: Steam limits it.

reset_all_stats

function reset_all_stats(self, achievements: boolean): boolean

Resets every stat, and the achievements too when asked. For testing a new player.

find_leaderboard

function find_leaderboard(self, name: string): ()

Looks a leaderboard up by name; LeaderboardFound follows. The other leaderboard calls do this by themselves when they need to.

upload_score

function upload_score(self, leaderboard: string, score: number, keepBest: boolean?): ()

Sends a score; ScoreUploaded follows. With keepBest the leaderboard keeps the player's better score (by the leaderboard's sort order), otherwise this one replaces it.

download_scores

function download_scores(self, leaderboard: string, from: number?, to: number?, kind: string?): ()

Asks for the entries from rank from to to (1 is the best) of kind (global, around_user, where the range is relative to the player, or friends); ScoresDownloaded follows, with no entries when it failed.

subscribed_items

function subscribed_items(self): { string }

The ids of the Workshop items the player is subscribed to.

subscribe

function subscribe(self, itemId: string): ()

Subscribes to a Workshop item (Steam downloads it); WorkshopSubscribed follows.

unsubscribe

function unsubscribe(self, itemId: string): ()

Unsubscribes from a Workshop item (Steam deletes it); WorkshopUnsubscribed follows.

download_workshop_item

function download_workshop_item(self, itemId: string): boolean

Asks Steam to download (or update) an item now, ahead of the others; WorkshopItemDownloaded follows. False when Steam refused.

workshop_item_folder

function workshop_item_folder(self, itemId: string): string

The folder an installed item is in, or "" when it is not installed (yet).

Functions

create_inactive

SteamSystem.create_inactive: () -> SteamSystem

Makes an inactive Steam system from a script, which touches nothing of Steam: for testing the game's own code that expects a steam global. A game's real one is the global steam.

is_installed

SteamSystem.is_installed: () -> boolean

Whether Steam's library can be loaded.