User Tools

Site Tools


scripting_reference

Scripting Reference


Global Variables

VariableDescriptionData Type
global.themeCurrent UI theme. Can be used to retrieve or modify the theme.String
global.gameplayGameplay settings. Can be used to retrieve the gameplay settings as defined in your Game Configuration.Codex
global.timeCurrent game time (value will be between 0 and the configured day/night duration in seconds).Number
global.random_seedSeed value for random number generation (must be an integer).Number
global.noise_seedSeed value for Get Noise 2D and Get Noise 3D scripting functions (must be an integer).Number

Map Variables

VariableDescriptionData Type
map.nameName of the current map.String
map.groupsList of groups defined for the current map.Array

Camera Variables

VariableDescriptionData Type
camera.directionDirection in which the camera is currently facing (nearest cardinal direction, either NORTH, SOUTH, WEST, or EAST).Cardinal Direction

Party Variables

VariableDescriptionData Type
party.member[“x”]Character in the player's party, where “x” is the character's member ID as assigned via the Add Party Member function. The primary player character can be referenced using a member ID of “player”.Entity

System Variables

VariableDescriptionData Type
system.timeCurrent system time as a codex containing key/value pairs for “hour”, “minute”, and “second”.Codex

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.

SignatureDescription
random(min, max)Returns a random number between the specified minimum and maximum value (inclusive). Both values should be integers.
str(value)Converts the given value to a string.
num(value)Converts the given value to a number.
len(value)Returns the number of characters in a string, the number of elements in an array, or the number of keys in a codex.
substr(string, start_position, *length)Returns a substring of a string. The “length” parameter can be omitted to include all characters from the start position until the end of the string.
range(min, *max, *step)Returns an array of integers based on the supplied parameters. See “Range” section of Script Syntax for examples.
inverse(value)Returns the inverse of the specified value. Supported data types are number, boolean, coordinate, color, cardinal direction, and navigation type. See “Inverse” section of Script Syntax for examples.
duplicate(value)Duplicates an array or codex to create a unique copy of the data.
clamp(value, min, max)Returns a numeric value clamped to the specified range. The result will be no less than the minimum value and no more than the maximum value.
round(x)Rounds x to the nearest whole number.
mod(x, y)Gives the remainder of x divided by y.
pow(x, y)Gives the result of x raised to the power of y.
sqrt(x)Gives the square root of x.
abs(x)Gives the absolute value of x.
floor(x)Rounds x downwards to the nearest whole number.
ceil(x)Rounds x upwards to the nearest whole number.

Event Functions

Event functions are used to trigger certain actions or events in your game, such as loading a map, playing an animation, or healing a character. These functions allow you to control the flow of your game and help give life to its world! Click on a function name for more details around its usage.

Parameters marked with an asterisk (*) are optional. If an optional parameter is passed to a function, any preceding optional parameters must also be included.

