Module output

Functions

out (txt) Add text to the output buffer
display_entity (entity, x, y, seen, ignoreDistMods, scale) Display an entity.
load_image (name, image_type) Load an image from the assets/images/ directory The resulting image will be loaded into images[image_typename], for example images['creaturezombie']
moveCursor (mx, my) Move the cursor to another tile.
setCursor (x, y, force, noScroll, allow_current_creature) Set the cursor to a given tile.
tile_to_coordinates (x, y, noRound) Get the pixel coordinates of a tile
refresh_coordinate_map () Refresh the stored map of pixel values for all the tiles in the map
coordinates_to_tile (x, y) Convert pixel coordinates to a tile's coordinates.
get_map_width () Get the width (in pixels) used for the game map.
get_map_height () Get the height (in pixels) used for the game map.
get_map_dimensions () Get the width and height(in pixels) used for the game map.
get_tile_size (ignoreZoom) Get the width/height in pixels of a map tile.
load_ui () Load and initialize all UI-related images.
load_all_images () Load all images in the assets/images/ directory
draw_health_bar (val, max_val, x, y, width, height, color) Draw a bar
draw_tiny_bar (val, max_val, x, y, width, height, color) Draw a bar
sound (soundName, pitchDiff) Play a sound
make_playlist (name) Make, but do not play, a music playlist
play_playlist (name, useGeneric) Play a misic playlist
scrollbar (x, startY, endY, scrollPerc, useScaling) Draw a scrollbar on the screen
button (x, y, width, small, special, text, useScaling, color) Draw a button
largebutton (x, y, width, special) Draw a large button.
closebutton (x, y, hover, useScaling, imageBase) Draw a close button
tinybutton (x, y, small, hover, text, useScaling) Draw a square button
description_box (text, x, y, maxWidth, scroll) Draw a description box
move_camera (xAmt, yAmt, noTween) Move the camera
set_camera (x, y, noTween) Set the camera to a coordinate.
shake (distance, time) Shake the screen.
draw_window (startX, startY, endX, endY, color) Draw a bordered window.
get_spritesheet_quad (framenum, framecount) Get the quad needed for a given spritesheet
tween (duration, subject, target, method, after, ...) Create a tweening process.
timer (delay, func) Runs some code after a duration has passed Uses Timer from HUMP, see documentation at https://hump.readthedocs.io/en/latest/timer.html#Timer.after for more info and examples.
show_achievement_notification (achievement) Shows an achievement notification.
show_notification (achievemtextent, image) Shows a notification.
show_popup (achievement) Shows a popup.


Functions

out (txt)
Add text to the output buffer

Parameters:

  • txt String. The text to print
display_entity (entity, x, y, seen, ignoreDistMods, scale)
Display an entity. This accounts for ASCII mode, or ASCII if there's no sprite for this entity.

Parameters:

  • entity Entity. The entity to display
  • x Number. The X-coordinate (in pixels, not tiles) where the entity should be drawn.
  • y Number. The Y-coordinate (in pixels, not tiles) where the entity should be drawn.
  • seen Boolean. Whether or not the entity is seen by the player.
  • ignoreDistMods Boolean. Whether to ignore the "xMod" and "yMod" pixel-coordinate modifiers applied to the entity. (optional)
  • scale Number. The scale at which to draw the entity. (optional)
load_image (name, image_type)
Load an image from the assets/images/ directory The resulting image will be loaded into images[image_typename], for example images['creaturezombie']

Parameters:

  • name String. The name of the file.
  • image_type String. The type of Entity the image is for. This determines what subdirectory in assets/images/ to look in, as well as what the final ID of the image will be when loaded into the game.
moveCursor (mx, my)
Move the cursor to another tile.

Parameters:

  • mx Number The X-distance by which to move the cursor.
  • my Number. The Y-distance by which to move the cursor.
setCursor (x, y, force, noScroll, allow_current_creature)
Set the cursor to a given tile. This function handles snapping between possible targets, if targeting something with a limited number of possible targets on screen.

Parameters:

  • x Number. The X-coordinate of the new tile.
  • y Number. The Y-coordinate of the new tile.
  • force Boolean. If set to true, this will force the cursor to a certain location, even if it wouldn't normally be allowed.
  • noScroll Boolean. If true, don't scroll the map
  • allow_current_creature Boolean. If not set to true and the game is in targetting mode, will ignore the current target
tile_to_coordinates (x, y, noRound)
Get the pixel coordinates of a tile

Parameters:

  • x Number. The tile's x-coordinate.
  • y Number. The tile's y-coordinate.
  • noRound Boolean. If TRUE, will not round the resulting value up to the next pixel. Otherwise it will.

