SR2 Lua Functions List (WIP)

This is an incomplete list of (mostly) builtin Lua functions of Saints Row 2.
Last Update: April 28, 2020

== Functions available in any contexts ==

acos(arg)

Parameters:
arg (float) floating point value

Returns:
(float) the arc cosine of arg

Description:
Computes the principal value of the arc cosine of arg.

Used only in hud.lua.

Reference:
cppreference.com

--------------------------------------------------------------------------------

ceil(arg)

Parameters:
arg (float) floating point value

Returns:
(float) the smallest integer value not less than arg

Description:
Computes the smallest integer value not less than arg.

Reference:
cppreference.com

--------------------------------------------------------------------------------

floor(arg)

Parameters:
arg (float) floating point value

Returns:
(float) the largest integer value not greater than arg

Description:
Computes the largest integer value not greater than arg.

Reference:
cppreference.com

--------------------------------------------------------------------------------

sqrt(arg)

Parameters:
arg (float) floating point value

Returns:
(float) square root of arg

Description:
Computes square root of arg.

Used only in hud.lua.

Reference:
cppreference.com

--------------------------------------------------------------------------------

debug_print(msg1[, msg2])

Parameters:
msg1 (string) The message to log
msg2 (string, optional) If present, it is concatenated to the end of msg1 (defaults to "")

Returns:
None

Description:
Send a debug log to Saints Row Powertools. Push "Scroll Lock" key to enable debug log display.
If two strings are passed to this function they will be concatenated, but it is not recommended because Powertools does not add any separators between them.
If Powertools is not present, this function does nothing.

Example:
Code:
debug_print("Hello", "World")
will print "HelloWorld" to the log.

--------------------------------------------------------------------------------

get_frame_time_real()

Parameters:
None

Returns:
(float) Number of seconds elapsed since the last execution of thread_yield()...?

Description:
Some kind of time measurement function. Used only in credits.lua. Behaves identically to get_frame_time() as far as I can tell.

--------------------------------------------------------------------------------

get_frame_time()

Parameters:
None

Returns:
(float) Number of seconds elapsed since the last execution of thread_yield().

Description:
Time measurement function that returns the number of seconds elapsed since the last execution of thread_yield().
The returned value contains the full seconds and the fractional part.

To get the full second only, use floor(arg). To get the fractional part only, use a combination of subtraction and floor(arg):
Code:
local time_elapsed = get_frame_time()
local fractional = time_elapsed - floor(time_elapsed)

--------------------------------------------------------------------------------

delay(duration)

Parameters:
duration (float) Duration in seconds

Returns:
None

Defined In:
system_lib.lua

Description:
Pauses the exection of the current thread for the specified amount of time.
Internally uses get_frame_time() for time measurement.

--------------------------------------------------------------------------------

rand_float(min, max)

Parameters:
min (float) Minimum value (inclusive)
max (float) Maximum value (inclusive)

Returns:
(float) A random floating point number between min and max

Description:
Generates a random floating point number between min and max.

--------------------------------------------------------------------------------

rand_int(min, max)

Parameters:
min (integer) Minimum value (inclusive)
max (integer) Maximum value (inclusive)

Returns:
(integer) A random integer number between min and max

Description:
Generates a random integer number between min and max.

--------------------------------------------------------------------------------

sizeof_table(tbl)

Parameters:
tbl (table) The target table

Returns:
(integer) The number of elements in the specified table

Description:
Get the number of elements in the specified table.
This is needed for many table-related operations because SR2 uses Lua 5.0 released back in 2006, which lacks the # operator.

--------------------------------------------------------------------------------

thread_yield()

Parameters:
None

Returns:
None

Description:
Yield (pause) the current Lua thread and let other threads and the game engine to run.
This function must be called once per iteration of an infinite loop or an waiting loop, otherwise the entire game freezes.

--------------------------------------------------------------------------------

thread_new(function_name[, params...])

Parameters:
function_name (string) The thread function's name. MUST BE A "DOUBLE QUOTED" STRING.
params (any, optional) Any parameters after the function_name are passed to the specified thread function.

Returns:
(integer) Thread Handle

Description:
Creates and starts a new "Lua Thread".

The Lua threads of Saints Row games are Coroutines, rather than a true multi-threading system.

Use of threads allow near-parallel exection of multiple code blocks.

The spawned thread will end its life when the thread function uses a "return" statement, reaches the end of the function block, or another thread uses thread_kill(handle) to manually kill it.

Example:
Code:
-- Main Function
function hello_main()
    -- Spawn a new thread and remember its handle.
    -- A string "Hello World!" and the number 2 are passed to the thread's function.
    local handle = thread_new("my_super_awesome_thread", "Hello World!", 2)
    -- Pause the main thread for 5 seconds (any other threads continues to run in background)
    delay(5)
    -- End my awesome thread.
    thread_kill(handle)
end

-- Thread Function
function my_super_awesome_thread(message, delay_seconds)
    -- This thread loops indefinitely, until other thread uses thread_kill.
    while true do
        -- Show the specified 'message' for every 'delay_seconds'.
        mission_help_table_nag(message)
        delay(delay_seconds)
        -- MUST CALL THIS ONCE PER LOOP OR THE GAME FREEZES!
        thread_yield()
    end
end

--------------------------------------------------------------------------------

thread_kill(handle)

Parameters:
handle (integer) Thread Handle obtained from thread_new

Returns:
None

Description:
Kills the specified thread, at the specified thread's most recent thread_yield() call.

--------------------------------------------------------------------------------

thread_check_done(handle)

Parameters:
handle (integer) Thread Handle obtained from thread_new

Returns:
(boolean) true if the specified thread is dead, or false if alive

Description:
Check if the specified thread has reached the end of its life. Returns false if the thread is still alive.

--------------------------------------------------------------------------------

coop_is_active()

Parameters:
None

Returns:
(boolean) true if there are two players in the current game (i.e. REMOTE_PLAYER exists)

Description:
Check if co-op multiplayer is currently active.

--------------------------------------------------------------------------------

audio_play(audio_name[, type_name[, blocking[, ignore_fade]]])

Parameters:
audio_name (string) name of sound to play
type_name (string, optional) name of audio source (can be "foley", "voice", "music", or "ambient"; defaults to "foley")
blocking (boolean, optional) set to true to block until the sound starts playing, else set to false to return immediately (defaults to false)
ignore_fade (boolean, optional) set to true to ignore the volume throttling that occurs with screen fades (defaults to false)

Returns:
(integer) audio instance handle, or -1 on error

Description:
Play a 2D sound (by name).

Example:
Code:
audio_play("DOOR_KICK", "foley", false)
Plays the door kick foley sound.

Reference:
Kinzie's Toy Box

