Naev

Module vn

Visual Novel API for Naev

Based on Love2D API

Functions

setColor (col[, alpha=1]) Sets the current drawing colour of the VN.
draw () Drawing function for the VN.
update (dt) Main updating function.
keypressed (key) Key press handler.
mousepressed (mx, my, button) Mouse press handler.
na (what, nowait) Makes the narrator say something.

Class Character

vn.Character:say (what, nowait) Makes a character say something.
vn.Character.new (who, params) Creates a new character without adding it to the VN.
vn.Character:rename (newname) Renames a character on the fly.
Character:newCharacter (who, params) Creates a new character.
Character:appear (c[, name="fade"], seconds[, transition="linear"]) Makes a character appear in the VN.
Character:disappear (c[, name="fade"], seconds[, transition="linear"]) Makes a character disappear in the VN.
Character:scene (background) Starts a new scene.
Character:say (who, what[, nowait=false]) Has a character say something.
Character:menu (items[, handler=vn.jump]) Opens a menu the player can select from.
Character:label (label) Inserts a label.
Character:jump (label) Inserts a jump.
Character:music (filename, params, dontstop) Plays music.
Character:musicStop (filename) Stops certain playing music.
Character:done (...) Finishes the VN.
Character:animation (seconds, func, drawfunc, transition, initfunc, drawoverride) Allows doing arbitrary animations.
Character:transition ([name="fade"[, seconds[, transition="linear"]]]) Creates a transition state.
Character:func (func) Runs a specified function and continues execution.
Character:sfx (sfx) Plays a sound.
Character:sfxMoney () Plays a money sound.
Character:sfxVictory () Plays a victory sound.
Character:sfxBingo () Plays a bingo sound.
Character:sfxEerie () Plays an eerie sound.
Character:custom () Custom states.
Character:setShader (shader) Sets the shader to be used for post-processing the VN.
Character:setBackground (drawfunc) Sets the background drawing function.
Character:setForeground (drawfunc) Sets the foreground drawing function.
Character:setUpdateFunc (updatefunc) Sets a custom update function.
Character:isDone () Checks to see if the VN is done running or not.
Character:run () Runs the visual novel environment.
Character:clear () Clears the fundamental running variables.
Character:reset () Fully resets the VN environment to default values.


Functions

setColor (col[, alpha=1])
Sets the current drawing colour of the VN.

Parameters:

  • col tab Colour table consisting of 3 or 4 number values.
  • alpha number Additional alpha to multiply by. (default 1)
draw ()
Drawing function for the VN. Has to be called each loop in "love.draw".
update (dt)
Main updating function. Has to be called each loop in "love.update"

Parameters:

  • dt number Update tick in seconds.
keypressed (key)
Key press handler.

Parameters:

  • key string Name of the key pressed.
mousepressed (mx, my, button)
Mouse press handler.

Parameters:

  • mx number X position of the click.
  • my number Y position of the click.
  • button number Button that was pressed.
na (what, nowait)
Makes the narrator say something.

Parameters:

  • what string What is being said.
  • nowait bool Whether or not to wait for player input when said.

Class Character

A visual novel character.
vn.Character:say (what, nowait)
Makes a character say something.

Parameters:

  • what string What is being said.
  • nowait bool Whether or not to wait for player input when said.
vn.Character.new (who, params)
Creates a new character without adding it to the VN. Note The character can be added with vn.newCharacter.

Parameters:

  • who string Name of the character to add.
  • params tab Parameter table.

Returns:

    Character New character.
vn.Character:rename (newname)
Renames a character on the fly.

Parameters:

  • newname string New name to give the character.
Character:newCharacter (who, params)
Creates a new character.

Parameters:

  • who string Name (or previously created character) to add.
  • params tab Parameter table.

Returns:

    Character New character.
Character:appear (c[, name="fade"], seconds[, transition="linear"])
Makes a character appear in the VN.

Parameters:

  • c Character Character to make appear.
  • name string Name of the transition effect to use (see vn.transition) (default "fade")
  • seconds number Seconds to do the transition.
  • transition string Name of the CSS transition to use. (default "linear")

See also:

Character:disappear (c[, name="fade"], seconds[, transition="linear"])
Makes a character disappear in the VN.

The way it works is that the transition is played backwards, so if you want the character to slide left, use "slideright"!

