Global
Global functions that are not part of a class or object are listed here. Be sure to check what game modes they are loaded in before use, as not all of them will be loaded in campaign, battle or the frontend.
-
script_error(stringmessage) -
Throws a script error with the supplied message, printing the lua callstack to the console. Useful for debugging.
Parameters:
1
stringmessage
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/all_scripted.lua, line 33
-
out(stringoutput) -
outis a table that provides multiple methods for outputting text to the game console. It may be called as a function to output a string to the main Lua tab, but the following table elements within it may also be called to output to different output tabs:
- shane
- dylan
- ui
- traits
- help_pages
- interventions
- invasions
- tom
- kostas
- ting
- scott_b
- design
out supplies four additional functions that can be used to show tab characters at the start of lines of output:
Tab levels are managed per output tab. To each of these functions a string argument can be supplied which sets the name of the console tab to apply the modification to. Supply no argument or a blank string to modify the tab level of the main console output.Function Description out.inc_tabIncrements the number of tab characters shown at the start of the line by one. out.dec_tabDecrements the number of tab characters shown at the start of the line by one. Decrementing below zero has no effect. out.cache_tabCaches the number of tab characters currently set to be shown at the start of the line. out.restore_tabRestores the number of tab characters shown at the start of the line to that previously cached. Parameters:
1
stringoutput
Returns:
nil
Example - Standard output:
out("Hello World")
out.inc_tab()
out("indented")
out.dec_tab()
out("no longer indented")
Hello World
indented
no longer indented
Example - UI tab:
Output to the ui tab, with caching and restoring of tab levelsout.ui("Hello UI tab")
out.cache_tab("ui")
out.inc_tab("ui")
out.inc_tab("ui")
out.inc_tab("ui")
out.ui("very indented")
out.restore_tab("ui")
out.ui("not indented any more")
Hello UI tab
very indented
not indented any more
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/all_scripted.lua, line 115
-
force_require(stringfilename) -
Forceably unloads and requires a file by name.
Parameters:
1
stringfilename
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/all_scripted.lua, line 397
-
load_script_libraries() -
One-shot function to load the script libraries.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/all_scripted.lua, line 406
-
get_bm() -
Global function to get a battle manager from anywhere (battle only, obviously).
Returns:
battle_manager
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_manager.lua, line 268
A suite of functions related to vectors. In battle scripting terminology, vectors are 2D/3D positions in the game world.
-
v(numberx position, numbery position, numberz position) -
A shorthand method for creating a
battle_vector. Battle only.Parameters:
1
numberx position
2
numbery position
3
numberz position
Returns:
vector
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 11
-
v_to_s(vectorsubject vector) -
Converts a vector to a string, for debug output
Parameters:
1
vectorsubject vector
Returns:
string
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 17
-
v_offset(vectorsource vector, [numberx offset], [numbery offset], [numberz offset]) -
Takes a source vector and some x/y/z offset values. Returns a target vector which is offset from the source by the supplied values.
Parameters:
1
vectorsource vector
2
numberoptional, default value=0
x offset
3
numberoptional, default value=0
y offset
4
numberoptional, default value=0
z offset
Returns:
targetvector
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 30
-
v_add(vectorvector a, vectorvector b) -
Takes two vectors, and returns a third which is the sum of both.
Parameters:
1
vectorvector a
2
vectorvector b
Returns:
targetvector
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 53
-
v_subtract(vectorvector a, vectorvector b) -
Takes two vectors, and returns a third which is the second subtracted from the first.
Parameters:
1
vectorvector a
2
vectorvector b
Returns:
targetvector
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 74
-
centre_point_table(tableposition collection) -
Takes a table of vectors, buildings, units or scriptunits, and returns a vector which is the mean centre of the positions described by those objects.
Parameters:
1
tableTable of vectors/buildings/units/scriptunits.
Returns:
vectorcentre position
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 95
-
get_position_near_target(source position
vector,min distance
[number],max distance
[number],min bearing
[number],max bearing
[number]
) -
Returns a vector at a random position near to a supplied vector. Additional parameters allow a min/max distance and a min/max angle in degrees from the source vector to be specified.
Parameters:
1
vectorsource position
2
numberoptional, default value=20
Minimum distance of target position in m.
3
numberoptional, default value=50
Maximum distance of target position in m.
4
numberoptional, default value=0
Minimum bearing of target position in degrees.
5
numberoptional, default value=360
Maximum bearing of target position in degrees.
Returns:
vectortarget position
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 143
-
get_furthest(vectorsource position, tableposition collection) -
Takes a subject vector and a table of vectors/units/sunits/buildings (or a scriptunits collection). Returns the index of the vector in the table/collection which is furthest from the subject vector.
Parameters:
1
vectorsource position
2
tableTable of vector/unit/sunit/building objects, or a scriptunits collection
Returns:
integerindex of furthest object in list
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 274
-
get_nearest(vectorsource position, tableposition collection) -
Takes a subject vector and a table of vectors/units/sunits/buildings (or a scriptunits collection). Returns the index of the vector in the table/collection which is closest to the subject vector.
Parameters:
1
vectorsource position
2
tableTable of vector/unit/sunit/building objects, or a scriptunits collection
Returns:
integerindex of closest object in list
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 284
-
position_along_line(vectorfirst position, vectorsecond position, numberdistance) -
Takes two vector positions as parameters and a distance in metres, and returns a position which is that distance from the first vector in the direction of the second vector.
Parameters:
1
vectorfirst position
2
vectorsecond position
3
numberdistance
Returns:
vectortarget position
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 294
-
dot(vectorfirst position, vectorsecond position) -
Returns the dot product of two supplied vectors.
Parameters:
1
vectorfirst position
2
vectorsecond position
Returns:
numberdot product
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 318
-
dot3d(vectorfirst position, vectorsecond position) -
Returns the dot product of two supplied vectors in three dimensions.
Parameters:
1
vectorfirst position
2
vectorsecond position
Returns:
numberdot product
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 328
-
normal(vectorfirst position, vectorsecond position) -
Returns the normal vector of two supplied vectors.
Parameters:
1
vectorfirst position
2
vectorsecond position
Returns:
vectornormal
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 338
-
distance_to_line(vectorline position a, vectorline position b, vectortarget position) -
Takes two vector positions that describe a 2D line of infinite length, and a target vector position. Returns the distance from the line to the target vector.
Parameters:
1
vectorline position a
2
vectorline position b
3
vectortarget position
Returns:
numberdistance
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 348
-
has_crossed_line(position collection
object,line position a
vector,line position b
vector,standing only
boolean
) -
Takes a vector, unit, scriptunit or collection of objects and returns true if any element within it has crossed a line demarked by two supplied vector positions.
An optional fourth parameter instructshas_crossed_lineto only consider the positions of non-routing units, if set to true.
An object is deemed to have 'crossed' the line if it's on the right-hand side of the line.Parameters:
1
objectCollection of position objects to test. Supported collection object types are scriptunits, units, army, armies, alliance or a numerically-indexed table of any supported objects.
2
vectorline position a
3
vectorline position b
4
booleanDo not count positions of any routing or dead units
Returns:
booleanhas crossed line
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 376
-
distance_along_line(vectorline position a, vectorline position b, numberdistance) -
Takes two vectors that describe a 3D line of infinite length, and a numeric distance in metres. Returns a position along the line that is the supplied distance from the first supplied position.
Parameters:
1
vectorline position a
2
vectorline position b
3
numberdistance
Returns:
vectorposition along line
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_convex_area.lua, line 470
-
new_sfx(stringsound event) -
A shorthand method for creating a sound effect object.
Parameters:
1
stringName of sound event
Returns:
battle_sound_effect
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 43
-
play_sound(vectorposition, battle_sound_effectsound effect) -
Plays a sound effect at a position.
Parameters:
1
vectorposition
2
battle_sound_effectsound effect
Returns:
nil
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 60
-
play_sound_2D(battle_sound_effectsound effect) -
Plays a sound effect. Sound will play at normal volume and will not appear to come from a position in 3D space.
Parameters:
1
battle_sound_effectsound effect
Returns:
nil
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 80
-
stop_sound(battle_sound_effectsound effect) -
Stops a sound, if it's playing.
Parameters:
1
battle_sound_effectsound effect
Returns:
nil
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 93
-
create_unitcontroller(armyhost army, ...list of units) -
Shorthand method for creating a unitcontroller. Supply a host army, along with zero or more units belonging to the same army that will be placed within the unitcontroller
Parameters:
1
armyhost army
2
...list of units
Returns:
unitcontroller
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 111
-
unitcontroller_from_army(armyhost army) -
Creates a unitcontroller from a supplied army, containing all the units within that army.
Parameters:
1
armyhost army
Returns:
unitcontroller
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 140
-
is_routing_or_dead(objectcollection to test, [booleanshattered only], [booleanpermit rampaging]) -
Returns true if all units in the supplied object/collection are routing or dead.
Parameters:
1
objectObject or collection to test. Supported objects/collections are unit, scriptunit, scriptunits, units, army, armies, alliance or a table containing any of the above.
2
booleanoptional, default value=false
Only count shattered units
3
booleanoptional, default value=false
Don't automatically count rampaging units, check if they are actually routing too.
Returns:
booleanall units routing or dead
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 180
-
is_shattered_or_dead(objectcollection to test, [booleanpermit rampaging]) -
Alias for
is_routing_or_dead(obj, true, permit_rampaging). Returns true if all units in the supplied object/collection are shattered or dead.Parameters:
1
objectObject or collection to test. Supported objects/collections are unit, scriptunit, scriptunits, units, army, armies, alliance or a table containing any of the above.
2
booleanoptional, default value=false
Don't automatically count rampaging units, check if they are actually shattered too.
Returns:
booleanall units shattered or dead
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 273
-
num_units_routing(objectcollection to test, [booleanshattered only], [booleanpermit rampaging]) -
Returns the number of units in the supplied collection that are routing or dead.
The second parameter, if true, instructsnum_units_routingto only count those units that are shattered or dead. The third parameter, if true, instructs the function to not automatically count rampaging units - they have to be actually routing as well.Parameters:
1
objectObject or collection to test. Supported objects/collections are units, scriptunits, army, armies, alliance or a table containing any of the above, or units/scriptunits.
2
booleanoptional, default value=false
Only count shattered units
3
booleanoptional, default value=false
Don't automatically count rampaging units, check if they are actually routing too.
Returns:
integernumber of routing or dead units
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 283
-
num_units_shattered(objectcollection to test, [booleanpermit rampaging]) -
Alias of
num_units_routing(obj, true, permit_rampaging). Returns the number of units in the supplied collection that are shattered or dead. Supported collections are units, scriptunits, army, armies, alliance or a table containing any of the above, or units/scriptunits.
The second parameter, if true, instructsnum_units_shatteredto not automatically count those units that are rampaging.Parameters:
1
objectObject or collection to test. Supported objects/collections are units, scriptunits, army, armies, alliance or a table containing any of the above, or units/scriptunits.
2
booleanoptional, default value=false
Don't automatically count rampaging units, check if they are actually routing too.
Returns:
integernumber of shattered or dead units
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 363
-
num_units_engaged(objectcollection to test) -
Returns the number of units in the supplied collection which are currently engaged in melee.
Parameters:
1
objectCollection to test. Supported collection types are units, scriptunits, army, armies, alliance and table.
Returns:
numberof units engaged in melee
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 374
-
num_units_under_fire(objectcollection to test) -
Returns the number of units in the supplied collection which are currently under missile fire.
Parameters:
1
objectCollection to test. Supported collection types are units, scriptunits, army, armies, alliance and table.
Returns:
numberof units under fire
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 423
-
rout_all_units(objectcollection of units) -
Instantly rout all units in the supplied collection.
Parameters:
1
objectCollection of units to rout. Supported collection types are scriptunits, army, armies, alliance and table.
Returns:
nil
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 472
-
number_close_to_position(collection of units
object,position
vector,range in m
number,2D only
boolean,non-routing only
boolean
) -
Returns the number of units or sunits in a supplied collection within a given range of a given position.
Parameters:
1
objectCollection of units. Supported collection types are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
numberrange in m
4
booleanConsider 2 dimensional distance only. If true, then
number_close_to_positiondisregards height differences in its distance calculation.5
booleanDisregard routing or dead units from inclusion in the result.
Returns:
integernumber within range of position
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 537
-
standing_number_close_to_position(collection of units
object,position
vector,range in m
number,2D only
boolean
) -
Alias of
number_close_to_position(obj, pos, range, two_d, true). Returns the number of non-routing units or sunits in a supplied collection within a given range of a given position.Parameters:
1
objectCollection of units. Supported collection types are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
numberrange in m
4
booleanConsider 2 dimensional distance only. If true, then
standing_number_close_to_positiondisregards height differences in its distance calculation.Returns:
integernumber within range of position
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 704
-
is_close_to_position(collection of units
object,position
vector,range in m
number,2D only
boolean,non-routing only
boolean
) -
Returns true if any units or sunits in a supplied collection are within a given range of a given position, false otherwise.
Parameters:
1
objectCollection of units. Supported container types are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
numberrange in m
4
booleanConsider 2 dimensional distance only. If true, then
is_close_to_positiondisregards height differences in its distance calculation.5
booleanDisregard routing or dead units from inclusion in the result.
Returns:
integernumber within range of position
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 716
-
standing_is_close_to_position(objectcollection of units, vectorposition, numberrange in m, boolean2D only) -
Alias of
is_close_to_position(obj, pos, range, two_d, true). Returns true if any non-routing units or sunits in a supplied collection are within a given range of a given position, false otherwise. The 2D only flag instructs the function to disregard height differences in its distance calculation.Parameters:
1
objectCollection of units. Supported container types are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
numberrange in m
4
booleanConsider 2 dimensional distance only. If true, then
standing_is_close_to_positiondisregards height differences in its distance calculation.Returns:
integernumber within range of position
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 729
-
distance_between_forces(first collection
object,second collection
object,non-routing only
[boolean],number Closest distance in m between forces
return,obj Closest ojbect from first supplied force
return,obj Closest ojbect from second supplied force
return
) -
Returns the closest distance between two collections of units. Supported collections are scriptunits, units, army, armies, alliance and table of unit, scriptunit or any of the above object types.
The function will also return the objects in both collections that are closest to one another. These will bescript_unitobjects, if available, otherwise they will beunitobjects.Parameters:
1
objectfirst collection
2
objectsecond collection
3
booleanoptional, default value=false
Disregard routing or dead units from inclusion in the result.
4
returnnumber Closest distance in m between forces
5
returna
script_unitor aunit6
returna
script_unitor aunitReturns:
nil
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 741
-
get_closest_unit(unit collection
object,position
vector,non-routing only
[boolean],additional test
[function]
) -
Returns the closest unit in the supplied container to a supplied position, as well as its distance to that position. If the supplied collection is a scriptunits object, the closest scriptunit is also returned as the third return parameter (the scriptunit that contains the closest unit).
Parameters:
1
objectUnit collection. Supported types are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
booleanoptional, default value=false
Disregard routing or dead units from inclusion in the result.
4
functionoptional, default value=nil
Additional test to perform on each candidate unit, which must be passed in order to count the subject unit towards the result. This must be supplied in the form of a function block which takes a unit as a parameter and returns a boolean result.
If this function returns true when called, or a result that evaluates to true, then the subject unit can be considered for inclusion in the result.
Returns:
unitclosest unitnumberdistance of closest unitscriptunitclosest scriptunit if applicable, nil if not
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 861
-
get_closest_standing_unit(objectunit collection, vectorposition, [functionadditional test]) -
Alias of
get_closest_unit(obj, pos, true, test). Returns the closest unit in the supplied container to a supplied position, and its distance to that position.
The third parameter allows the calling script to specify an additional test which must be passed in order to count the subject unit towards the result. This must be in the form of a function block which takes a unit as a parameter and returns a boolean result.Parameters:
1
objectUnit collection. Supported containers are scriptunits, units, army, armies, alliance and table.
2
vectorposition
3
functionoptional, default value=nil
Additional test to perform on each candidate unit, which must be passed in order to count the subject unit towards the result. This must be supplied in the form of a function block which takes a unit as a parameter and returns a boolean result.
If this function returns true when called, or a result that evaluates to true, then the subject unit can be considered for inclusion in the result.
Returns:
unitclosest unitnumberdistance of closest unitscriptunitclosest scriptunit if applicable, nil if not
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 991
-
get_average_altitude(objectunit collection) -
Returns the average altitude in m and the total number of units in the supplied collection.
Parameters:
1
objectunit collection
Returns:
numberaverage altitude in mintegernumber of units in collection
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1020
-
num_units_in_collection(objectcollection to test) -
Returns the number of units in the supplied collection.
Parameters:
1
objectCollection to test. Supported collection types are units, scriptunits, army, armies, alliance and table.
Returns:
numberof units in collection
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1103
-
contains_unit(objectcollection to test, unitsubject unit) -
Returns true is the supplied container contains the supplied unit, otherwise returns false.
Parameters:
1
objectCollection to test. Supported containers are scriptunits, units, army, armies, alliance and table.
2
unitsubject unit
Returns:
booleancollection contains unit
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1139
-
num_units_passing_test(objectcollection to test, functiontest function) -
Returns the number of units in the supplied collection that pass a supplied test, as well as the total number of units. The test must be supplied in the form of a function that takes a unit parameter and returns a boolean result.
Parameters:
1
objectCollection to test. Supported collection object types are units, scriptunits, army, armies, alliance and table.
2
functiontest function
Returns:
integernumber of passing unitsintegertotal number of units
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1217
-
get_all_matching_units(objectcollection to test, functiontest function) -
Returns a table containing all units in the supplied collection that pass a supplied test.
Parameters:
1
objectCollection to test. Supported collection object types are units, scriptunits, army, armies, alliance and table.
2
functionTest function. The test must be supplied in the form of a function that takes a unit parameter and returns a boolean result. If the boolean result is true, or evaluates to true, the unit is added to the result.
Returns:
tabletable containing passing units
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1289
-
number_alive(objectcollection to test) -
Returns the number of soldiers in a collection that are alive, as well as the initial number of soldiers that collection started with.
Parameters:
1
objectCollection to test. Supported collections are alliance, armies, army, units, unit, scriptunit, scriptunits and table.
Returns:
integernumber of soldiers currently aliveintegerinitial number of soldiers
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1350
-
is_visible(objectcollection to test, alliancealliance) -
Returns true if any part of the supplied collection object is visible to the supplied alliance by the rules of the visibility system.
Parameters:
1
objectCollection to test.
2
alliancealliance
Returns:
booleanvisibility result
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1418
-
has_deployed(objectcollection to test) -
Returns true if all units in the supplied collection object are valid targets and are not routing or dead, and are therefore considered to be deployed. Supported objects are unit, scriptunit, units, scriptunits, army, armies and table.
Parameters:
1
objectCollection to test. Supported collection objects are unit, units, army, armies, scriptunit, scriptunits and table.
Returns:
booleanare all deployed
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_misc.lua, line 1472
-
scriptunits_from_army(stringname, army,Subject army.) -
Method of automatically deriving a
script_unitscollection from an army. Eachscript_unitobject is created automatically.Parameters:
1
stringName for this scriptunits collection.
2
army,Subject army.
Returns:
script_units
Loaded in Battle
defined in ../working_data/script/_lib/lib_battle_script_unit.lua, line 1712
A handful of sound-related functions in battle require a volume type to be specified when they are called. The values described below represent those volume types. They can be passed into functions such as battle:set_volume and battle:get_volume to specify a volume type.
Variables in this section:
| VOLUME_TYPE_MUSIC | @number |
Volume type representing music, that can be used with sound-related functions. Value is 0.
|
| VOLUME_TYPE_SFX | @number |
Volume type representing sfx, that can be used with sound-related functions. Value is 1.
|
| VOLUME_TYPE_ADVISOR | @number |
Volume type representing advisor sounds, that can be used with sound-related functions. Value is 2.
|
| VOLUME_TYPE_VO | @number |
Volume type representing voiceover sounds, that can be used with sound-related functions. Value is 3.
|
| VOLUME_TYPE_INTERFACE | @number |
Volume type representing user interface sounds, that can be used with sound-related functions. Value is 4.
|
| VOLUME_TYPE_MOVIE | @number |
Volume type representing movie sounds, that can be used with sound-related functions. Value is 5.
|
| VOLUME_TYPE_VOICE_CHAT | @number |
Volume type representing voice chat audio, that can be used with sound-related functions. Value is 6.
|
| VOLUME_TYPE_MASTER | @number |
Volume type representing the master volume level, that can be used with sound-related functions. Value is 7.
|
These variables are also listed in the global variables list for this class or module.
-
r_to_d(numberangle) -
Converts a supplied angle in radians to degrees.
Parameters:
1
numberAngle in radians
Returns:
numberangle in degrees
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 35
-
d_to_r(numberangle) -
Converts a supplied angle in degrees to radians.
Parameters:
1
numberAngle in degrees
Returns:
numberangle in radians
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 48
Functions to help get the filename and path of the calling script.
-
get_file_and_folder_path_as_table([integerstack offset]) -
Returns the file and path of the calling script as a table of strings.
Parameters:
1
integeroptional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file and folder path of the script file calling the the script file calling this function, for example.
Returns:
tabletable of strings
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 73
-
get_folder_name_and_shortform([integerstack offset]) -
Returns the folder name of the calling file and the shortform of its filename as separate return parameters. The shortform of the filename is the portion of the filename before the first "_", if one is found. If no shortform is found the function returns only the folder name.
A shortform used to be prepended on battle script files to allow them to be easily differentiated from one another in text editors e.g. "TF_battle_main.lua" vs "PY_battle_main.lua" rather than two "battle_main.lua"'s.Parameters:
1
integeroptional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the folder name/shortform of the script file calling the the script file calling this function, for example.
Returns:
stringname of folder containing calling filestringshortform of calling filename, if any
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 136
-
get_full_file_path([integerstack offset]) -
Gets the full filepath and name of the calling file.
Parameters:
1
integeroptional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file path of the script file calling the the script file calling this function, for example.
Returns:
stringfile path
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 174
-
get_file_name_and_path([integerstack offset]) -
Returns the filename and the filepath of the calling file as separate return parameters.
Parameters:
1
integeroptional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file name and path of the script file calling the the script file calling this function, for example.
Returns:
stringfile namestringfile path
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 190
-
is_nil(objectobject) -
Returns true if the supplied object is nil, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 264
-
is_number(objectobject) -
Returns true if the supplied object is a number, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis number
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 277
-
is_function(objectobject) -
Returns true if the supplied object is a function, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis function
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 290
-
is_string(objectobject) -
Returns true if the supplied object is a string, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis string
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 303
-
is_boolean(objectobject) -
Returns true if the supplied object is a boolean, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis boolean
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 316
-
is_table(objectobject) -
Returns true if the supplied object is a table, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis table
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 329
-
is_eventcontext(objectobject) -
Returns true if the supplied object is an event context, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis event context
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 342
-
is_battlesoundeffect(objectobject) -
Returns true if the supplied object is a battle sound effect, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis battle sound effect
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 355
-
is_battle(objectobject) -
Returns true if the supplied object is an empire battle object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis battle
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 368
-
is_alliances(objectobject) -
Returns true if the supplied object is an alliances object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis alliances
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 381
-
is_alliance(objectobject) -
Returns true if the supplied object is an alliance, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis alliance
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 394
-
is_armies(objectobject) -
Returns true if the supplied object is an armies object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis armies
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 407
-
is_army(objectobject) -
Returns true if the supplied object is an army object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis army
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 420
-
is_units(objectobject) -
Returns true if the supplied object is a units object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis units
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 433
-
is_unit(objectobject) -
Returns true if the supplied object is a unit object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis unit
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 445
-
is_unitcontroller(objectobject) -
Returns true if the supplied object is a unitcontroller, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis unitcontroller
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 458
-
is_core(objectobject) -
Returns true if the supplied object is a
coreobject, false otherwise.Parameters:
1
objectobject
Returns:
booleanis core
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 471
-
is_battlemanager(objectobject) -
Returns true if the supplied object is a
battle_manager, false otherwise.Parameters:
1
objectobject
Returns:
booleanis battle manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 484
-
is_campaignmanager(objectobject) -
Returns true if the supplied object is a campaign manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis campaign manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 497
-
is_factionstart(objectobject) -
Returns true if the supplied object is a faction start object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis faction start
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 510
-
is_campaigncutscene(objectobject) -
Returns true if the supplied object is a campaign cutscene, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis campaign cutscene
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 523
-
is_cutscene(objectobject) -
Returns true if the supplied object is a battle cutscene, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis cutscene
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 536
-
is_vector(objectobject) -
Returns true if the supplied object is a vector object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis vector
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 549
-
is_building(objectobject) -
Returns true if the supplied object is a building object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis building
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 563
-
is_buildings(objectobject) -
Returns true if the supplied object is a buildings object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis buildings
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 577
-
is_buildinglist(objectobject) -
Returns true if the supplied object is a building list object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis building list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 591
-
is_convexarea(objectobject) -
Returns true if the supplied object is a
convex_area, false otherwise.Parameters:
1
objectobject
Returns:
booleanis convex area
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 604
-
is_scriptunit(objectobject) -
Returns true if the supplied object is a
script_unit, false otherwise.Parameters:
1
objectobject
Returns:
booleanis scriptunit
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 617
-
is_scriptunits(objectobject) -
Returns true if the supplied object is a
script_unitsobject, false otherwise.Parameters:
1
objectobject
Returns:
booleanis scriptunits
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 630
-
is_subtitles(objectobject) -
Returns true if the supplied object is a battle subtitles object, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis subtitles
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 643
-
is_patrolmanager(objectobject) -
Returns true if the supplied object is a patrol manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis patrol manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 656
-
is_waypoint(objectobject) -
Returns true if the supplied object is a patrol manager waypoint, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis waypoint
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 669
-
is_eventhandler(objectobject) -
Returns true if the supplied object is an event handler, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis event handler
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 682
-
is_scriptaiplanner(objectobject) -
Returns true if the supplied object is a script ai planner, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis script ai planner
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 695
-
is_timermanager(objectobject) -
Returns true if the supplied object is a timer manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis timer manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 708
-
is_uioverride(objectobject) -
Returns true if the supplied object is a ui override, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis ui override
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 721
-
is_uicomponent(objectobject) -
Returns true if the supplied object is a uicomponent, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis uicomponent
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 734
-
is_component(objectobject) -
Returns true if the supplied object is a component, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis component
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 747
-
is_scriptmessager(objectobject) -
Returns true if the supplied object is a script messager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis script messager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 760
-
is_generatedbattle(objectobject) -
Returns true if the supplied object is a generated battle, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis generated battle
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 773
-
is_generatedarmy(objectobject) -
Returns true if the supplied object is a generated army, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis generated army
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 786
-
is_generatedcutscene(objectobject) -
Returns true if the supplied object is a generated cutscene, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis generated cutscene
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 799
-
is_null(objectobject) -
Returns true if the supplied object is a campaign null script interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis null
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 812
-
is_model(objectobject) -
Returns true if the supplied object is a campaign model interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis model
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 825
-
is_world(objectobject) -
Returns true if the supplied object is a campaign world interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis world
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 838
-
is_faction(objectobject) -
Returns true if the supplied object is a campaign faction interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis faction
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 851
-
is_factionlist(objectobject) -
Returns true if the supplied object is a campaign faction list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis faction list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 864
-
is_character(objectobject) -
Returns true if the supplied object is a campaign character interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis character
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 877
-
is_characterlist(objectobject) -
Returns true if the supplied object is a campaign character list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis character list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 890
-
is_regionmanager(objectobject) -
Returns true if the supplied object is a campaign region manager interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis region manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 903
-
is_region(objectobject) -
Returns true if the supplied object is a campaign region interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis region
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 916
-
is_regionlist(objectobject) -
Returns true if the supplied object is a campaign region list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis region list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 929
-
is_garrisonresidence(objectobject) -
Returns true if the supplied object is a campaign garrison residence interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis garrison residence
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 942
-
is_settlement(objectobject) -
Returns true if the supplied object is a campaign settlement interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis settlement
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 955
-
is_slot(objectobject) -
Returns true if the supplied object is a campaign slot interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis slot
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 968
-
is_slotlist(objectobject) -
Returns true if the supplied object is a campaign slot list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis slot list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 981
-
is_militaryforce(objectobject) -
Returns true if the supplied object is a campaign military force interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis military force
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 994
-
is_militaryforcelist(objectobject) -
Returns true if the supplied object is a campaign military force list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis military force list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1007
-
is_unitlist(objectobject) -
Returns true if the supplied object is a campaign unit list interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis unit list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1020
-
is_pendingbattle(objectobject) -
Returns true if the supplied object is a campaign pending battle interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis pending battle
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1033
-
is_campaignmission(objectobject) -
Returns true if the supplied object is a campaign mission interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis campaign mission
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1046
-
is_campaignai(objectobject) -
Returns true if the supplied object is a campaign ai interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis campaign ai
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1059
-
is_god(objectobject) -
Returns true if the supplied object is a god faction interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis god
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1072
-
is_godlist(objectobject) -
Returns true if the supplied object is a god list faction interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis god list
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1085
-
is_godmanager(objectobject) -
Returns true if the supplied object is a god manager faction interface, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis god manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1098
-
is_campaignuimanager(objectobject) -
Returns true if the supplied object is a campaign ui manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis campaign ui manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1111
-
is_objectivesmanager(objectobject) -
Returns true if the supplied object is an
objectives_manager, false otherwise.Parameters:
1
objectobject
Returns:
booleanis objectives manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1124
-
is_infotextmanager(objectobject) -
Returns true if the supplied object is an
infotext_manager, false otherwise.Parameters:
1
objectobject
Returns:
booleanis infotext manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1137
-
is_missionmanager(objectobject) -
Returns true if the supplied object is a mission manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis text pointer
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1150
-
is_intervention(objectobject) -
Returns true if the supplied object is an intervention, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis intervention
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1163
-
is_interventionmanager(objectobject) -
Returns true if the supplied object is an intervention manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis intervention manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1176
-
is_linkparser(objectobject) -
Returns true if the supplied object is a link parser, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis link parser
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1189
-
is_advicemanager(objectobject) -
Returns true if the supplied object is an advice manager, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis advice manager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1202
-
is_advicemonitor(objectobject) -
Returns true if the supplied object is an advice monitor, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis advice monitor
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1215
-
is_scriptedtour(objectobject) -
Returns true if the supplied object is a scripted tour, false otherwise.
Parameters:
1
objectobject
Returns:
booleanis scripted tour
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1228
-
table_find(tablesubject table, objector function find, [booleanIf set to true and an object is found]) -
Returns the first occurance of the provided object, if find is not a function, or the first object for which find returns a true value if find is a function. Returns nil otherwise.
Parameters:
1
tablesubject table
2
objector function find
3
booleanoptional, default value=false
return its index instead of the object
Returns:
objector nil the first occurance or satisfying ojbect in the table
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1395
-
table_contains(tablesubject table, objectobject) -
Returns true if the supplied indexed table contains the supplied object.
Parameters:
1
tablesubject table
2
objectobject
Returns:
booleantable contains object
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1412
-
table_append(destinationdestination table, sourcesource table) -
Append the contents of the indexed table destination with the contents of the index table source.
Parameters:
1
destinationdestination table
2
sourcesource table
Returns:
destinationtable
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1427
-
table_erase(tablesubject table, objectobject) -
Erase from the indexed table the supplied element. Returns true if the table contains the object and it was erased.
Parameters:
1
tablesubject table
2
objectobject
Returns:
booleantable contained object
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1440
-
table_erase_if(tablesubject table, filterfilter function) -
Erase from the indexed table all elements that fullfil the supplied predicate. Returns true if any elements were removed.
Parameters:
1
tablesubject table
2
filterfilter function
Returns:
booleantable contained elements that fullfilled the filter
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1456
-
table_add_unique(tablesubject table, objectobject) -
Add to the end of the indexed table the supplied element, but only if it did not already exist inside it. Returns true if the table did not contain the object and it was added.
Parameters:
1
tablesubject table
2
objectobject
Returns:
booleantable did not contain object
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1475
-
table_stable_sort(subject table
table,comparison function
comp,A flag whether the operation should be done in-place. Slower than to simply assign to the result
[in_place]
) -
Stable sort the contents of the indexed table using the provided comp function. A very simple and inefficient not-in-place way to do this, but probably OK for small tables.
Parameters:
1
tablesubject table
2
compcomparison function
3
in_placeoptional, default value=false
but could be useful if working with a passed as a parameter table.
Returns:
sortedtable
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1491
-
table_accumulate(tablesubject table, objinitial value, [opoperator function]) -
Accumulate the contents of the indexed table using the provided op function or + if no function is provided.
Parameters:
1
tablesubject table
2
objinitial value
3
opoptional, default value=+
taking as first argument the so far accumulated value and as second argument the next element of the table. If not provided, + is used
Returns:
accumulatedvalue of the table
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1537
-
table_read_only(tablesubject table) -
Prevents to edit a table
Parameters:
1
tablesubject table
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1557
-
find_child_uicomponent(uicomponentparent ui component, stringname) -
Takes a uicomponent and a string name. Searches the direct children (and no further - not grandchildren etc) of the supplied uicomponent for another uicomponent with the supplied name. If a uicomponent with the matching name is found then it is returned, otherwise
falseis returned.Parameters:
1
uicomponentparent ui component
2
stringname
Returns:
uicomponentchild, or false if not found
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1578
-
find_uicomponent([parent ui componentuicomponent], ...list of string names) -
Finds and returns a uicomponent based on a set of strings that define its path in the ui hierarchy. This parent uicomponent can be supplied as the first argument - if omitted, the root uicomponent is used. Starting from the parent or root, the function searches through all descendants for a uicomponent with the next supplied uicomponent name in the sequence. If a uicomponent is found, its descendants are then searched for a uicomponent with the next name in the list, and so on until the list is finished or no uicomponent with the supplied name is found. A fragmentary path may be supplied if it still unambiguously specifies the intended uicomponent.
Parameters:
1
optional, default value=nil
parent ui component
2
...list of string names
Returns:
uicomponentchild, or false if not found.
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1617
-
find_uicomponent_from_table(parent ui component
uicomponent,table of string names
table,on failure
[assert]
) -
Takes a start uicomponent and a numerically-indexed table of string uicomponent names. Starting from the supplied start uicomponent, the function searches through all descendants for a uicomponent with the next supplied uicomponent name in the table. If a uicomponent is found, its descendants are then searched for a uicomponent with the next name in the list, and so on until the list is finished or no uicomponent with the supplied name is found. This allows a uicomponent to be searched for by matching its name and part of or all of its path.
Parameters:
1
uicomponentParent uicomponent.
2
tableTable of string names, indexed by number.
3
assertoptional, default value=false
Fire a script error if the search fails.
Returns:
uicomponentchild, or false if not found.
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1647
-
uicomponent_descended_from(uicomponentsubject uic, stringparent name) -
Takes a uicomponent and a string name. Returns true if any parent ancestor component all the way up to the ui root has the supplied name (i.e. the supplied component is descended from it), false otherwise.
Parameters:
1
uicomponentsubject uic
2
stringparent name
Returns:
booleanuic is descended from a component with the supplied name.
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1685
-
uicomponent_find_up(uicomponentsubject uic, stringparent name) -
Takes a uicomponent and a string name or a function. Returns the component all the way up to the ui root who has the supplied name or matches the function, nil otherwise.
Parameters:
1
uicomponentsubject uic
2
stringparent name
Returns:
booleanuic is descended from a component with the supplied name.
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1725
-
uicomponent_find_down(uicomponentsubject uic, stringparent name) -
Takes a uicomponent and a string name or a function. Returns the component all the way up to the ui root who has the supplied name or matches the function, nil otherwise.
Parameters:
1
uicomponentsubject uic
2
stringparent name
Returns:
booleanuic is descended from a component with the supplied name.
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1765
-
uicomponent_to_str(uicomponentsubject uic) -
Converts a uicomponent to a string showing its path, for output purposes.
Parameters:
1
uicomponentsubject uic
Returns:
stringoutput
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1800
-
output_uicomponent(uicomponentsubject uic, [booleanomit children]) -
Outputs extensive debug information about a supplied uicomponent to the console.
Parameters:
1
uicomponentSubject uicomponent.
2
booleanoptional, default value=false
Do not show information about the uicomponent's children.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1824
-
output_uicomponent_on_click() -
Starts a listener which outputs information to the console about every uicomponent that's clicked on.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1914
-
print_all_uicomponent_children(uicomponentsubject uic) -
Prints the name and path of the supplied uicomponent and all its descendents. Very verbose, and can take a number of seconds to complete.
Parameters:
1
uicomponentSubject uicomponent.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1929
-
pulse_uicomponent(ui component
uicomponent,should pulse
boolean,brightness
[number],progagate
[boolean],state name
[string]
) -
Activates or deactivates a pulsing highlight effect on the supplied uicomponent. This is primarily used for scripts which activate when the player moves the mouse cursor over certain words in the help pages, to indicate to the player what UI feature is being talked about on the page.
Parameters:
1
uicomponentSubject ui component.
2
booleanSet to
trueto activate the pulsing effect,falseto deactivate it.3
numberoptional, default value=0
Pulse brightness. Set a higher number for a more pronounced pulsing effect.
4
booleanoptional, default value=false
Propagate the effect through the component's children. Use this with care, as the visual effect can stack and often it's better to activate the effect on specific uicomponents instead of activating this.
5
stringoptional, default value=nil
Optional state name to affect. If a string name is supplied, the pulsing effect is only applied to the specified state instead of to all states on the component.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1941
-
is_fully_onscreen(uicomponentuicomponent) -
Returns true if the uicomponent is fully on-screen, false otherwise.
Parameters:
1
uicomponent
Returns:
is onscreenboolean
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1980
-
is_partially_onscreen(uicomponentuicomponent) -
Returns true if the uicomponent is partially on-screen, false otherwise.
Parameters:
1
uicomponent
Returns:
is onscreenboolean
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 1996
-
set_component_visible(booleanset visible, ...list of string names) -
Sets a uicomponent visible or invisible by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanset visible
2
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2014
-
set_component_visible_with_parent(set visible
boolean,parent uicomponent
uicomponent,list of string names
...
) -
Sets a uicomponent visible or invisible by its path. The path should be one or more strings which when sequentially searched for from a supplied uicomponent parent lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanset visible
2
uicomponentparent uicomponent
3
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2035
-
set_component_active(booleanset active, ...list of string names) -
Sets a uicomponent to be active or inactive by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanset active
2
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2055
-
set_component_active_with_parent(set active
boolean,parent uicomponent
uicomponent,list of string names
...
) -
Sets a uicomponent to be active or inactive by its path. The path should be one or more strings which when sequentially searched for from a supplied uicomponent parent lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanset active
2
uicomponentparent uicomponent
3
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2076
-
highlight_component(booleanactivate highlight, booleanis square, ...list of string names) -
Highlights or unhighlights a uicomponent by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanSet
trueto activate the highlight,falseto deactivate.2
booleanSet to
trueif the target uicomponent is square,falseif it's circular.3
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2111
-
highlight_visible_component(booleanactivate highlight, booleanis square, ...list of string names) -
Highlights or unhighlights a uicomponent by its path, but only if it's visible. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
booleanSet
trueto activate the highlight,falseto deactivate.2
booleanSet to
trueif the target uicomponent is square,falseif it's circular.3
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2121
-
highlight_all_visible_children(uicomponentparent, [numbervisual padding]) -
Draws a box highlight around all visible children of the supplied uicomponent. A padding value in pixels may also be supplied to increase the visual space between the highlight and the components being highlighted.
Parameters:
1
uicomponentparent
2
numberoptional, default value=0
visual padding
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2145
-
unhighlight_all_visible_children() -
Cancels any and all highlights created with
highlight_all_visible_children.Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2172
-
highlight_component_table(numbervisual padding, ...uicomponents) -
Draws a box highlight stretching around the supplied list of components. A padding value in pixels may also be supplied to increase the visual space between the highlight and the components being highlighted.
Parameters:
1
numberVisual padding in pixels.
2
...Variable number of uicomponents to draw highlight over.
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2179
-
unhighlight_component_table() -
Cancels any and all highlights created with
highlight_component_table.Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2269
-
play_component_animation(stringanimation name, ...list of string names) -
Plays a specified component animation on a uicomponent by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table, which performs the search).Parameters:
1
stringanimation name
2
...list of string names
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2276
-
uicomponent_has_parent_filter(uicomponentuicomponent,filterfunction) -
Returns
trueif the supplied uicomponent has a parent or ancestor that matches the supplied filter, orfalseotherwise. The filter should be a function that accepts a uicomponent as a single argument and returnstrueorfalsedepending on whether the uicomponent passes the filter. The first matching ancestor is also returned.Parameters:
1
uicomponent
2
filter
Returns:
uic parent passes filterbooleanfirst matching ancestoruicomponent
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2290
-
create_confirmation_box(id of the uicomponent that is going to be created
string,localisation_key
string,on_accept_callback
[function],on_cancel_callback
[function]
) -
Creates confirmation box component with the specified id, text and accept / cancel callbacks
Parameters:
1
stringid of the uicomponent that is going to be created
2
stringlocalisation_key
3
functionoptional, default value=nil
on_accept_callback
4
functionoptional, default value=nil
on_cancel_callback
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2313
-
create_confirmation_box_with_text_from_script(id of the uicomponent that is going to be created
string,text Localised text constructed in lua
string,text_source Source of the localised text
string,on_accept_callback
[function],on_cancel_callback
[function]
) -
Creates confirmation box component with the specified id, localised_text constructed in the scripts and accept / cancel callbacks
Parameters:
1
stringid of the uicomponent that is going to be created
2
stringtext Localised text constructed in lua
3
stringtext_source Source of the localised text
4
functionoptional, default value=nil
on_accept_callback
5
functionoptional, default value=nil
on_cancel_callback
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2326
-
get_advisor_progress_button() -
Returns the advisor progress/close button uicomponent.
Returns:
uicomponent
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2438
-
show_advisor_progress_button([booleanshow button]) -
Makes active / inactive the advisor progress/close button.
Parameters:
1
booleanoptional, default value=true
show button
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2462
-
highlight_advisor_progress_button([booleanshow button]) -
Activates or deactivates a highlight on the advisor progress/close button.
Parameters:
1
booleanoptional, default value=true
show button
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_common.lua, line 2481
-
get_infotext_manager() -
Gets an infotext manager, or creates one if one doesn't already exist.
Returns:
infotext_manager
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_infotext.lua, line 85
-
get_objectives_manager() -
Gets an objectives manager, or creates one if one doesn't already exist.
Returns:
objectives_manager
Loaded in Battle
Loaded in Campaign
defined in ../working_data/script/_lib/lib_objectives.lua, line 64
-
get_messager() -
Gets or creates a
script_messagerobject.Returns:
script_messager
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_script_messager.lua, line 10
-
get_tm() -
Gets or creates a
timer_manager.Returns:
timermanager
Loaded in Battle
Loaded in Frontend
defined in ../working_data/script/_lib/lib_timer_manager.lua, line 126
-
ModLog(output textstring) -
Writes output to the
lua_mod_log.txttext file, and also to the development console.Parameters:
1
output text
Returns:
nil
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../working_data/script/_lib/lib_mod_loader.lua, line 34
-
UIComponent(addresscomponent address) -
Casts a component memory address, returned by several functions such as
uicomponent:Find, into a validuicomponentscript object so that functions in theuicomponentscript interface may be called on it.
This function is provided by the UI code.Parameters:
1
addresscomponent address
Returns:
uicomponent
Loaded in Battle
Loaded in Campaign
Loaded in Frontend
defined in ../../common/UiComponentLib/Source/LuaComponentInterface.cpp, line 487
All variables provided by global
| VOLUME_TYPE_MUSIC | @number |
Volume type representing music, that can be used with sound-related functions. Value is 0.
|
| VOLUME_TYPE_SFX | @number |
Volume type representing sfx, that can be used with sound-related functions. Value is 1.
|
| VOLUME_TYPE_ADVISOR | @number |
Volume type representing advisor sounds, that can be used with sound-related functions. Value is 2.
|
| VOLUME_TYPE_VO | @number |
Volume type representing voiceover sounds, that can be used with sound-related functions. Value is 3.
|
| VOLUME_TYPE_INTERFACE | @number |
Volume type representing user interface sounds, that can be used with sound-related functions. Value is 4.
|
| VOLUME_TYPE_MOVIE | @number |
Volume type representing movie sounds, that can be used with sound-related functions. Value is 5.
|
| VOLUME_TYPE_VOICE_CHAT | @number |
Volume type representing voice chat audio, that can be used with sound-related functions. Value is 6.
|
| VOLUME_TYPE_MASTER | @number |
Volume type representing the master volume level, that can be used with sound-related functions. Value is 7.
|