== Functions exclusive to Gameplay Context ==

teleport(char_name, navpoint_name[, exit_vehicle])

Parameters:
char_name (string) name of the character
navpoint_name (string) name of the navpoint
exit_vehicle (boolean, optional) set to true if the player should be removed from any vehicle he is in, or false to teleport the vehicle as well; this parameter is ignored if teleporting an NPC (defaults to false)

Returns:
None

Description:
Teleport a character to a navpoint. When teleporting the player, any followers will automatically be teleported along with the player.

Unlike SRTT and onward, it lacks parameters such as X,Y,Z offsets. Therefore, in SR2 it is not possible to warp to an arbitrary location.

--------------------------------------------------------------------------------

message(msg[, duration])
UNUSED

Parameters:
msg (string or float) message text to display
duration (float, optional) duration to display the text, in seconds (defaults to 2.0)

Returns:
None

Description:
Display an arbitrary unlocalized message in the HUD.

Unlike its counterpart in SRTT, it is not possible to have the text localized, or show the message only for specified player. It also does not return a "message handle" that can be used for quickly clearing the message from the screen.

This function is used only by unused warp functions of "district scripts". (apartments.lua, prison.lua, etc)

--------------------------------------------------------------------------------

character_set_all_civilians_fleeing(character_name, distance)

Parameters:
character_name (string) name of the character
distance (float) the maximum distance of civilians to affect

Returns:
None

Description:
Make the nearby civilians flee from the specified character.

--------------------------------------------------------------------------------

on_vehicle_stunt(func_name, name)
UNUSED

Parameters:
func_name (string) name of the function, or "" to unregister the event
name (string) name of the vehicle (or name of the player, to trigger whenever they do a stunt on any vehicle)

Returns:
None

Description:
Register a callback function for when respect is earned via a vehicle-related stunt. (but not for combat)

When the callback is executed, the following parameters are passed to it:
- (string) name of the vehicle
- (float) respect earned

--------------------------------------------------------------------------------

on_hood_changed(func_name, name)
UNUSED

Parameters:
func_name (string) name of the function, or "" to unregister the event
name (string) name of the player

Returns:
None

Description:
Register a callback function for when the player moves to a different hood.

When the callback is executed, the following parameters are passed to it:
- (string) name of the player
- (string) internal name of the hood that the player moved into
- (string) internal name of the hood that the player came from

This function is only referenced from ultor_base.lua in a commented-out form.

--------------------------------------------------------------------------------

mission_script_cancel()
UNUSED FROM LUA

Parameters:
None

Returns:
None

