User Tools

Site Tools


scripting_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting_reference [2024/10/21 20:44] justinscripting_reference [2025/03/11 20:22] (current) justin
Line 3: Line 3:
 =====Global Variables===== =====Global Variables=====
 ^Variable^Description^Data Type^ ^Variable^Description^Data Type^
 +|global.property["x"]|Custom [[global_properties|global property]], where "x" is a [[string]] containing the name of the property. This can be used to either retrieve or change the property's value.|Varies|
 +|global.properties|All custom global properties. As it's a [[codex]], its keys can be iterated using a "for" loop (refer to the [[codex]] documentation for an example).|[[Codex]]|
 |global.theme|Current UI [[theme_editor|theme]]. Can be used to retrieve or modify the [[theme_editor|theme]].|[[String]]| |global.theme|Current UI [[theme_editor|theme]]. Can be used to retrieve or modify the [[theme_editor|theme]].|[[String]]|
 |global.gameplay|Gameplay settings. Can be used to retrieve the gameplay settings as defined in your [[Game Configuration]].|[[Codex]]| |global.gameplay|Gameplay settings. Can be used to retrieve the gameplay settings as defined in your [[Game Configuration]].|[[Codex]]|
-|global.time|Current game time (value will be between 0 and the configured day/night duration in seconds).|[[Number]]|+|global.time|Current in-game time (value will be between 0 and the configured day/night duration in seconds).|[[Number]]| 
 +|global.day|Current in-game day. Value begins at 1 and is incremented by 1 for each day/night cycle that passes.|[[Number]]|
 |global.gravity|Current gravity used by free movement maps. Can be used to retrieve or modify the gravity.|[[Number]]| |global.gravity|Current gravity used by free movement maps. Can be used to retrieve or modify the gravity.|[[Number]]|
 |global.random_seed|Seed value for random number generation (must be an integer).|[[Number]]| |global.random_seed|Seed value for random number generation (must be an integer).|[[Number]]|
Line 14: Line 17:
 |map.name|Name of the current [[map]].|[[String]]| |map.name|Name of the current [[map]].|[[String]]|
 |map.groups|List of [[groups]] defined for the current [[map]].|[[Array]]| |map.groups|List of [[groups]] defined for the current [[map]].|[[Array]]|
 +|map.property["x"]|Custom property stored on the [[map]], where "x" is a [[string]] containing the name of the property. This can be used to either retrieve or change the property's value.|Varies|
 +|map.properties|All custom properties defined for the current [[map]]. As it's a [[codex]], its keys can be iterated using a "for" loop (refer to the [[codex]] documentation for an example).|[[Codex]]|
  
 =====Camera Variables===== =====Camera Variables=====
Line 29: Line 34:
 ^Variable^Description^Data Type^ ^Variable^Description^Data Type^
 |system.time|Current system time as a [[codex]] containing key/value pairs for "hour", "minute", and "second".|[[Codex]]| |system.time|Current system time as a [[codex]] containing key/value pairs for "hour", "minute", and "second".|[[Codex]]|
 +|system.date|Current system date as a [[codex]] containing key/value pairs for "year", "month", "day", "weekday", and "dst".|[[Codex]]|
  
 =====Other Variables===== =====Other Variables=====
Line 37: Line 43:
 In order to see a full list of properties that are available for each lookup type, you can use the [[Print]] function to print the [[codex]] to the [[debug console]]. Refer to the [[codex]] documentation for more details about reading values from a [[codex]]. In order to see a full list of properties that are available for each lookup type, you can use the [[Print]] function to print the [[codex]] to the [[debug console]]. Refer to the [[codex]] documentation for more details about reading values from a [[codex]].
 ^Syntax^Description^ ^Syntax^Description^
-|item["ITEM_0001"]| | +|item["ITEM_0001"]|Gives a [[codex]] containing properties of the specified [[item]], where "ITEM_0001" is the item's ID as assigned in the [[Item Editor]].
-|skill["SKILL_0001"]| | +|skill["SKILL_0001"]|Gives a [[codex]] containing properties of the specified [[stats_editor|skill]], where "SKILL_0001" is the skill's ID as assigned in the [[Stats Editor]].
-|status["STATUS_0001"]| | +|status["STATUS_0001"]|Gives a [[codex]] containing properties of the specified [[stats_editor|status effect]], where "STATUS_0001" is the status effect's ID as assigned in the [[Stats Editor]].
-|quest["QUEST_0001"]| |+|quest["QUEST_0001"]|Gives a [[codex]] containing properties of the specified quest, where "QUEST_0001" is the quest's ID as assigned in the Quest Editor.|
  
 =====Utility Functions===== =====Utility Functions=====
 Parameters marked with an asterisk (*) are optional. If an optional parameter is passed to a function, any preceding optional parameters must also be included. Parameters marked with an asterisk (*) are optional. If an optional parameter is passed to a function, any preceding optional parameters must also be included.
 ^Signature^Description^ ^Signature^Description^