Returns:

  1. Number. The pixel's x-coordinate
  2. Number. The pixel's y-coordinate
refresh_coordinate_map ()
Refresh the stored map of pixel values for all the tiles in the map
coordinates_to_tile (x, y)
Convert pixel coordinates to a tile's coordinates.

Parameters:

  • x Number. The x-coordinate of the pixel.
  • y Number. The y-coordinate of the pixel.

Returns:

  1. Number. The x-coordinate of the tile.
  2. Number. The y-coordinate of the tile.
get_map_width ()
Get the width (in pixels) used for the game map.

Returns:

    Number. The width (in pixels) of the game map.
get_map_height ()
Get the height (in pixels) used for the game map.

Returns:

    Number. The height (in pixels) of the game map.
get_map_dimensions ()
Get the width and height(in pixels) used for the game map.

Returns:

  1. Number. The width (in pixels) of the game map.
  2. Number. The height (in pixels) of the game map.
get_tile_size (ignoreZoom)
Get the width/height in pixels of a map tile. The game assumes that all pixels are square, so the single number returned is assumed to be used for both.

Parameters:

  • ignoreZoom Boolean. If true, ignore zoom

Returns:

    Number. The size of a map tile.
load_ui ()
Load and initialize all UI-related images.
load_all_images ()
Load all images in the assets/images/ directory
draw_health_bar (val, max_val, x, y, width, height, color)
Draw a bar

Parameters:

  • val Number. The value at which to draw the bar
  • max_val Number. The maximum value the bar could hold
  • x Number. The x-coordinate to start at for the bar
  • y Number. The Y-coordinate to start at for the bar
  • width Number. The width of the bar
  • height Number. The height of the bar
  • color Table.
draw_tiny_bar (val, max_val, x, y, width, height, color)
Draw a bar

Parameters:

  • val Number. The value at which to draw the bar
  • max_val Number. The maximum value the bar could hold
  • x Number. The x-coordinate to start at for the bar
  • y Number. The Y-coordinate to start at for the bar
  • width Number. The width of the bar
  • height Number. The height of the bar
  • color Table.
sound (soundName, pitchDiff)
Play a sound

Parameters:

  • soundName Text. The name of the sound file, excluding file extension
  • pitchDiff Number. The maximum % by which to randomly shift the pitch up or down. Optional, defaults to 10

Returns:

    Boolean. Whether or not the sound exists or not
make_playlist (name)
Make, but do not play, a music playlist

Parameters:

  • name Text. The name of the folder within music/ to make the playlist from, or alternatively, the name of the single track to play (excluding filename extension)

Returns:

    Table. A list of tracks for the playlist
play_playlist (name, useGeneric)
Play a misic playlist

Parameters:

  • name Text. The name of the folder within music/ to make the playlist from, or alternatively, the name of the single track to play (excluding filename extension). Or, "silence" to stop playing all music.
  • useGeneric Boolean. If true, if the said playlist can't be created, just play from the generic playlist
scrollbar (x, startY, endY, scrollPerc, useScaling)
Draw a scrollbar on the screen

Parameters:

  • x Number. The x-coordinate of the scrollbar.
  • startY Number. The y-coordinate for the top of the scrollbar
  • endY Number. The y-coordinate for the bottom of the scrollbar
  • scrollPerc Number. The position on the scrollbar for the elevator
  • useScaling Boolean. Whether or not to take into account the game's UI scaling setting

Returns:

    Table. A table containing the sub-tables upArrow, downArrow, and elevator, each of whichhas startX, endX, startY, and endY values corresponding to that part of the scrollbar's coordinates
button (x, y, width, small, special, text, useScaling, color)
Draw a button

Parameters:

  • x Number. The x-coordinate of the button
  • y Number. The y-coordinate of the button
  • width Number. The width of the button
  • small Boolean. Whether or not to draw it as a small button
  • special Text. The text of the style to force the button to use (eg. forcing hover, or forcing disabled). Optional
  • text Text. The text to display on the button. Optional
  • useScaling Boolean. Whether to take into account the game's UI scaling setting. Optional
  • color

Returns:

    Table. A table with the values minX, maxX, minY, and maxY, containing the corresponding coordinates of the button, and hover, a boolean saying if the button is being hovered over
largebutton (x, y, width, special)
Draw a large button. I'm not entirely sure this actually works

Parameters:

  • x Number. The x-coordinate of the button
  • y Number. The y-coordinate of the button
  • width Number. The width of the button
  • special Text. The text of the style to force the button to use (eg. forcing hover, or forcing disabled). Optional

