Skip to content

💾 VMU#

Note

The VMU (Visual Memory Unit) is used for saving game data and displaying animations.

Save#

Keep these in mind when you create a new savefile:
    gameName  - 16 character long.
    saveName  - 26 character long.
    descShort - 16 character long.
    descLong  - 32 character long.
    saveID    - from 1 to 3.

You should be able to save just about any Lua table on the VMU.

function vmu.checkForVMU()
Check if there is a valid VMU present.


function vmu.initSavefile(gameName, saveName, descLong, descShort, saveID)
Initializes a save file with the specified parameters.


function vmu.checkForSave(saveID)
Check if a save file exists with the specified saveID.


function vmu.saveGame(saveID, data)
Save the data table in the specified saveID. data can be any valid Lua Table.


function vmu.loadGame(saveID)
Returns a data table from the specified saveID.


function vmu.deleteGame(saveID)
Deletes the save file with the specified saveID.


VMU Animation#

To display images on the VMU, you need to create “animations”. These animations can be 1 frame long (static).

local ANIMATION = {
    icon      = {},  -- image data
    cFrame    = 1,   -- current frame displayed
    length    = frameNum or 1,
    speed     = speed or 1,
    priority  = priority or 1,
    active    = false,
    filename  = filename,
}

function vmu.createAnimation(filename, frameNum, speed, priority)
Returns an animation. frameNum is the number of frames in the animation. Use 1 for static images.If you have multiple frame, make sure the files are named filename1.bin, filename2.bin, etc.


function vmu.setScreen(animation, frame)
Displays the frame (integer) of the specified animation.


function vmu.playAnimation(animation, repeats, clearAfter)
Displays an animation for the specified number of repeats. If clearAfter is true, the VMU image will be cleared once the animation is done.


function vmu.clearScreen()
Clears the VMU screen.


function vmu.freeAnimation(animation)
Frees the memory of the animation.