NameSignature
Add Characteradd_character(model_name, tile, *entity_id)
Add Effectadd_effect(effect_name, coordinate, *entity_id)
Add Item To Containeradd_item_to_container(entity, item_id, *count)
Add Item To Tileadd_item_to_tile(tile, item_id, *count)
Add Objectadd_object(model_name, tile, *entity_id)
Add Party Memberadd_party_member(model_name, member_id)
Add Tileadd_tile(model_name, coordinate, *entity_id)
Add To Groupadd_to_group(entity, group_name)
Add Waypointadd_waypoint(tile, waypoint_name, waypoint_coordinate)
Apply Lighting Presetapply_lighting_preset(preset_name, *duration)
Apply Status Effectapply_status_effect(status_effect_id, character, *duration)
Assign Entity IDassign_entity_id(entity, entity_id)
Attach Effectattach_effect(effect_name, target_entity, attach_id)
Attach Objectattach_object(model_name, target_entity, attach_id, *target_attach_id)
Change Camerachange_camera(camera_type)
Change Playerchange_player(character)
Clear Status Effectsclear_status_effects(character)
Complete Questcomplete_quest(quest_id)
Create Platformcreate_platform(tile, speed)
Damage Entitydamage_entity(entity, damage_amount)
Delete Datadelete_data(filename)
Delete Savedelete_save(*filename)
Detach Effectdetach_effect(entity, attach_id)
Detach Objectdetach_object(entity, attach_id)
Disable Containerdisable_container(entity_id)
Disable Effectdisable_effect(entity)
Display Choicesdisplay_choices(message_text, choices, *speaker)
Display Imagedisplay_image(image_name, *duration, *bg_color, *stretch_mode)
Display Messagedisplay_message(message_text, *speaker)
Enable Containerenable_container(entity_id)
Enable Effectenable_effect(entity)
End Battleend_battle(victory)
Equip Itemequip_item(character, slot_id, item_id, *count)
Execute Scriptexecute_script(script_name, *pause)
Fade Infade_in(duration)
Fade Outfade_out(duration)
Fail Questfail_quest(quest_id)
Get Noise 2Dget_noise_2d(x, y)
Get Noise 3Dget_noise_3d(x, y, z)
Give Itemgive_item(item_id, *count, *character)
Give Lootgive_loot(loot_name, *count, *character)
Give Questgive_quest(quest_id)
Give Skillgive_skill(skill_id, *character)
Heal Entityheal_entity(entity, heal_amount)
Hide Grouphide_group(group_name)
Hide Inventoryhide_inventory()
Hide Toolbarhide_toolbar()
Hide Widgethide_widget(widget_id)
Load Dataload_data(filename, *password)
Load Gameload_game(*filename)
Load Mapload_map(map_name, player_coord, *player_direction)
Lock Cameralock_camera()
Lock/Unlock Player Interactionset_player_interaction_locked(is_locked)
Lock/Unlock Player Movementset_player_movement_locked(is_locked)
Log Messagelog_message(message)
Look At Targetlook_at_target(target)
Look At Target Over Timelook_at_target_over_time(target, duration)
Modify Navigationmodify_navigation(first_tile_id, second_tile_id, navigation_type)
Move Cameramove_camera(destination, *look_at_target)
Move Camera At Speedmove_camera_at_speed(destination, speed, *look_at_target)
Move Camera Over Timemove_camera_over_time(destination, duration, *look_at_target)
Move Charactermove_character(character, tile, *pause)
Move Platformmove_platform(tile, waypoint_name, *pause)
Move Playermove_player(tile)
Open Containeropen_container(entity)
Override Animationoverride_animation(entity, anim_to_override, override_with)
Play Animationplay_animation(entity, animation_name)
Play Group Animationplay_group_animation(group_name, animation_name)
Play Musicplay_music(music_name, *fade_in_length, *loop)
Play Soundplay_sound(sound_name, *loop, *interval)
Play Videoplay_video(video_name)
Printprint(data)
Put Entityput_entity(entity, target_tile)
Put Playerput_player(target_tile, *direction)
Remove Entityremove_entity(entity)
Remove From Groupremove_from_group(entity, group_name)
Remove Itemremove_item(item_id, *count, *character)
Remove Item From Containerremove_item_from_container(entity, item_id, *count)
Remove Party Memberremove_party_member(member_id)
Remove Skillremove_skill(skill_id, *character)
Remove Status Effectremove_status_effect(status_effect_id, character)
Replace Navigationreplace_navigation(entity, navigation_type, new_navigation_type)
Request Coordinaterequest_coordinate(start_z, min_z, max_z, step_z, *validation_func)
Request Entityrequest_entity(*validation_func)
Reset Camerareset_camera()
Reset Camera At Speedreset_camera_at_speed(speed)
Reset Camera Over Timereset_camera_over_time(duration)
Reset Entity Rotationreset_entity_rotation(entity, *duration)
Reset Mapreset_map(map_name)
Restart Gamerestart_game()
Restore Party Memberrestore_party_member(member_id)
Revive Characterrevive_character(character, heal_amount)
Rotate Camerarotate_camera(horizontal_angle, vertical_angle)
Rotate Camera Over Timerotate_camera_over_time(horizontal_angle, vertical_angle, duration)
Rotate Entity Towardsrotate_entity_towards(entity, target_entity, also_rotate_target, *duration)
Rotate Player To Directionrotate_player_to_direction(direction)
Save Datasave_data(data, filename, *password)
Save Gamesave_game(*filename)
Set Ambient Light Colorset_ambient_light_color(color, *duration)
Set Ambient Light Enabledset_ambient_light_enabled(enabled)
Set Ambient Light Intensityset_ambient_light_intensity(intensity, *duration)
Set Animation Speedset_animation_speed(entity, animation_name, speed)
Set Character Nameset_character_name(entity_id, name)
Set Dialogueset_dialogue(entity_id, dialogue_name)
Set Directional Light Colorset_directional_light_color(color, *duration)
Set Directional Light Enabledset_directional_light_enabled(enabled)
Set Directional Light Intensityset_directional_light_intensity(intensity, *duration)
Set Entity Blocks Sightset_entity_blocks_sight(entity, blocks_sight)
Set Entity Light Attenuationset_entity_light_attenuation(entity, attenuation, *duration)
Set Entity Light Colorset_entity_light_color(entity, color, *duration)
Set Entity Light Diameterset_entity_light_diameter(entity, diameter, *duration)
Set Entity Light Enabledset_entity_light_enabled(entity, enabled)
Set Entity Light Intensityset_entity_light_intensity(entity, intensity, *duration)
Set Entity Modelset_entity_model(entity, model_name)
Set Entity Propertyset_entity_property(entity, property_name, property_value)
Set Entity Scaleset_entity_scale(entity, x_scale, y_scale, z_scale, *duration)
Set Entity Scriptset_entity_script(entity, script_name, *script_trigger, *triggerable_by_npc)
Set Entity Textureset_entity_texture(entity, texture_name)
Set Entity Tooltipset_entity_tooltip(entity, tooltip_text)
Set Global Propertyset_global_property(property_name, property_value)
Set Group Light Colorset_group_light_color(group_name, color, *duration)
Set Group Light Enabledset_group_light_enabled(group_name, enabled)
Set Languageset_language(locale_code)
Set Movement Speedset_movement_speed(character, speed)
Set Terrain Typesset_terrain_types(entity, terrain_mode, *terrain_types)
Set Vision Heightset_vision_height(character, height)
Show Creditsshow_credits()
Show Groupshow_group(group_name)
Show Inventoryshow_inventory()
Show Toolbarshow_toolbar()
Show Widgetshow_widget(widget_id)
Start Battlestart_battle(battle_name)
Start Dialoguestart_dialogue(dialogue_name)
Stop Musicstop_music(*fade_out_length)
Stop Playerstop_player()
Stop Soundstop_sound(sound_id, *fade_out_length)
Unequip Itemunequip_item(character, slot_id, *count)
Use Skilluse_skill(skill_id, *character)
Waitwait(duration)
scripting_reference.txt · Last modified: 2023/08/13 12:17 by justin