Script Functions

From Danmakufu Wiki
Jump to: navigation, search

LoadScript

Parameters:
 1) script path (char)

Loads and compiles the specified script, and returns its script ID. Also calls @Loading and initializes global variables.

LoadScriptInThread

Parameters:
 1) script path (char)

Loads and compiles the specified script in a different thread, and returns its script ID. Also calls @Loading and initializes global variables.

StartScript

Parameters:
 1) script ID (real)

Starts the specified script (@Initialize is called and @MainLoop begins).

CloseScript

Parameters:
 1) script ID (real)

Stops the specified script. Until this function is called, the script will continue to run.

IsCloseScript

Parameters:
 1) script ID (real)

Returns whether the specified script has been stopped. Returns true if the script is not running.

SetScriptArgument

Parameters:
 1) script ID (real)
 2) argument index (real)
 3) arbitrary value (free)

Before starting the given script with StartScript, sets a value that is to be passed to the given script upon starting. You can then get this value in the script with GetScriptArgument.

GetScriptArgument

Parameters:
 1) argument index (real)

Returns the value of the specified argument, previously set by SetScriptArgument before the script was started.

GetScriptArgumentCount

Returns the number of arguments set by SetScriptArgument before the script was started.

CloseStgScene

Ends the current scene (returns to script selection screen).

GetOwnScriptID

Returns the script's own ID during execution.

GetEventType

Returns the event type currently triggered in @Event. A list of events can be found here.

GetEventArgument

Parameters:
 1) argument index (real)

Returns the argument of the event currently triggered in @Event. Can be an arbitrary value.

SetScriptResult

Parameters:
 1) result sent by the event (free)

Sets the result of the event in @Event, which can then be retrieved by GetScriptResult.

GetScriptResult

Parameters:
 1) script id (real)

Returns the event result from SetScriptResult. Can be an arbitrary value.

SetAutoDeleteObject

Parameters:
 1) enable (bool)

Sets whether to delete all existing objects that were created in the script at its termination. If set to true, the script's objects will be deleted. The default value is false.

NotifyEvent

Parameters:
 1) script ID (real)
 2) event type (real/constant)
 3) arbitrary value (free)

Calls the @Event of the script with the specified ID, triggering the specified event. The event type may use a value greater than EV_USER.

NotifyEventAll

Parameters:
 1) event type (real/constant)
 2) arbitrary value (free)

Calls the @Event of all scripts, triggering the specified event. The event type may use a value greater than EV_USER.

GetScriptInfoA1

Parameters:
 1) file path (char)
 2) info type (constant)
  • INFO_SCRIPT_TYPE: Returns the script type (constant):
    • TYPE_SCRIPT_PLAYER: Player script
    • TYPE_SCRIPT_SINGLE: Single script
    • TYPE_SCRIPT_PLURAL: Plural script
    • TYPE_SCRIPT_STAGE: Stage script
    • TYPE_SCRIPT_PACKAGE: Package script
  • INFO_SCRIPT_PATH: Returns the script path (char).
  • INFO_SCRIPT_ID: Returns the script #ID (char).
  • INFO_SCRIPT_TITLE: Returns the script #Title (char).
  • INFO_SCRIPT_TEXT: Returns the script #Text (char).
  • INFO_SCRIPT_IMAGE: Returns the script #Image (char).
  • INFO_SCRIPT_REPLAY_NAME: Returns the script #ReplayName (char).