Package Functions

From Danmakufu Wiki
Jump to: navigation, search

ClosePackage

Ends the package script.

InitializeStageScene

Called only once before the start of a stage. Calling performs the initial processing for the stage.

FinalizeStageScene

Called only once at the end of a stage. Calling ends the stage processing. Defines the end point of replays

Note: throws an error if the stage script is not yet closed.

StartStageScene

Starts the stage.

SetStageIndex

Arguments:
 1) index of the stage (real)

Defines the index of the stage to be started next. The value does not need to be sequential.

SetStageMainScript

Arguments:
 1) path to the stage (path)

Defines the stage to be started next.

SetStagePlayerScript

Arguments:
 1) path to the player script (path)

Defines the player script to be used in the stage. This player must have been declared in the #Player header.

SetStageReplayFile

Arguments:
 1) path to the replay file (path)

Can only be called after InitializeStageScene.
When this is called, the stage script will be run through once with the replay controlling things such as player movement.
You don't have to start from the very first stage, and you can start from the middle of a stage. (unsure)

GetStageSceneState

Return value:
 STAGE_STATE_FINISHED (real): Whether the stage is finished or not

Can be used to return status information about the currently running stage.

GetStageSceneResult

Returns the reason the stage was finished.

Return value:
 STAGE_RESULT_CLEARED (real): Stage was cleared
 STAGE_RESULT_PLAYER_DOWN: Ran out of lives
 STAGE_RESULT_BREAK_OFF: Ended prematurely

PauseStageScene

Arguments:
 1) Is the stage being paused (bool)

Pauses (or resumes) the stage script.

TerminateStageScene

Exits out of the currently running stage.

GetLoadFreePlayerScriptList

Loads a list of the player scripts available in the /script/player/ folder.

GetFreePlayerScriptCount

Returns the number of player scripts available in the /script/player/ folder.

GetFreePlayerScriptInfo

Arguments:
 1) Index of the player script (real - must be less than GetFreePlayerScriptCount)
 2) Requested information (real)
     INFO_SCRIPT_PATH        (char): Script path
     INFO_SCRIPT_ID          (char): The player script's #ID
     INFO_SCRIPT_TITLE       (char): The player script's #Title
     INFO_SCRIPT_TEXT        (char): The player script's #Text
     INFO_SCRIPT_IMAGE       (char): The player script's #Image
     INFO_SCRIPT_REPLAY_NAME (char): The player script's #ReplayName

Returns various information about the player script.

LoadReplayList

Loads a list of the available replays for the current script.

GetValidReplayIndices

Loads a list of indices for the current script's available replays.

IsValidReplayIndex

Arguments:
 1) Index of the replay file (real)
Return value:
 Whether the inputted replay index can be used (bool)

Returns true or false depending on the index chosen is valid to be used in GetReplayInfo.

GetReplayInfo

Arguments:
 1) The replay index (must be less than GetValidReplayIndices)
 2) Various information
      REPLAY_FILE_PATH               (char): Replay's file path
      REPLAY_DATE_TIME               (char): The date and time at which the replay was saved
      REPLAY_USER_NAME               (char): The player's name
      REPLAY_TOTAL_SCORE             (real): The final score
      REPLAY_FPS_AVERAGE             (real): Average framerate
      REPLAY_PLAYER_NAME             (char): The (abbreviated) name of the player script used
      REPLAY_STAGE_INDEX_LIST        (real, array): List of stage indices that the replay used
      REPLAY_STAGE_START_SCORE_LIST  (real, array): List of score indices at the start of each stage 
                                                 (the order of the stage indices is from REPLAY_STAGE_INDEX_LIST)
      REPLAY_STAGE_LAST_SCORE_LIST   (real, array): List of score indices at the end of each stage 
                                                 (the order of the stage indices is from REPLAY_STAGE_INDEX_LIST)
      REPLAY_COMMENT                 (char): A short comment set arbitrarily using SetReplayInfo 
Return value:
      Various replay information

Returns the replay information requested.

SetReplayInfo

Arguments:
 1) Various information
      REPLAY_COMMENT (char): A short comment set arbitrarily
 2) The replay information (varies depending on information type)

Sets the replay information. Curently only to be used with REPLAY_COMMENT.

SaveReplay

Arguments:
 1) Index of the replay file (real)

Saves a replay to the specified replay index.