-|random(//min//, //max//)|Returns a random number between the specified minimum and maximum value (inclusive). Both values should be integers. Random numbers can also be generated using D&D dice notation, e.g. 2d6 will roll two six-sided dice and add the resulting numbers together.|+|random(//min//, //max//)|Returns a random number between the specified minimum and maximum value (inclusive). Both values should be integers. Random numbers can also be generated using D&D dice notation, e.g. **2d6** will roll two six-sided dice and add the resulting numbers together.|
 |str(//value//)|Converts the given value to a [[string]].| |str(//value//)|Converts the given value to a [[string]].|
 |num(//value//)|Converts the given value to a [[number]].| |num(//value//)|Converts the given value to a [[number]].|
Line 61: Line 67:
 |floor(//x//)|Rounds x downwards to the nearest whole number.| |floor(//x//)|Rounds x downwards to the nearest whole number.|
 |ceil(//x//)|Rounds x upwards to the nearest whole number.| |ceil(//x//)|Rounds x upwards to the nearest whole number.|
-|pad_zeros(//value//, //digits//)|Pads a [[number|numeric value]] with leading zeros so it will have the specified number of digits (e.g. pad_zeros(17, 4) will give a [[string]] value of "0017").|+|pad_zeros(//value//, //digits//)|Pads a [[number|numeric value]] with leading zeros so it will have the specified number of digits (e.g. **pad_zeros(17, 4)** will give a [[string]] value of "0017").|
 |distance(//from_entity//, //to_entity//)|Gives the distance between two [[entity|entities]] (measured in voxels).| |distance(//from_entity//, //to_entity//)|Gives the distance between two [[entity|entities]] (measured in voxels).|
  
Line 102: Line 108:
 |[[disable_conveyor|Disable Conveyor]]|**disable_conveyor**(//conveyor_group//)| |[[disable_conveyor|Disable Conveyor]]|**disable_conveyor**(//conveyor_group//)|
 |[[disable_effect|Disable Effect]]|**disable_effect**(//entity//)| |[[disable_effect|Disable Effect]]|**disable_effect**(//entity//)|
-|[[disable_screen_effect|Disable Screen Effect]]|**disable_screen_effect**(//*duration//)|+|[[disable_screen_effect|Disable Screen Effect]]|**disable_screen_effect**(//*duration//, //*screen_effect_id//)|
 |[[disable_turret|Disable Turret]]|**disable_turret**(//entity//)| |[[disable_turret|Disable Turret]]|**disable_turret**(//entity//)|
 |[[disable_zone|Disable Zone]]|**disable_zone**(//zone_name//)| |[[disable_zone|Disable Zone]]|**disable_zone**(//zone_name//)|
Line 112: Line 118:
 |[[enable_conveyor|Enable Conveyor]]|**enable_conveyor**(//conveyor_group//)| |[[enable_conveyor|Enable Conveyor]]|**enable_conveyor**(//conveyor_group//)|
 |[[enable_effect|Enable Effect]]|**enable_effect**(//entity//)| |[[enable_effect|Enable Effect]]|**enable_effect**(//entity//)|
-|[[enable_screen_effect|Enable Screen Effect]]|**enable_screen_effect**(//*duration//)|+|[[enable_screen_effect|Enable Screen Effect]]|**enable_screen_effect**(//*duration//, //*screen_effect_id//)|
 |[[enable_turret|Enable Turret]]|**enable_turret**(//entity//)| |[[enable_turret|Enable Turret]]|**enable_turret**(//entity//)|
 |[[enable_zone|Enable Zone]]|**enable_zone**(//zone_name//)| |[[enable_zone|Enable Zone]]|**enable_zone**(//zone_name//)|
Line 223: Line 229:
 |[[set_language|Set Language]]|**set_language**(//locale_code//)| |[[set_language|Set Language]]|**set_language**(//locale_code//)|
 |[[set_movement_speed|Set Movement Speed]]|**set_movement_speed**(//character//, //speed//)| |[[set_movement_speed|Set Movement Speed]]|**set_movement_speed**(//character//, //speed//)|
-|[[set_screen_effect_property|Set Screen Effect Property]]|**set_screen_effect_property**(//property_name//, //property_value//, //*duration//)|+|[[set_screen_effect_property|Set Screen Effect Property]]|**set_screen_effect_property**(//property_name//, //property_value//, //*duration//, //*screen_effect_id//)|
 |[[set_stat|Set Stat]]|**set_stat**(//stat_id//, //value//, //*character//)| |[[set_stat|Set Stat]]|**set_stat**(//stat_id//, //value//, //*character//)|
 |[[set_terrain_types|Set Terrain Types]]|**set_terrain_types**(//entity//, //terrain_mode//, //*terrain_types//)| |[[set_terrain_types|Set Terrain Types]]|**set_terrain_types**(//entity//, //terrain_mode//, //*terrain_types//)|
scripting_reference.1729568655.txt.gz · Last modified: 2024/10/21 20:44 by justin