Description:
End the currently active mission in failure, with the reason of player manually cancelling the mission or activity.
If used in freeroam, nothing happens immediately, but if the player dies afterwards the death message (YOU'RE SMOKED!) won't appear and the game softlocks.
This function is not used by any of SR2's Lua scripts, but probably used internally (without any involvements of Lua) when the player pushes D-Down twice.

--------------------------------------------------------------------------------

vehicle_get_nitro_state(vehicle)
UNUSED

Parameters:
vehicle (string) name of the vehicle

Returns:
(boolean) true if the vehicle's nitro is currently active

Description:
Check the vehicle's nitro activation status.

--------------------------------------------------------------------------------

vehicle_set_nitro_state(vehicle, nitro)
UNUSED

Parameters:
vehicle (string) name of the vehicle
nitro (boolean) true if the nitro should become active

Returns:
None

Description:
Forcefully activate the vehicle nitro, even if the vehicle doesn't have a nitro upgrade.
Does not play any sound effects on its own.

--------------------------------------------------------------------------------

teleport_vehicle_notoriety_pos(vehicle)
UNUSED

Parameters:
vehicle (string) name of the vehicle

Returns:
None

Description:
Warp the specified vehicle to a nearby, randomly-selected, notoriety vehicle spawn location.
Also modifies the vehicle's speed for a short time.

--------------------------------------------------------------------------------

team_despawn(team)
UNUSED

Parameters:
team (string) name of the team ("Playas", "Civilian", "Police", "Ultor", "Brotherhood", "Ronin", "Samedi", or "Neutral Gang")

Returns:
None

Description:
Despawn all nearby NPCs of the specified team.

--------------------------------------------------------------------------------

spawning_pedestrians([enable[, unknown]])

Parameters:
enable (boolean, optional) set to true to enable spawns, or false to disable (defaults to true)
unknown (boolean, optional) can be true or false but I have no idea what it does (this param doesn't exist in SRTT)

Returns:
None

Description:
Enable/disable spawning of ambient pedestrians.

Reference:
Kinzie's Toy Box

--------------------------------------------------------------------------------

player_is_in_hood(player, hood)
UNUSED

Parameters:
player (string) Player Name
hood (string) Internal Hood Name (i.e. "sr2_ss_projects02")

Returns:
(boolean) true if the player is in the specified hood

Description:
Check if the player is currently inside the specified hood.

--------------------------------------------------------------------------------

hood_set_pulsing(hood_name, pulse_status[, sync_flags])
UNUSED

Parameters:
hood_name (string) name of the hood
pulse_status (boolean) set to true to start pulsing, or false to stop pulsing
sync_flags (integer, optional) synchronization type (SYNC_LOCAL = affects local player, SYNC_REMOTE = affects remote player, or SYNC_ALL = affects both players; defaults to SYNC_ALL)

Returns:
None

Description:
Make a hood start/stop pulsing on the minimap.
Works like "district_set_pulsing" but for an individual hood.

--------------------------------------------------------------------------------

objective_text(goal_index, tag[, string1[, string2[, sync_type]]])

Parameters:
goal_index (integer) index of the objective text to display/modify in the HUD
tag (string) message text to display (from mission_help.xtbl) Does NOT accepts arbitrary texts; arbitrary texts will be shown as blank.
string1 (string or float, optional) the X part of the objective text. Accepts arbitrary texts. If this param is omitted, only the tag part of the text is shown.
string2 (string or float, optional) the Y part of the objective text. A '/' is added automatically between X and Y if this Y param is specified. Accepts arbitrary texts.
sync_type (integer, optional) synchronization type (SYNC_LOCAL = affects local player, SYNC_REMOTE = affects remote player, or SYNC_ALL = affects both players; defaults to SYNC_ALL)

Returns:
None

Description:
Display an "X of Y" styled mission-status indicator to the HUD.

The indicator will continue to display until changed by another call to objective_text or cleared with a call to objective_text_clear.

Slightly different from the SRTT counterpart in that SR2 doesn't have an icon_index parameter.

The "%s" occurrence replacement feature described in the Kinzie's Toy Box document doesn't actually exist in SR2, SRTT, or SRIV.

--------------------------------------------------------------------------------

hud_x_of_y_on(index, unknown, start_val, end_val)
UNUSED

Parameters:
index (integer) index of the x of y indicator
unknown (string?) seems ignored
start_val (integer) starting value for the x of y indicator
end_val (integer) target value (y value) of the x of y indicator

Returns:
None

Description:
Add an animated X of Y indicator to the mission HUD.

Unlike objective_text, the X value is shown in yellow and animates when its value changes. But there is a downside: it is not possible to display a label for it. The unknown param was probably intended for the text tag, but the indicator is always unlabeled. It is also impossible to show it only for a specific player; both players are always affected.

Has similarity with hud_x_of_y_add of SRTT.

--------------------------------------------------------------------------------

hud_x_of_y_set_value(index, cur_val)
UNUSED

Parameters:
index (integer) index of the x of y indicator
cur_val (integer) updated value for the x of y indicator

Returns:
None

Description:
Update the X value of an X of Y indicator.

Has similarity with hud_x_of_y_update of SRTT.

--------------------------------------------------------------------------------

hud_x_of_y_off(index)
UNUSED

Parameters:
index (integer) index of the x of y indicator

Returns:
None

Description:
Remove an X of Y indicator.

Has similarity with hud_x_of_y_remove of SRTT.

--------------------------------------------------------------------------------

hud_x_of_y_hide(index)
UNUSED

Parameters:
index (integer) index of the x of y indicator

Returns:
None

Description:
Instruct the game to ignore any future changes of the X value via "hud_x_of_y_set_value", until the X or Y indicator is removed and re-added.
Contrary to its name, this function does NOT hide the indicator. This function is likely bugged or unfinished.

SRTT doesn't have an equivalent of this function.

--------------------------------------------------------------------------------

character_get_gender(name)
UNUSED

Parameters:
name (string) Name of the character
Returns:
(integer) Character's gender type ( GT_NONE == 0, GT_MALE == 1, GT_FEMALE == 2 )

Description:
Get the gender type for a given character.

Return value is different from Kinzie's Toy Box document.

--------------------------------------------------------------------------------

player_creation_is_open_do()
UNUSED

Parameters:
None

Returns:
(boolean) true if Plastic Surgeon UI is currently active

Description:
Check if Plastic Surgeon UI is currently active.

Used only by an unused function "player_creation_open()" in ug_lib.lua.

--------------------------------------------------------------------------------

cutscene_play_check_done()

Parameters:
None

Returns:
(boolean) true if cutscene is not active

Description:
Check if no cutscene is running now.

--------------------------------------------------------------------------------

character_is_in_interior(name, interior_name)
UNUSED

Parameters:
name (string) Name of the character
interior_name (string) Name of the interior

Returns:
(boolean) true if the specified character is inside of the interior

Description:
Check if the character is inside of the interior.

The following interiors can be checked during freeroam:
Code:
shops_sr2_city_$SU_gun_int
shops_sr2_city_$SU_ice_int
shops_sr2_city_$RL_tattoo_int
shops_sr2_city_$HER_ice_int
shops_sr2_city_$MAR_branded_int
shops_sr2_city_$AR_rag_int
shops_sr2_city_$UN_music_int
shops_sr2_city_$AP_gun_int
shops_sr2_city_$BAR_slop_int
shops_sr2_city_$BAR_ice_int
shops_sr2_city_$AP_liq_int
shops_sr2_city_$BAR_music_int
shops_sr2_city_$DK_gun_int
shops_sr2_city_$DK_liq_int
shops_sr2_city_$DK_tat_int
shops_sr2_city_$SU_rim_int
shops_sr2_city_$HER_liq_int
shops_sr2_city_$HER_plas_int
shops_sr2_city_$MU_gift_int
shops_sr2_city_$SX_plas_int
shops_sr2_city_$DK_rim_int
shops_sr2_city_DT_gun_int
shops_sr2_city_DT_branded_int
shops_sr2_city_MU_brass_int
shops_sr2_city_MAR_gas_int
shops_sr2_city_SR_plas_int
shops_sr2_city_SR_music_int
shops_sr2_city_$SR_ice_int
shops_sr2_city_SR_bar_int
shops_sr2_city_$DT_tat_int
shops_sr2_city_MA_brass_int
shops_sr2_city_MA_lace_int
shops_sr2_city_MA_nobody_int
shops_sr2_city_MA_gun_int
shops_sr2_city_HER_imp_int
shops_sr2_city_TY_semi_int
shops_sr2_city_BAR_bar_int
shops_sr2_city_$CV_gift_int
shops_sr2_city_$AP_tat_int
shops_sr2_city_$BAR_slop2_int
shops_sr2_city_$BAR_brass_int
shops_sr2_city_UN_gift_int
shops_sr2_city_AP_music_int
shops_sr2_city_AP_gas_int
shops_sr2_city_$UN_gas_int
shops_sr2_city_$TY_liq_int
shops_sr2_city_$SR_imp_int
shops_sr2_city_$SU_bar_int
shops_sr2_city_$SX_music_int
shops_sr2_city_$SX_gas_int
shops_sr2_city_$SX_gas2_int
shops_sr2_city_$SX_rag_int
shops_sr2_city_$TY_gas_int
shops_sr2_city_$NU_rim_int
shops_sr2_city_$SU_rag_int
shops_sr2_city_$AIR_jewel_int
shops_sr2_city_$AIR_bar_int
shops_sr2_city_$CT_rim_int
shops_sr2_city_$AR_rim_int
shops_sr2_city_$DT_brass_int
shops_sr2_city_$HER_bar_int
shops_sr2_city_$DK_rim2_int
shops_sr2_city_$SR_rim_int
shops_sr2_city_$RL_Slop_int
shops_sr2_city_$DT_plas_int
shops_sr2_city_$AIR_brand_int
shops_sr2_city_PJ_bling_int
shops_sr2_city_$RL_rag_int
shops_sr2_city_$RL_liq_int
shops_sr2_city_MA_pretend_int
shops_sr2_city_$RL_liq2_int
barrio_$Bank_Interior
prison_$prison_interior
ultor_base_$interior_100
ultor_base_$interior_200
ultor_base_$interior_300
ultor_base_$interior_400
ultor_base_$interior_500
ultor_base_$interior_600

--------------------------------------------------------------------------------

get_dist(obj1, obj2)

Parameters:
obj1 (string) name of the first object (can be any type of scripted object)
obj2 (string) name of the second object (can be any type of scripted object)

Returns:
(float) distance between the two objects, in meters; or a really big number if one or both objects cannot be found

Description:
Get the distance between two objects.

favor_lateral and xz_only parameters don't seem to exist in SR2.

Reference:
Kinzie's Toy Box

--------------------------------------------------------------------------------

get_dist_char_to_char(obj1, obj2)
get_dist_char_to_nav(obj1, obj2)
get_dist_char_to_vehicle(obj1, obj2)
get_dist_mover_to_nav(obj1, obj2)
get_dist_vehicle_to_nav(obj1, obj2)
get_dist_vehicle_to_mover(obj1, obj2)

Defined In:
ug_lib.lua

Description:
These are aliases of get_dist(obj1, obj2) and works with any type of scripted objects.

--------------------------------------------------------------------------------

group_create(group[, block])

Parameters:
group (string) name of the script group. If the group doesn't exist the game will crash!
block (boolean, optional) set to true to block until everything in the group has finished streaming in (defaults to false)

Returns:
None

Defined In:
ug_lib.lua

Description:
Creates all script objects belonging to the specified script group. Groups and script objects are defined in various *.cts files. The objects will be unhidden by default.

If a script object in the group is already created and not destroyed or released yet, this function will do nothing for the object. Otherwise, a new instance of the object will be created to its initial position. (This behavior is different from Kinzie's Toy Box document.)

The "group table" support probably doesn't exist in SR2.

Reference:
Kinzie's Toy Box

--------------------------------------------------------------------------------

group_create_do(group)

Parameters:
group (string) name of the script group. If the group doesn't exist the game will crash!

Returns:
None

Description:
Internal function of group_create(group[, block]). Handles actual group loading, but blocking is handled by group_create.

--------------------------------------------------------------------------------

attack_heli_create(navpoint, attack_heli_id)

Parameters:
navpoint (string) name of the navpoint where an attack helicopter is spawned
attack_heli_id (integer) ID of the attack helicopter (The only ID used in the vanilla game was 0, but I think multiple helis with different IDs are possible)

Returns:
None

Description:
Spawns a randomly colored Thompson helicopter with a male Ronin gang member as the pilot.
If the helicopter is already spawned and attack_heli_destroy is not called yet, this function does nothing.

This "Ronin Attack Helicopter" system is used only in rn11 "One Man's Junk..." but can work everywhere in the game.

--------------------------------------------------------------------------------

attack_heli_destroy(attack_heli_id)

Parameters:
attack_heli_id (integer) ID of the attack helicopter

Returns:
None

Description:
Destroy the specified Ronin Attack Helicopter. Both the heli and Ronin member are instantly despawned.

--------------------------------------------------------------------------------

attack_heli_get_heli_name(attack_heli_id)

Parameters:
attack_heli_id (integer) ID of the attack helicopter

Returns:
(string) Helicopter's Object Name

Description:
Get the name of a Ronin Attack Helicopter. The name returned from this function can be used for checking the status of the heli.

--------------------------------------------------------------------------------

attack_heli_get_pilot_name(attack_heli_id)
UNUSED

Parameters:
attack_heli_id (integer) ID of the attack helicopter

Returns:
(string) The Pilot's Object Name

Description:
Get the name of a Ronin Attack Helicopter's pilot.

--------------------------------------------------------------------------------

strstr(a, b)

Parameters:
a (string) String to be scanned
b (string) String to find

Returns:
(boolean) true if b is included in a

Description:
Check if string b is a part of a. Used only in tss04.lua "Three Kings" to check which Saint is already recruited when retrying from a checkpoint.
This is the only string inspector function available in SR2, and is unavailable for Interface context. (It would've been more useful there...)

--------------------------------------------------------------------------------

The following functions are described in Kinzie's Toy Box document and do not seem to differ between Saints Row 2 and Saints Row: The Third.

mission_end_failure(name, failure_text) : End the mission in failure.
mission_end_success(name[, cutscene_name, warp_locations]) : End the mission in success.
mission_is_active([name]) : Check if a mission is currently active.
mission_is_complete(name) : Check if a mission has been completed.
mission_is_unlocked(name) : Check if a mission has been unlocked.
mission_set_checkpoint(checkpoint_name[, ignore_vehicles[, ignore_notoriety]]) : Set the most recent mission checkpoint that the player has passed.
character_is_dead(name) : Check if a character is dead (or awaiting revival).
character_is_released(name) : Check if an NPC has been released to the world.
character_exists(name) : Check to see if a character exists in the world.
chainsaw_disable() : Disallow player use of the chainsaw.
chainsaw_enable() : Allow player use of the chainsaw.
human_shielding_disabled() : Check if human shields have been disabled in the current build. (Returns false on normal SR2, true on German SR2)
character_dont_regenerate(name, dont_regen) : Enable/disable health regeneration on a character. Used from Fight Club and Zombie Uprising but UNUSED FROM LUA.
on_hit_ped(func_name, name) : Register a callback function for when a vehicle collides with a pedestrian. UNUSED.
get_team(name) : Get the name of the team to which an object belongs. UNUSED.
set_team(npc_name, team_name) : Set which team an NPC is on.
district_set_pulsing(district_name, pulse_status[, sync_flags]) : Make a district's neighborhoods start/stop pulsing on the minimap.
notoriety_allow_indoor_gang_spawning(enable) : Enable/disable notoriety spawns in Rounds Square Shopping Center.
action_nodes_enable(state) : Enable/disable all action nodes in the world. Action nodes include the player idle action spots and the stationary spawn spots of the Saints, Prostitutes, and Civilians.
action_nodes_restrict_spawning(restricted) : Restrict/unrestrict spawning for non-notoriety action nodes. When set to true, it will disable the stationary spawn spots of the civilians. The Saints members and the strippers will still spawn.
objective_text_clear(goal_index) : Clear an objective message.
mission_unlock(name) : Unlock a mission or activity.
get_char_vehicle_type_name(name) : Get the vehicle type name of a character's vehicle. UNUSED.
get_dist_closest_player_to_object(object[, player_list]) : Defined in ug_lib.lua. Get the distance from an object to the closest player, and also returns the closest player.
release_to_world(name) : Release a scripted object to the world (i.e.: turn it into an ambient, unscripted object).
get_current_hit_points(obj_name) : Get the current number of hit points of an object.
get_hood_owned_percentage() : Get the percentage of neighborhoods owned by the player, from 0 to 1. This function skips over the hoods that cannot be claimed (Prison, Saint's Row, Nuclear Island, ocean, etc) so at the end of the game it returns 1. UNUSED.

--------------------------------------------------------------------------------

The following functions either do nothing or the proper usage is unknown.

gang_force_spawn(gang_name, spawn_override) : Used only in ep02.lua but has no effect.
never_die(name?, flag?) : No effect, the specified character still dies. UNUSED.
mission_debug(msg) : Most likely sent a debug message to the game during development. Powertools does NOT reenable this; you must use debug_print instead.
script_profiler_start_section(section_name) : These four functions were probably used for Lua script performance benchmarking.
script_profiler_end_section(section_name)
script_profiler_do_printout()
script_profiler_reset()
player_creation_set_opening(flag) : Likely opened the Plastic Surgeon UI, but does nothing when used. UNUSED.
player_creation_open() : Defined in ug_lib.lua. Likely opened the Plastic Surgeon UI but again, does nothing. UNUSED.
player_creation_open_do() : Internal function used by the above function. Does nothing. UNUSED.
audio_is_xmp_playing() : Check if the XBox Music Player is currently playing. Since we're not in Xbox it always returns false.
on_tagged(func_name, tag_name?) : Likely set a callback that called when a new tag spot is completed, but the callback is never being called. UNUSED.
reset_mp_tutorial_count() : Reset the "Strong Arm tutorial viewed" count for the "Strong Armed" achievement. Does nothing on PC.
increment_mp_tutorial_count(tutorial_id) : Mark the specified Strong Arm tutorial as viewed. Does nothing on PC.
get_current_hood_owner_by_position(?) : Always returns a string "No Hood" no matter what param I give. UNUSED.
is_demo_execution() : Check if SR2 is a demo version. Used by tss01.lua which teleports the player(s) to a different location after the mission is completed.
store_discount(shop_name?, discount?) : Probably it did something with the store discounts. I tried to feed it shop names, shop chain names, and trigger names, but it had no effect. Always returns nil so I'm sure it doesn't serve as a function to retrive current discount info. UNUSED.
get_vehicle_special_type(handle) : Broken by design because it expects an integer handle of the vehicle which Lua scripts never get to know. Give it a mission vehicle name or player name and I always got VST_NONE (13). UNUSED.
get_vehicle_type(handle) : Has the same flaw as above so it effectively always returns VT_NONE (6). UNUSED.
should_skip_intro_cutscene() : Always returns false. Probably this was used as a way to skip "Vacation's Over" opening cutscene during development, but was since removed. UNUSED.

--------------------------------------------------------------------------------

The following functions are referenced by some of mission lua files but does NOT actually exist in the game.

distant_ped_vehicle_render_enable(boolean) : Referenced from the init code of tss01.lua "Jailbreak" in a commented-out form. Probably turned off the "ghost cars" that are only rendered when the player is very far from the road.
coop_scorebox_show() : Referenced from a commented-out code of bh02.lua "Reunion Tour"'s "Guard Donnie" section. Probably enabled some kind of scoreboard during co-op so the players can compete who can kill the most enemies.
coop_scorebox_hide() : Referenced from a commented-out code of bh02.lua "Reunion Tour"'s "Guard Donnie" section. Likely disabled the scoreboard explained above.
framerate_test_should_run_continuously() : Called from fr_check*.lua, and fails because it is missing. If this function returns true, the benchmarks will not end by 30 seconds timer.
helicopter_shoot_vehicle(heli_name, vehicle_name[, unit_sphere[, multiplier[, alt_fire]]]) : Called by dlc05.lua "Corporate Meltdown"'s friendly helicopter code, to make the helicopter fire a missile at an enemy vehicle, but fails because it doesn't exist in the PC Saints Row 2. Probably it was added by the "Coporate Warfare" DLC of console versions, and I'm sure it will be added to the updated SR2 PC release.

--------------------------------------------------------------------------------

TODO: There are a lot more functions...

UNUSED:
Code:
pause_menu_objective_add
pause_menu_objective_force_show
npc_aim_at_point
audio_play_startle_or_panic
audio_play_emitting_id_for_character
audio_play_emitting_id_for_mover
camera_shake_stop
character_slots_clear_reservations
character_slots_reserve_for_team
demo_completed
homie_mission_lock_all
homie_mission_reset
door_is_locked
follower_remain_in_car
follower_ignore_distance
forced_target_clear
forced_target_set
game_quit_to_main_menu
player_holster
hood_is_any_contested
hud_get_fake_notoriety
character_get_persona
character_set_persona
character_set_painful_ragdoll
character_set_override_emotion
character_clear_override_emotion
character_voice_is_playing
character_start_sidewalking
ingame_effect_scale
is_compressed_prologue
character_is_inside_vehicle_bbox
hood_owner_is
hood_is_contested
mesh_mover_in_player_fov
item_is_in_vehicle
log_append
log_clear
mesh_mover_action_is_done
mesh_mover_stop_action
mesh_mover_reset_to_action_start
mesh_mover_kill
minimap_npc_always_show
mp_object_item_set_respawn_timer
news_van_do_camera
notoriety_set_most_important_coop_police_type
notoriety_spawn_count
npc_weapon_pickup_override_clear
npc_disable_rank_reactions
npc_jump_forward_fake
on_ai_release
on_mover_dropped
on_mover_pickup
on_entered_water
on_ragdoll_collision
on_recruit
on_tailing_close
on_tailing_far
on_tailing_too_close
on_taunt
party_allow_vehicle_combat
party_get_count
party_get_count_alive
persona_override_persona_stop_all
persona_override_remove_all
player_get_mp_team
player_names_get_mp_team
effect_play_for_object
radio_off
recruit_set_marked_flag
recruit_set_mode
remote_teleport_complete
roadblocks_set_vehicle_hit_point_multiplier
searchlight_enable
searchlight_reset
searchlight_set_min_notoriety
searchlight_track_character
searchlight_track_player_followers
searchlight_track_players
adjust_hit_points
vehicle_door_open
vehicle_door_stay_open
vehicle_open_door_by_name
vehicle_is_continuing_along_highway
vehicle_allow_flat_swerve
set_camp_flag
shop_unlock
shop_unlock_all
spawn_set_gang_clash_team
spawn_get_gang_clash_team
spawn_region_set_category
spawning_remove_all
sprint_set_local_delay_override
npc_use_action_node
tutorial_suspend
player_unholster
vehicle_attach_to_carrier
vehicle_chase_mover
vehicle_degrade_control
vehicle_detach_trailer
chain_hitch
vehicle_add_ignore_obstacle_handle
vehicle_remove_ignore_obstacle_handle
vehicle_lights_off
vehicle_set_ambient
helicopter_ai_go_to_enter
helicopter_clear_missile_chance
helicopter_clear_max_bank_angle
vehicles_chase_dont_eject
vehicle_player_collision_mass_adjust
vehicle_respond_to_sirens
vehicle_set_always_flee
vehicle_set_as_critical
vehicle_get_gang
vehicle_set_hostile
vehicle_set_ignore_rail_obstacles
vehicle_suppress_engine_audio
vehicle_change_variant
debug_validate_lane
dump_fps

USED IN SOMEWHERE:
Code:
ambient_cop_spawn_enable
ambient_gang_spawn_enable
attack_do
attack_heli_go
attack_heli_init_weave_ai
attack_heli_set_drop_accuracy
attack_heli_update
audio_get_id
audio_is_playing
audio_play_do
audio_play_id_do
audio_play_for_cellphone
cellphone_animate_start_do
cellphone_animate_stop_do
audio_play_for_character_do
audio_play_id_for_character_do
audio_play_for_character_weapon_do
audio_play_persona_line
audio_play_for_mover_do
audio_play_for_navpoint
audio_play_id_for_navpoint_do
audio_play_emitting_id_for_navpoint
audio_stop_emitting_id
audio_stop
audio_throttle_type
audio_suppress_ambient_player_lines
camera_end_look_through
camera_look_through_do
camera_script_is_finished
camera_shake_start
cash_add
cash_remove
cell_spawns_enable
cellphone_receive_call
cellphone_has_received_call
cellphone_remove
cellphone_reset_call
cellphone_clear_between_call_delay
character_has_human_shield
character_has_specific_human_shield
character_take_human_shield_check_done
character_take_human_shield_do
character_get_human_shield_name
character_release_human_shield
character_hide
character_hidden
character_ignite
character_set_unrevivable
character_show
character_remove_vehicle
character_slots_clear_caps
character_slots_cap_for_team
character_suppress_human_shield_idles
character_suppress_squirted_reaction
character_throw_havok_weapon
character_wield_havok_weapon
city_chunk_has_extras_loaded
city_chunk_swap
chunk_swap_sequence_make_permanent
chunk_swap_sequence_start
chunk_swap_sequence_revert
chunk_swap_sequence_save_and_revert
chunk_swap_sequence_restore_saved
chunk_enable_ambient_streaming
city_chunk_set_all_civilians_fleeing
crib_purchasing_unlock
npc_combat_enable
combat_enable_sword_parries
combat_enable_sword_strafing
confessionals_enable
confessionals_allow_free_one
confessionals_get_nearest_trigger
crib_is_unlocked
group_create_check_done
crouch_start
crouch_stop
crouch_is_crouching
cutscene_play_do
damage_indicator_on
damage_indicator_off
group_is_loaded
group_destroy
group_hide
group_show
homie_mission_unlock
homie_mission_lock
npc_detection_enable
distance_display_on
distance_display_off
door_lock
door_open
door_is_open
door_close
door_message_override
fade_in
fade_out
fade_get_percent
feedback_start
flee
flee_to_navpoint
follower_make_independent
force_ai_mode_check_done
force_fire_do
force_fire_object_position_do
force_fire_pull_alt_trigger
force_fire_target_do
force_throw_do
force_throw_char_do
force_throw_from_vehicle
npc_do_drugs
npc_dont_auto_equip_or_unequip_weapons
force_melee
fov_check
fov_check_xz_plane
get_char_in_vehicle
get_current_hood_by_position
get_game_time
get_max_hit_points
get_vehicle_speed
group_create_hidden_do
npc_hearing_enable
district_set_pulsing
hud_bar_set_value
hud_set_fake_notoriety
hud_bar_set_range
hud_bar_off
hud_bar_on
hud_timer_hide
hud_timer_get_remainder
hud_timer_pause
hud_timer_set
hud_timer_stop
character_check_resource_loaded
character_evacuate_from_all_vehicles
character_is_ragdolled
character_damage
character_disallow_ragdoll
character_allow_ragdoll
character_is_ready
character_is_combat_ready
character_set_cannot_wield_havok_weapon
npc_enable_human_collision
character_set_cannot_be_grabbed
character_set_cannot_be_grabbed_by_player
character_set_damage_multiplier
character_set_only_scripted_grabs
character_set_combat_ready
character_set_injured
character_set_no_satchel_panic
character_destroy
character_set_walk_variant
character_set_stand_variant
character_set_run_variant
character_make_priority_target
check_animation_state
clear_animation_state
ingame_effect_add_npc
ingame_effect_remove_npc
ingame_effect_add_player
ingame_effect_remove_player
ingame_effect_add_vehicle
ingame_effect_remove_vehicle
ingame_effect_add_group
ingame_effect_remove_group
ingame_effect_add_item
ingame_effect_remove_item
ingame_effect_add_mover
ingame_effect_remove_mover
ingame_effect_add_navpoint
ingame_effect_remove_navpoint
ingame_effect_add_trigger
ingame_effect_remove_trigger
inv_has_item
inv_item_add_ammo
inv_item_add_do
inv_weapon_add_temporary
inv_weapon_remove_temporary
inv_weapon_disable_all_but_this_slot
inv_weapon_disable_slot
inv_weapon_enable_or_disable_all_slots
inv_item_equip
inv_item_get_all_do
inv_item_get_all_ammo_do
inv_item_in_slot
inv_item_get_equipped_item
inv_item_is_equipped
inv_item_is_firearm_equipped
inv_item_remove_all
inv_item_remove
inv_item_remove_in_slot
loot_item_add
animation_is_state
character_is_in_vehicle
character_is_in_vehicle_transation
character_is_in_a_driver_seat
character_is_swimming
get_char_vehicle_is_in_air
get_char_vehicle_name
get_char_vehicle_type
get_char_vehicle_special_type
get_char_vehicle_towed_vehicle
follower_is_unconscious
npc_in_player_fov
navpoint_in_player_fov
npc_is_in_party
item_drop
item_reset
character_is_on_fire
character_is_panicking
character_is_player
player_is_in_vehicle
player_is_targeting_do
vehicle_is_destroyed
item_hide
item_show
los_check_do
mesh_mover_destroyed
mesh_mover_hide
mesh_mover_play_action
mesh_mover_reset
mesh_mover_reset_to_action_end
mesh_mover_show
mesh_mover_wielding
mesh_mover_being_wielded
mesh_mover_wield_stop
minimap_icon_add_group_do
minimap_icon_add_item_do
minimap_icon_add_navpoint_do
minimap_icon_add_npc_do
minimap_icon_add_player_do
minimap_icon_add_trigger_do
minimap_icon_add_vehicle_do
minimap_icon_add_mover_do
minimap_icon_add_radius
minimap_icon_remove_group
minimap_icon_remove_item
minimap_icon_remove_navpoint
minimap_icon_remove_npc
minimap_icon_remove_player
minimap_icon_remove_trigger
minimap_icon_remove_vehicle
minimap_icon_remove_mover
minimap_icon_remove_radius
mission_help_table_do
mission_help_clear
move_to_check_done
move_to_do
move_to_vehicle_entry_point_check_done
move_to_vehicle_entry_point_do
notoriety_force_no_spawn
notoriety_get
notoriety_get_decimal
notoriety_reset
notoriety_restricted_zones_enable
notoriety_set_desired_vehicle_count
notoriety_set
notoriety_set_can_decay
notoriety_set_max
notoriety_set_min
npc_weapon_pickup_override
npc_weapon_spread
npc_follow_npc
npc_go_idle
npc_holster
character_kill
npc_leash_remove
npc_leash_to_nav
npc_leash_set_unbreakable
character_prevent_flinching
character_prevent_kneecapping
character_prevent_explosion_fling
vehicle_prevent_explosion_fling
vehicle_prevent_transition_to_ambient
character_ragdoll
npc_max_corpses_override
npc_max_corpses_reset
npc_respawn_after_death
npc_respawn_after_death_time_override
npc_respawn_dist_override
npc_respawn_dist_reset
npc_revive
npc_set_boss_always_defend
npc_set_boss_type
npc_stop_following
npc_suppress_persona
npc_unholster_best_weapon
on_collision
on_damage
on_incapacitated
on_revived
on_interior_enter
on_interior_exit
open_vint_dialog_do
open_vint_dialog_check_done
on_searchlight_track
on_death
on_detection
on_dismiss
on_door_opened
on_finished
on_game_time_trigger
on_district_changed
on_mover_destroyed
on_mover_dislodged
on_notoriety_event
on_pickup
on_projectile_hit
on_purchase
on_random_obj_killed
on_respawn
on_take_damage
on_character_right_hand_hit
on_panic
on_tailing_good
on_tailing_too_far
on_trigger
on_trigger_exit
on_vehicle_destroyed
on_vehicle_hitched
on_vehicle_unhitched
on_weapon_pickup
on_weapon_equip
on_weapon_fired
parking_spot_enable
on_vehicle_enter
on_vehicle_exit
party_add_do
party_allow_max_followers
party_dismiss_do
party_dismiss_all
party_get_follower_index
party_set_dismissable
party_set_recruitable
party_swap_follower_indices
party_use_melee_weapons_only
path_name_is_path
patrol
patrol_pause
patrol_unpause
persona_override_character_start_do
persona_override_character_stop_do
persona_override_character_stop_all
persona_override_persona_start_do
persona_override_persona_stop_do
action_play_is_finished
action_play_do
action_play_custom_do
player_button_just_pressed
player_controls_disable
player_controls_enable
player_get_custom_voice
player_force_vehicle_seat
player_get_nearest_trigger_of_type
player_names_get_all
player_warp_to_shore_disable
player_warp_to_shore_enable
effect_play
get_player_respect
radio_on
radio_post_event
radio_get_station
radio_set_station
radio_reset_station
radio_block
radio_set_sing_along
render_script_trigger_on_minimap_add
render_script_trigger_on_minimap_remove
roadblocks_enable
screenshot_check_done
screenshot_do
script_assert
set_always_sees_player_flag
set_animation_state
set_attack_enemies_flag
set_attack_peds_flag
set_attack_player_flag
set_cant_flee_flag
set_cops_shooting_from_vehicles
set_cower_flee_mode
set_current_hit_points
vehicle_door_prevent_damage_detach
set_blitz_flag
set_dont_attack_me_on_sight_flag
set_dont_drop_havok_weapons_on_idle
set_force_combat_ready_team
set_ignore_ai_flag
set_ignore_burst_accuracy_flag
set_max_hit_points
set_mission_author
set_ped_density
set_perfect_aim
set_player_can_enter_exit_vehicles
set_player_can_be_busted
set_police_never_fire_at_civilian_human_shields
set_seatbelt_flag
on_mission_item_drop
on_mission_item_pickup
set_never_crouch_flag
set_time_of_day
set_time_of_day_scale
set_traffic_density
set_trailing_aim_flag
set_unjackable_flag
set_unrecruitable_flag
set_weather
shop_enable
spawning_allow_cop_ambient_spawns
spawning_allow_gang_team_ambient_spawns
spawning_allow_gang_ambient_spawns
spawn_override_set_category
spawning_boats
spawning_vehicles
sprint_set_local_use_override
sprint_set_local_recharge_override
sprint_reset_local_overrides
npc_use_closest_action_node_of_type
action_stop_custom
effect_stop
explosion_create
finishers_disable
finishers_enable
parachute_disable
parachute_enable
object_destroy
subgroup_create_do
teleport_check_done
teleport_vehicle
base_jumping_enable
build_get_build_type
bink_play_movie_do
bink_movie_done
trigger_enable
trigger_get_all_with_prefix
position_is_in_trigger
trigger_set_delay_between_activations
trigger_type_enable
turn_angle_do
turn_invulnerable
turn_to_do
turn_to_check_done
turn_vulnerable
tutorial_completed
tutorial_lock
tutorial_start
tutorial_unlock
vehicle_max_speed
vehicle_get_max_speed
vehicle_attach_trailer
vehicle_chase
vehicle_detonate
vehicle_disable_chase
vehicle_disable_flee
vehicle_drag_ragdoll_start
vehicle_drag_ragdoll_stop
vehicle_enter_check_done
vehicle_enter_do
vehicle_enter_group_check_done
vehicle_enter_group_do
vehicle_evacuate
vehicle_exists
vehicle_exit_check_done
vehicle_exit_do
vehicle_set_explosion_damage_multiplier
vehicle_hide
vehicle_hidden
vehicle_ignore_repulsors
vehicle_infinite_mass
vehicle_in_air
vehicle_lights_on
vehicle_never_flatten_tires
vehicle_flee
vehicle_pathfind_navmesh_do
vehicle_pathfind_to_do
helicopter_fly_to_do
helicopter_go_to_change_follow_target
helicopter_go_to_clear_follow_target
helicopter_enter_retreat
helicopter_go_to_set_target
helicopter_shoot_human
helicopter_shoot_navpoint
helicopter_set_dont_move_in_combat
helicopter_set_dont_use_constraints
helicopters_set_jitter_override
helicopter_set_missile_chance
helicopter_set_max_bank_angle
airplane_fly_to_do
vehicle_pathfind_check_done
airplane_takeoff_do
airplane_land_do
vehicle_turret_base_to_do
vehicle_mark_as_players
vehicle_repair
vehicle_set_bulletproof_glass
vehicle_set_crazy
vehicle_set_dont_scare_peds
vehicle_set_use_lockon_system
vehicle_set_use_short_cuts
vehicle_set_untowable
vehicle_set_radio_controls_locked
vehicle_set_script_hard_goto
vehicle_set_allow_ram_ped
vehicle_get_num_seats
vehicle_get_smoke_and_fire_state
vehicle_set_sirenlights
vehicle_set_sirens
vehicle_set_smoke_and_fire_state
vehicle_get_driver
vehicle_set_invulnerable_to_player_explosives
vehicle_set_torque_multiplier
vehicle_show
vehicle_speed_override
vehicle_speed_cancel
vehicle_stop_do
vehicle_suppress_flipping
vehicle_suppress_npc_exit
voodoo_glow_start
voodoo_glow_stop
waiting_for_player_dialog
wander_start
wander_stop
customization_outfit_wear
customization_item_wear
customization_item_revert
waypoint_add
waypoint_remove
drug_enable_disable_effect_override
drug_effect_set_override_values
dump_fps_tagged
prison_blackout_nuke_zone
prison_blackout_start
prison_blackout_restore_everything
prison_blackout_set_window_threshold
group_give_to_client
 
Last edited:
The following post is my knowledge of Interface Context in Saints Row 2.

== About the "Unicode" strings in Interface Context and how to deal with them ==

In many places of the game's UI, such as Garage and Stats, the game reports vehicle names, stat names, and many other values to the Lua script using "Unicode" strings.

From Lua, these strings look like regular ASCII strings (even type(var) reports them as "string") but string comparison between ASCII and Unicode strings will fail (always false even if both strings look identical), will emit a garbage string if concatenated with '..' operator, and PowerTools will emit lots of garbage characters if 'debug_print'ed.

In SR2's Lua, comparison '==' and concatenation '..' are the only available actions against strings, and 'strstr' is exclusive to Gameplay Context. In other words, it is impossible to inspect the contents of a string.

Due to these limitations, the only thing you can do against Unicode strings are to compare with another Unicode string.

An arbitrary Unicode can be created by using "vint_insert_values_in_string":
Code:
unicode_string = vint_insert_values_in_string("{0}", {[0] = ascii_string})
The resulting string can then be used for comparison with a game-created Unicode string.

== Functions exclusive to Interface Context ==

These functions are only available in the Interface Context Lua files.
What each Lua script is actually allowed to do differs beteen each file but there are several "common" functions that can be used anywhere.

--------------------------------------------------------------------------------

vint_insert_values_in_string(format, insert_values)

Parameters:
format (string) Format String
insert_values (table) Replacement value for each {n} (see Description for more info)

Returns:
(string) Unicode String

Description:
Create a formated Unicode string.

The format can be any ASCII string and may contain up to 32 Placeholders ({0}, {1}, .. {31}) in it.
Each placeholder is replaced with the value from insert_values table.

Each entry in insert_values table can be a number or a string. If the value is a string and is a localization tag, the localized string will be inserted to the result.

Example:

Code:
local insert_values = {
    [0] = "HELP_TEXT_STASH_TITLE",
    [1] = "MSN_SH_BH_AIRPORT_TRANSFERCOMPLETE"
}
local unicode_string = vint_insert_values_in_string("{0} {1}!", insert_values)

The resulting 'unicode_string' variable will contain "Stash Transfer complete!" in English or its localized equivalent.

In certain places of the UI scripts (like the store name of building_purchase.lua) the game give the Lua script only an interger CRC value of a localization tag. In this case, you can add ':text_tag_crc' after the number of placeholder (e.g. {0:text_tag_crc}) and set the CRC in the insert_values table ({[0] = crc}) to create a localized string.

--------------------------------------------------------------------------------

vint_document_find(doc_name)

Parameters:
doc_name (string) Interface Document Name

Returns:
(integer) Interface Document Handle, or 0 if the specified document is not currently loaded by the game

Description:
Returns the handle of the specified "interface document". An interface document is the root object of UI elements used in the game.

List of documents:
activity_level
alpha_skin
building_purchase
cdl01
cellphone
city_load
clothing_store
completion
credits
crib_cust
cte_news6
cte_sniper_rifle
cutscene_test
cutscene_tv
demo_derby
dialog_box
gang_cust
garage
gmb_blackjack
gmb_poker
hud
hud_btnmash
hud_coop_div
hud_demo_derby
hud_msg
hud_multi_prototype
hud_overhead
hud_race_start
hud_touch_combo
hud_zombie
liquor_store
main_menu
menu_base
menu_gambling_poker
menu_multi_color
menu_style_dialog
mission_replay
mm_wireless
mp_completion
mp_hud
mp_hud_lobby
mp_leaderboards
mp_lobby_players
mp_match_load
mp_player_info_popup
mp_scoreboard
mp_server_browser
music_store
pause_map
pause_menu
pcr01
ss_grid
television
tutorial
tutorial_subtitles
vehicle_cust
vignette
weapon_store

--------------------------------------------------------------------------------

vint_object_find(obj_name[, parent_handle, doc_handle])

Parameters:
obj_name (string) Interface Object Name
parent_handle (integer, optional) Parent Object Handle (will search for the entire document if this param is missing)
doc_handle (integer, optional) Target Document Handle (will search for the current document if this param is missing)

Returns:
(integer) Object Handle, or 0 if not found

Description:
Finds a user interface object.

--------------------------------------------------------------------------------

vint_get_property(obj_handle, property_name)

Parameters:
obj_name (integer) Interface Object Handle
property_name (string) Property Name

Returns:
(any) Property Value(s)

Description:
Gets a property of an user interface object.

--------------------------------------------------------------------------------

vint_set_property(obj_handle, property_name[, params...])

Parameters:
obj_name (integer) Interface Object Handle
property_name (string) Property Name
params (any) Property Value(s). Expected type and number of params varies.

Returns:
None

Description:
Sets a property of an user interface object.

Some of the commonly seen "property names" and their (types):

* "anchor" (float, float) X and Y offsets (returns two values for get, expects two params for set)
* "visible" (boolean) true if the object is visible and false if the object is hidden
* "alpha" (float) Alpha value (0-1)
* "tint" (float, float, float) Red, Green, and Blue tint (0-1 for each)
* "scale" (float, float) X and Y scale
* "text_tag" (string) text (text boxes only)
* "text_tag_crc" (integer) CRC text tag (text boxes only)
* "image" (string) Bitmap Name (icon related UI objects only)

--------------------------------------------------------------------------------

get_game_play_mode()

Parameters:
None

Returns:
(string) Current game mode

Description:
Returns the current game play mode.

Observed return values during Campaign Mode:
* "Normal": Freeroam and Main Menu
* "Mission": Story and Stronghold Missions
* "Activity": Activities
* "Diversion": Occupational Diversions (except Ho-ing which is "Normal")

Multiplayer Mode values checked by mp_is_enabled():
* "Pre-game lobby"
* "Gangsta Brawl"
* "Team Gangsta Brawl"
* "Braveheart"
* "Multiplayer Creation"
* "Multiplayer Customization"
* "Multiplayer Game Results"
* "Multiplayer Scoreboard"
* "Multiplayer Tutorial"
 
Last edited:
Back
Top