Returns:

    Table. A table with the values minX, maxX, minY, and maxY, containing the corresponding coordinates of the button, and hover, a boolean saying if the button is being hovered over
closebutton (x, y, hover, useScaling, imageBase)
Draw a close button

Parameters:

  • x Number. The x-coordinate of the button
  • y Number. The y-coordinate of the button
  • hover Boolean. Whether or not to draw the close button as if it's being hovered over. Optional
  • useScaling Boolean. Whether to take into account the game's UI scaling setting. Optional
  • imageBase Text. The name of the base image to use (defaults to "close")

Returns:

    Table. A table with the values minX, maxX, minY, and maxY, containing the corresponding coordinates of the button, and hover, a boolean saying if the button is being hovered over
tinybutton (x, y, small, hover, text, useScaling)
Draw a square button

Parameters:

  • x Number. The x-coordinate of the button
  • y Number. The y-coordinate of the button
  • small Boolean. Whether or not to draw it as a small button
  • hover Boolean. Whether to draw it as if it's being hovered over. Optional
  • text Text. The text to display on the button. Optional
  • useScaling Boolean. Whether to take into account the game's UI scaling setting. Optional

Returns:

    Table. A table with the values minX, maxX, minY, and maxY, containing the corresponding coordinates of the button, and hover, a boolean saying if the button is being hovered over
description_box (text, x, y, maxWidth, scroll)
Draw a description box

Parameters:

  • text Text. The text to display
  • x Number. The x-coordinate of the button
  • y Number. The y-coordinate of the button
  • maxWidth Number. The maximum width of the box
  • scroll Number. The amount the screen requesting this box is scrolled
move_camera (xAmt, yAmt, noTween)
Move the camera

Parameters:

  • xAmt Number. The number of tiles by which to move the camera, x-coordinate
  • yAmt Number. The number of tiles by which to move the camera, y-coordinate
  • noTween Boolean. If true, instantly snap the camera to the new location rather than smoothly moving it
set_camera (x, y, noTween)
Set the camera to a coordinate.

Parameters:

  • x Number. The new X-coordinate.
  • y Number. The new Y-coordinate.
  • noTween Boolean. If true, instantly snap the camera to the new location rather than smoothly moving it
shake (distance, time)
Shake the screen.

Parameters:

  • distance Number. The maximum distance of the shake.
  • time Number. The amount of time (in seconds) to do the shaking.
draw_window (startX, startY, endX, endY, color)
Draw a bordered window.

Parameters:

  • startX Number. The X-coordinate of the upper left corner.
  • startY Number. The Y-coordinate of the upper left corner.
  • endX Number. The X-coordinate of the lower right corner.
  • endY Number. The Y-coordinate of the lower right corner.
  • color Table. A table, in the format {r=255,g=255,b=255,a=255}, to be applied to the window. The Alpha value is optional.

Returns:

    Table. A table with the indices startX, startY, maxX, maxY, corresponding to the pixel coordinates of the start and end of the window as above.
get_spritesheet_quad (framenum, framecount)
Get the quad needed for a given spritesheet

Parameters:

  • framenum Number. The number of frames in the animation.
  • framecount Number. The frame in the animation to get

Returns:

    quad. The quad needed for the spritesheet animation
tween (duration, subject, target, method, after, ...)
Create a tweening process. Uses Timer from HUMP, see documentation at https://hump.readthedocs.io/en/latest/timer.html#Timer.tween for more info and examples.

Parameters:

  • duration Number. Duration of the tween in seconds.
  • subject Table. Object to be tweened.
  • target Table. Target values.
  • method Text. Tweening method, defaults to ‘linear’ (see here, optional).
  • after Function. Function to execute after the tween has finished (optional).
  • ... Anything. Additional arguments to the tweening function.

Returns:

    Timer. A timer handle.
timer (delay, func)
Runs some code after a duration has passed Uses Timer from HUMP, see documentation at https://hump.readthedocs.io/en/latest/timer.html#Timer.after for more info and examples.

Parameters:

  • delay Number. Duration of the timer in seconds.
  • func Function. The function to run after the timer has expired.

Returns:

    Timer. A timer handle.
show_achievement_notification (achievement)
Shows an achievement notification.

Parameters:

  • achievement Text. The ID of the achievement to show.
show_notification (achievemtextent, image)
Shows a notification.

Parameters:

  • achievemtextent Text. The text for the notificaiton
  • image Image. The full image name to display (optional
show_popup (achievement)
Shows a popup.

Parameters:

  • achievement Text. The ID of the achievement to show.
generated by LDoc 1.5.0 Last updated 2025-05-24 09:49:55