Parameters:

  • c Character Character to make disappear.
  • name string Name of the transition effect to use (see vn.transition) (default "fade")
  • seconds number Seconds to do the transition.
  • transition string Name of the CSS transition to use. (default "linear")

See also:

Character:scene (background)
Starts a new scene.

Parameters:

  • background Background image to set or none if nil.
Character:say (who, what[, nowait=false])
Has a character say something.

Note "me" and "narrator" are specila meta-characters.

Parameters:

  • who string The name of the character that is saying something.
  • what string What the character is saying.
  • nowait bool Whether or not to introduce a wait or just skip to the next text right away (defaults to false). (default false)
Character:menu (items[, handler=vn.jump])
Opens a menu the player can select from.

Parameters:

  • items tab Table of items to select from, they should be of the form "{text, label}" where "text" is what is displayed and "label" is what is passed to the handler.
  • handler func Function to handle what happens when an item is selecetdd. Defaults to vn.jump. (default vn.jump)
Character:label (label)
Inserts a label. This does nothing but serve as a reference for vn.jump

Parameters:

  • label string Name of the label to insert.

See also:

Character:jump (label)
Inserts a jump. This skips to a certain label.

Parameters:

  • label string Name of the label to jump to.

See also:

Character:music (filename, params, dontstop)
Plays music. This will stop all other playing music unless dontstop is set to true.

This gets automatically reset when the VN finishes.

Parameters:

  • filename string or nil Name of the music to play. If nil, it tries to restore the music again.
  • params tab Same as lmusic.play()
  • dontstop boolean Don't stop other music.

See also:

Character:musicStop (filename)
Stops certain playing music.

Parameters:

  • filename string or nil Name of the music to stop. If nil, it tries to stop all playing music.
Character:done (...)
Finishes the VN.

Parameters:

  • ... Uses the parameters as vn.transition.

See also:

Character:animation (seconds, func, drawfunc, transition, initfunc, drawoverride)
Allows doing arbitrary animations.

Parameters:

  • seconds number Seconds to perform the animation
  • func func Function to call when progress is being done.
  • drawfunc func Function to call when drawing.
  • transition string or tab A CSS transition to use. Can be one of "ease", "ease-in", "ease-out", "ease-in-out", "linear", or a table defining the bezier curve parameters.
  • initfunc func Function run once at the beginning.
  • drawoverride func Function that overrides the drawing function for the VN.
Character:transition ([name="fade"[, seconds[, transition="linear"]]])
Creates a transition state.

Parameters:

  • name string Name of the transition to use. (default "fade")
  • seconds number Seconds for the transition to last. The default value depends on the type of transition. (optional)
  • transition string The name of the CSS transition to use. See vn.animation. (default "linear")

See also:

Character:func (func)
Runs a specified function and continues execution.

Parameters:

  • func func Function to run.
Character:sfx (sfx)
Plays a sound.

Parameters:

  • sfx Audio Sound to play.
Character:sfxMoney ()
Plays a money sound.
Character:sfxVictory ()
Plays a victory sound.
Character:sfxBingo ()
Plays a bingo sound.
Character:sfxEerie ()
Plays an eerie sound.
Character:custom ()
Custom states. Only use if you know what you are doing.
Character:setShader (shader)
Sets the shader to be used for post-processing the VN.

Parameters:

  • shader Shader Shader to use for post-processing or nil to disable.

See also:

Character:setBackground (drawfunc)
Sets the background drawing function. Drawn behind the VN stuff.

Parameters:

  • drawfunc func Function to call to draw the background or nil to disable.
Character:setForeground (drawfunc)
Sets the foreground drawing function. Drawn behind the VN stuff.

Parameters:

  • drawfunc func Function to call to draw the foreground or nil to disable.
Character:setUpdateFunc (updatefunc)
Sets a custom update function. This gets run every frame.

Parameters:

  • updatefunc func Update function to run every frame.
Character:isDone ()
Checks to see if the VN is done running or not.

Returns:

    bool true if it is done running, false otherwise
Character:run ()
Runs the visual novel environment.

Note You have to set up the states first. Note This function doesn't return until the VN is done running.

Character:clear ()
Clears the fundamental running variables. Run before starting a new VN instance.

Note Leaves customization to colors and positions untouched.

Character:reset ()
Fully resets the VN environment to default values.

Note This automatically does vn.clear() too.

generated by LDoc 1.4.6 Last updated 2021-07-27 21:51:06