Saints Row 2 Function Reference

Global functions

These functions are assumed to be globally available to all scripts (they aren't defined in the available Lua files, or are defined in files that are known to be always loaded).

This list is assumed incomplete; additional functions could exist in the exe but not be used in the game scripts, and there's no definitive list of Lua files that are always loaded.

Function name Global Defined in Examples from patch (click blue number to expand)
game_audio_get_audio_id true
    9
    game_audio_play true
      6
      game_audio_set_rtpc true
        1
        game_audio_stop true
          7
          game_autosave true
            2
            game_award_achievement true
              1
              game_award_cash true
                4
                • hud_collection.lua, line 317: game_award_cash(Hud_collection_data.cash_reward, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)
                • hud_collection.lua, line 730: -- game_award_cash(Hud_collection_data.cash_reward, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)
                • hud_diversion.lua, line 418: game_award_cash(Hud_diversions[index].cash, Hud_diversions[index].div_type)
                • hud_diversion.lua, line 696: game_award_cash(Hud_challenge_data.cash_reward, DT_CHALLENGE)
                game_award_respect true
                  11
                  game_cancel_mission true
                    1
                    game_can_send_player_invite true
                      3
                      game_check_coop_dlc true
                        2
                        game_clear_refraction_situation true
                          1
                          game_coop_get_starting_coop true
                            3
                            game_coop_kick_player true
                              2
                              game_coop_start_new_live true
                                3
                                game_death_tag_is_active true
                                  1
                                  game_difficulty_select true
                                    4
                                    game_event_tracking_interface_exit true
                                      1
                                      game_format_int_to_string true
                                        1
                                        game_get_coop_friendly_fire true
                                          2
                                          game_get_coop_join_type true
                                            2
                                            game_get_game_play_mode true
                                              1
                                              game_get_in_progress_type true
                                                6
                                                game_get_is_coop_client true
                                                  3
                                                  game_get_is_host true
                                                    18
                                                    game_get_key_name true
                                                      11
                                                      game_get_key_name_for_action true
                                                        22
                                                        • hud.lua, line 74: {CTRL_BUTTON_DPAD_DOWN, "HUD_CRUISE_CONTROL_NO_BUTTON", game_get_key_name_for_action("CBA_VDC_CRUISE_CONTROL_B")},
                                                        • hud.lua, line 438: {CTRL_BUTTON_Y, "HUD_SNIPER_ZOOM_IN", game_get_key_name_for_action("CBA_OFC_ZOOM_IN")},
                                                        • hud.lua, line 439: {CTRL_GAMEPLAY_BUTTON_A, "HUD_SNIPER_ZOOM_OUT", game_get_key_name_for_action("CBA_OFC_ZOOM_OUT")},
                                                        • hud.lua, line 443: {CTRL_GAMEPLAY_BUTTON_B, "SWITCH_MODE", game_get_key_name_for_action("CBA_VDC_VTOL_TRANSITION")},
                                                        • hud.lua, line 846: Hud_camera.hint_key = game_get_key_name_for_action( "CBA_GAC_TAKE_SCREENSHOT" )
                                                        • hud.lua, line 1537: Hud_camera.hint_key = game_get_key_name_for_action( "CBA_GAC_TAKE_SCREENSHOT" )
                                                        • hud.lua, line 2468: {CTRL_BUTTON_Y, "HUD_SNIPER_ZOOM_IN", game_get_key_name_for_action("CBA_OFC_ZOOM_IN")},
                                                        • hud.lua, line 2469: {CTRL_GAMEPLAY_BUTTON_A, "HUD_SNIPER_ZOOM_OUT", game_get_key_name_for_action("CBA_OFC_ZOOM_OUT")},
                                                        • hud.lua, line 2483: {CTRL_GAMEPLAY_BUTTON_B, "SWITCH_MODE", game_get_key_name_for_action("CBA_VDC_VTOL_TRANSITION")},
                                                        • hud.lua, line 3236: {CTRL_BUTTON_DPAD_DOWN, "HUD_CRUISE_CONTROL_NO_BUTTON", game_get_key_name_for_action("CBA_VDC_CRUISE_CONTROL_B")},
                                                        • hud_predator.lua, line 46: {CTRL_BUTTON_LT, "SATELLITE_GUIDED_MISSILE", game_get_key_name_for_action("CBA_SWC_FIRE_GUIDED")},
                                                        • hud_predator.lua, line 47: {CTRL_BUTTON_RT, "SATELLITE_FIRE_MISSILE", game_get_key_name_for_action("CBA_SWC_FIRE_FREE")},
                                                        • hud_predator.lua, line 48: {CTRL_MENU_BUTTON_B, "SATELLITE_MODE_EXIT", game_get_key_name_for_action("CBA_SWC_EXIT_SATELLITE_MODE")},
                                                        • hud_predator.lua, line 51: {CTRL_BUTTON_LT, "SATELLITE_SLOW_DOWN", game_get_key_name_for_action("CBA_SWC_MISSILE_DECELERATE")},
                                                        • hud_predator.lua, line 52: {CTRL_BUTTON_RT, "SATLLITE_SPEED_UP", game_get_key_name_for_action("CBA_SWC_MISSILE_ACCELERATE")},
                                                        • hud_predator.lua, line 53: {CTRL_MENU_BUTTON_B, "SATELLITE_EXIT_GUIDED_MODE", game_get_key_name_for_action("CBA_SWC_EXIT_SATELLITE_MODE")},
                                                        • hud_predator.lua, line 56: {CTRL_MENU_BUTTON_B, "SATELLITE_EXIT_RC_MODE", game_get_key_name_for_action("CBA_VDC_RC_ABORT")},
                                                        • hud_predator.lua, line 59: {CTRL_BUTTON_Y, "SATELLITE_RC_MODE_DESTRUCT", game_get_key_name_for_action("CBA_VDC_RC_SELF_DESTRUCT")},
                                                        • hud_predator.lua, line 60: {CTRL_MENU_BUTTON_B, "SATELLITE_EXIT_RC_MODE", game_get_key_name_for_action("CBA_VDC_RC_ABORT")},
                                                        • pause_options_record_mode.lua, line 88: local record_key = game_get_key_name_for_action( "CBA_GAC_MACHINIMA_QUICKSAVE" )
                                                        • vdo_respect_meter.lua, line 32: self.back_button_key = game_get_key_name_for_action( "CBA_GAC_MAP_MENU" )
                                                        • vdo_respect_meter.lua, line 265: self.back_button_key = game_get_key_name_for_action( "CBA_GAC_MAP_MENU" )
                                                        game_get_language true
                                                          7
                                                          game_get_party_member_count true
                                                            4
                                                            game_get_pending_game_play_mode true
                                                              1
                                                              game_get_platform true
                                                                386
                                                                game_get_ps3_button_swap true
                                                                  4
                                                                  game_hud_hide true
                                                                    2
                                                                    game_hud_update_inventory true
                                                                      3
                                                                      game_interface_effect_begin true
                                                                        4
                                                                        game_interface_effect_end true
                                                                          2
                                                                          game_is_active_input_gamepad true
                                                                            55
                                                                            game_is_any_activity_active true
                                                                              1
                                                                              game_is_any_super_power_unlocked true
                                                                                1
                                                                                game_is_autosaving true
                                                                                  2
                                                                                  game_is_connected_to_internet true
                                                                                    3
                                                                                    game_is_connected_to_network true
                                                                                      3
                                                                                      game_is_connected_to_service true
                                                                                        5
                                                                                        game_is_debug_reloading_level true
                                                                                          1
                                                                                          • vint_lib.lua, line 1570: if (game_is_going_to_main_menu() == false) and (game_is_debug_reloading_level() == false) then
                                                                                          game_is_demo true
                                                                                            4
                                                                                            game_is_dlc_available true
                                                                                              2
                                                                                              game_is_going_to_main_menu true
                                                                                                1
                                                                                                • vint_lib.lua, line 1570: if (game_is_going_to_main_menu() == false) and (game_is_debug_reloading_level() == false) then
                                                                                                game_is_joinable true
                                                                                                  3
                                                                                                  game_is_local_player_in_vehicle true
                                                                                                    2
                                                                                                    • vint_lib.lua, line 1145: if pause_menu_is_using_southpaw_control_scheme() == true and game_is_local_player_in_vehicle() == false then
                                                                                                    • vint_lib.lua, line 1155: elseif pause_menu_is_using_vehicle_southpaw_control_scheme() == true and game_is_local_player_in_vehicle() == true then
                                                                                                    game_is_pc_dx11 true
                                                                                                      2
                                                                                                      game_is_prologue_complete true
                                                                                                        6
                                                                                                        game_is_signed_in true
                                                                                                          3
                                                                                                          game_is_waiting_for_partner true
                                                                                                            2
                                                                                                            game_kick_coop_player true
                                                                                                              1
                                                                                                              game_letterbox_fade_out true
                                                                                                                1
                                                                                                                game_lobby_coop_finished true
                                                                                                                  3
                                                                                                                  game_lobby_finished_loading true
                                                                                                                    1
                                                                                                                    game_lobby_get_local_player_name true
                                                                                                                      1
                                                                                                                      game_lobby_get_remote_player_name true
                                                                                                                        3
                                                                                                                        game_lobby_update_ready_state true
                                                                                                                          1
                                                                                                                          game_machinima_clip_exists true
                                                                                                                            1
                                                                                                                            game_machinima_copy_clip true
                                                                                                                              1
                                                                                                                              game_machinima_delete_clip true
                                                                                                                                1
                                                                                                                                game_machinima_hide_hints true
                                                                                                                                  4
                                                                                                                                  game_machinima_is_recording true
                                                                                                                                    3
                                                                                                                                    game_machinima_overwrite_clip true
                                                                                                                                      1
                                                                                                                                      game_machinima_playback_enter true
                                                                                                                                        2
                                                                                                                                        game_machinima_record true
                                                                                                                                          1
                                                                                                                                          game_main_menu_join_friend_in_progress true
                                                                                                                                            2
                                                                                                                                            game_pause_map_filter true
                                                                                                                                              1
                                                                                                                                              game_peg_is_loaded true
                                                                                                                                                4
                                                                                                                                                game_peg_list_unload_wait true 1 1
                                                                                                                                                game_peg_load_with_cb true
                                                                                                                                                  78
                                                                                                                                                  game_peg_unload true
                                                                                                                                                    119
                                                                                                                                                    game_peg_unload_wait true 1 12
                                                                                                                                                    game_proto_select true
                                                                                                                                                      1
                                                                                                                                                      game_record_mode_can_encode true
                                                                                                                                                        1
                                                                                                                                                        game_record_mode_enable true
                                                                                                                                                          1
                                                                                                                                                          game_record_mode_is_active true
                                                                                                                                                            1
                                                                                                                                                            game_record_mode_is_supported true
                                                                                                                                                              1
                                                                                                                                                              game_record_mode_show_hud true
                                                                                                                                                                1
                                                                                                                                                                game_record_set_quality_level true
                                                                                                                                                                  1
                                                                                                                                                                  game_request_game_terminate true
                                                                                                                                                                    1
                                                                                                                                                                    game_send_party_invites true
                                                                                                                                                                      2
                                                                                                                                                                      game_send_pause_menu_player_invite true
                                                                                                                                                                        2
                                                                                                                                                                        game_set_coop_friendly_fire true
                                                                                                                                                                          2
                                                                                                                                                                          game_set_coop_join_type true
                                                                                                                                                                            2
                                                                                                                                                                            game_set_equipped_grenade true
                                                                                                                                                                              1
                                                                                                                                                                              game_set_grenade_ammo true
                                                                                                                                                                                1
                                                                                                                                                                                game_set_refraction_situation true
                                                                                                                                                                                  4
                                                                                                                                                                                  game_show_community_sessions_ui true
                                                                                                                                                                                    1
                                                                                                                                                                                    game_show_coop_gamercard true
                                                                                                                                                                                      2
                                                                                                                                                                                      game_show_coop_partner_gamercard true
                                                                                                                                                                                        2
                                                                                                                                                                                        game_show_party_ui true
                                                                                                                                                                                          1
                                                                                                                                                                                          game_sign_into_network true
                                                                                                                                                                                            3
                                                                                                                                                                                            game_steam_open_dlc_page_overlay true
                                                                                                                                                                                              1
                                                                                                                                                                                              game_steam_open_overlay true
                                                                                                                                                                                                1
                                                                                                                                                                                                game_steam_open_url true
                                                                                                                                                                                                  1
                                                                                                                                                                                                  game_tutorial_start true
                                                                                                                                                                                                    1
                                                                                                                                                                                                    game_UI_audio_play true
                                                                                                                                                                                                      233
                                                                                                                                                                                                      game_unlockable_is_unlocked true
                                                                                                                                                                                                        5
                                                                                                                                                                                                        game_user_has_online_privilege true
                                                                                                                                                                                                          2
                                                                                                                                                                                                          game_use_imperial_units true
                                                                                                                                                                                                            1
                                                                                                                                                                                                            game_use_radial_menu_item true
                                                                                                                                                                                                              1
                                                                                                                                                                                                              game_vkeyboard_input true
                                                                                                                                                                                                                4
                                                                                                                                                                                                                gang_customization_confirm_gang_sign true
                                                                                                                                                                                                                  1
                                                                                                                                                                                                                  gang_customization_confirm_vehicle true
                                                                                                                                                                                                                    1
                                                                                                                                                                                                                    gang_customization_revert_gang_sign true
                                                                                                                                                                                                                      1
                                                                                                                                                                                                                      gang_customization_revert_vehicle true
                                                                                                                                                                                                                        1
                                                                                                                                                                                                                        gang_customization_select_gang_sign true
                                                                                                                                                                                                                          1
                                                                                                                                                                                                                          gang_customization_select_vehicle true
                                                                                                                                                                                                                            1
                                                                                                                                                                                                                            garage_back_to_customize true
                                                                                                                                                                                                                              1
                                                                                                                                                                                                                              garage_can_customize true
                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                garage_can_delete true
                                                                                                                                                                                                                                  1
                                                                                                                                                                                                                                  garage_clear_new true
                                                                                                                                                                                                                                    1
                                                                                                                                                                                                                                    garage_get_garage_type true
                                                                                                                                                                                                                                      1
                                                                                                                                                                                                                                      garage_get_repair_cost true
                                                                                                                                                                                                                                        4
                                                                                                                                                                                                                                        garage_preview_vehicle true
                                                                                                                                                                                                                                          3
                                                                                                                                                                                                                                          garage_remove_vehicle true
                                                                                                                                                                                                                                            1
                                                                                                                                                                                                                                            garage_repair_vehicle true
                                                                                                                                                                                                                                              2
                                                                                                                                                                                                                                              garage_vehicle_load_pending true
                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                gds_sex true
                                                                                                                                                                                                                                                  9
                                                                                                                                                                                                                                                  generator true
                                                                                                                                                                                                                                                    1
                                                                                                                                                                                                                                                    • game_lib.lua, line 5193: trigger = trigger_table, table for the trigger that should be used to disable a generator(warning callback set in this table will be overwritten)
                                                                                                                                                                                                                                                    get_actual_a_button true 1
                                                                                                                                                                                                                                                      get_actual_b_button true 1
                                                                                                                                                                                                                                                        get_a_button true 1 3
                                                                                                                                                                                                                                                        get_back_image true 1 2
                                                                                                                                                                                                                                                        get_b_button true 1 2
                                                                                                                                                                                                                                                        get_char_in_string true
                                                                                                                                                                                                                                                          3
                                                                                                                                                                                                                                                          get_char_in_vehicle true
                                                                                                                                                                                                                                                            3
                                                                                                                                                                                                                                                            get_char_vehicle_name true
                                                                                                                                                                                                                                                              2
                                                                                                                                                                                                                                                              get_control_stick_base true 1
                                                                                                                                                                                                                                                                get_control_stick_text true 1
                                                                                                                                                                                                                                                                  get_control_stick_thumb true 1
                                                                                                                                                                                                                                                                    get_current_difficulty true
                                                                                                                                                                                                                                                                      2
                                                                                                                                                                                                                                                                      get_cutscene_bink_handle true
                                                                                                                                                                                                                                                                        7
                                                                                                                                                                                                                                                                        get_dist true
                                                                                                                                                                                                                                                                          9
                                                                                                                                                                                                                                                                          get_dpad_down_image true 1 1
                                                                                                                                                                                                                                                                          get_dpad_image true 2 1
                                                                                                                                                                                                                                                                          get_dpad_left_image true 1 1
                                                                                                                                                                                                                                                                          get_dpad_lr_image true 1 1
                                                                                                                                                                                                                                                                          get_dpad_right_image true 1 1
                                                                                                                                                                                                                                                                          get_dpad_ud_image true 1 1
                                                                                                                                                                                                                                                                          get_dpad_up_image true 1 1
                                                                                                                                                                                                                                                                          get_frame_time true
                                                                                                                                                                                                                                                                            5
                                                                                                                                                                                                                                                                            get_get_key_names_for_axis_action true
                                                                                                                                                                                                                                                                              2
                                                                                                                                                                                                                                                                              get_hvs_voice_save_op_override true
                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                get_lb_button true 1 1
                                                                                                                                                                                                                                                                                get_left_right true 1
                                                                                                                                                                                                                                                                                  get_left_stick true 1 1
                                                                                                                                                                                                                                                                                  get_left_trigger true 1
                                                                                                                                                                                                                                                                                    get_localized_crc_for_tag true
                                                                                                                                                                                                                                                                                      14
                                                                                                                                                                                                                                                                                      get_localized_string_for_tag true
                                                                                                                                                                                                                                                                                        2
                                                                                                                                                                                                                                                                                        get_ls_press_image true 1 1
                                                                                                                                                                                                                                                                                        get_lt_button true 1 1
                                                                                                                                                                                                                                                                                        get_mouse_scroll_image true 1 1
                                                                                                                                                                                                                                                                                        get_num_humans_in_trigger true
                                                                                                                                                                                                                                                                                          2
                                                                                                                                                                                                                                                                                          • mflighttutorial.lua, line 1450: -- while get_num_humans_in_trigger( mFlightTutorial_trigger.end_trigger.name ) ~= 2 do
                                                                                                                                                                                                                                                                                          • mflighttutorial.lua, line 2539: if trigger_is_enabled( mFlightTutorial_trigger.lava_trigger.name ) == false and get_num_humans_in_trigger( mFlightTutorial_trigger.lava_trigger.name ) == 0 then
                                                                                                                                                                                                                                                                                          get_rb_button true 1 1
                                                                                                                                                                                                                                                                                          get_right_stick true 1 1
                                                                                                                                                                                                                                                                                          get_right_trigger true 1
                                                                                                                                                                                                                                                                                            get_rs_press_image true 1 1
                                                                                                                                                                                                                                                                                            get_rt_button true 1 1
                                                                                                                                                                                                                                                                                            get_start_image true 1 1
                                                                                                                                                                                                                                                                                            get_up_down true 1
                                                                                                                                                                                                                                                                                              get_vehicle_speed true
                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                get_world_income_dollars true
                                                                                                                                                                                                                                                                                                  1
                                                                                                                                                                                                                                                                                                  get_x_button true 1 1
                                                                                                                                                                                                                                                                                                  get_y_button true 1 1
                                                                                                                                                                                                                                                                                                  glitched_object_add true
                                                                                                                                                                                                                                                                                                    1
                                                                                                                                                                                                                                                                                                    glitch_cell true 1 21
                                                                                                                                                                                                                                                                                                    group_create_do true
                                                                                                                                                                                                                                                                                                      2
                                                                                                                                                                                                                                                                                                      group_create_hidden_do true
                                                                                                                                                                                                                                                                                                        1
                                                                                                                                                                                                                                                                                                        group_destroy_do true
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          group_destroy_unsynced_do true
                                                                                                                                                                                                                                                                                                            2
                                                                                                                                                                                                                                                                                                            group_get_actual_size true 1 1
                                                                                                                                                                                                                                                                                                            group_get_first_npc true
                                                                                                                                                                                                                                                                                                              1
                                                                                                                                                                                                                                                                                                              group_get_next_npc true
                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                group_hide_do true
                                                                                                                                                                                                                                                                                                                  2
                                                                                                                                                                                                                                                                                                                  group_is_loaded_internal true
                                                                                                                                                                                                                                                                                                                    2
                                                                                                                                                                                                                                                                                                                    group_show_do true
                                                                                                                                                                                                                                                                                                                      2
                                                                                                                                                                                                                                                                                                                      group_unsynced_do true
                                                                                                                                                                                                                                                                                                                        1