API Docs for:
Show:

Component_CommandInterpreter Class

Module: gs

A component which allows a game object to process commands like for scene-objects. For each command a command-function exists. To add own custom commands to the interpreter just create a sub-class and override the gs.Component_CommandInterpreter.assignCommand method and assign the command-function for your custom-command.

Item Index

Methods

Methods

assignCommand

()

Assigns the correct command-function to the specified command-object if necessary.

blendObject

(
  • object
  • A
)

Blends a game object.

Parameters:

  • object gs.Object_Base
    • The game object to blend.
  • A Object

    params object containing additional info.

booleanValueAtIndex

(
  • scope
  • index
)
String

Gets the value of the boolean variable at the specified index.

Parameters:

  • scope Number
    • The variable's scope.
  • index Number
    • The index of the variable to get the value from.

Returns:

String:

The value of the variable.

booleanValueOf

(
  • object
)
Boolean

Gets the value of a (possible) boolean variable. If a constant boolean value is specified, this method does nothing an just returns that constant value. That's to make it more comfortable to just pass a value which can be calculated by variable but also be just a constant value.

Parameters:

  • object Boolean | Object
    • A boolean variable or constant boolean value.

Returns:

Boolean:

The value of the variable.

callCommonEvent

(
  • id
  • parameters
  • wait
)

Calls a common event and returns the sub-interpreter for it.

Parameters:

  • id Number
    • The ID of the common event to call.
  • parameters Object
    • Optional common event parameters.
  • wait Boolean
    • Indicates if the interpreter should be stay in waiting-mode even if the sub-interpreter is finished.

callScene

(
  • uid
)

Calls a scene and returns the sub-interpreter for it.

Parameters:

  • uid String
    • The UID of the scene to call.

changeDecimalVariables

(
  • params
  • roundMethod
)

Changes number variables and allows decimal values such as 0.5 too.

Parameters:

  • params Object
    • Input params from the command
  • roundMethod Object
    • The result of the operation will be rounded using the specified method.
    • 0 = None. The result will not be rounded.
    • 1 = Commercially
    • 2 = Round Up
    • 3 = Round Down

commandAddHotspot

() protected

commandAudioDefaults

() protected

commandBackgroundDefaults

() protected

commandBackgroundEffect

() protected

commandBackgroundMotionBlur

() protected

commandBacklogVisibility

() protected

commandBlendBackground

() protected

commandBlendCharacter

() protected

commandBlendPicture

() protected

commandBlendText

() protected

commandBlendVideo

() protected

commandBreakLoop

() protected

Break Loop

commandCallCommonEvent

() protected

commandCallScene

() protected

commandChangeBackground

() protected

commandChangeBooleanVariables

() protected

commandChangeColors

() protected

commandChangeDecimalVariables

() protected

commandChangeHotspotState

() protected

commandChangeNumberVariables

() protected

commandChangeObjectDomain

() protected

commandChangeScene

() protected

commandChangeScreenCursor

() protected

commandChangeSounds

() protected

commandChangeStringVariables

() protected

commandChangeTextSettings

() protected

commandChangeTextSettings

() protected

commandChangeTransition

() protected

commandChangeVariableDomain

() protected

commandCharacterChangeExpression

() protected

commandCharacterDefaults

() protected

commandCharacterEffect

() protected

commandCharacterExitScene

() protected

commandCharacterGetParameter

() protected

commandCharacterJoinScene

() protected

commandCharacterMotionBlur

() protected

commandCharacterSetParameter

() protected

commandCheckNumberVariable

() protected

commandCheckSwitch

() protected

commandCheckTextVariable

() protected

commandChoiceTimer

() protected

commandClearMessage

() protected

commandClosePageNVL

() protected

commandColorText

() protected

commandCondition

() protected

commandConditionElse

() protected

commandConditionElseIf

() protected

commandCreateMessageArea

() protected

commandCropPicture

() protected

commandCropVideo

() protected

commandEndCommonEvent

() protected

commandEraseHotspot

() protected

commandEraseImageMap

() protected

commandEraseMessageArea

() protected

commandErasePicture

() protected

commandEraseText

() protected

commandEraseVideo

() protected

commandFlashCharacter

() protected

commandFlashPicture

() protected

commandFlashScreen

() protected

commandFlashVideo

() protected

commandFreezeScreen

() protected

commandGetGameData

() protected

commandGetInputData

() protected

commandGetObjectData

() protected

commandIdle

() protected

Idle

commandInputNumber

() protected

commandInputText

() protected

commandJumpToLabel

() protected

commandL2DDefaults

() protected

commandL2DExitScene

() protected

commandL2DExpression

() protected

commandL2DJoinScene

() protected

commandL2DMotion

() protected

commandL2DMotionGroup

() protected

commandL2DMove

() protected

commandL2DParameter

() protected

commandL2DSettings

() protected

commandLabel

() protected

commandListAdd

() protected

commandListClear

() protected

commandListCopy

() protected

commandListFromText

() protected

commandListIndexOf

() protected

commandListInsertAt

() protected

commandListJoin

() protected

commandListLength

() protected

commandListPop

() protected

commandListRemoveAt

() protected

commandListSet

() protected

commandListShift

() protected

commandListShuffle

() protected

commandListSort

() protected

commandListValueAt

() protected

commandLoadGame

() protected

commandLoop

() protected

Loop

commandMaskBackground

() protected

commandMaskCharacter

() protected

commandMaskPicture

() protected

commandMaskVideo

() protected

commandMessageBoxDefaults

() protected

commandMessageBoxVisibility

() protected

commandMessageFading

() protected

commandMessageSettings

() protected

commandMessageVisibility

() protected

commandMoveCharacter

() protected

commandMoveCharacterPath

() protected

commandMovePicture

() protected

commandMovePicturePath

() protected

commandMoveText

() protected

commandMoveTextPath

() protected

commandMoveVideo

() protected

commandMoveVideoPath

() protected

commandNumberCondition

() protected

commandOpenLoadMenu

() protected

commandOpenMenu

() protected

commandOpenSaveMenu

() protected

commandPanScreen

() protected

commandPauseMusic

() protected

commandPauseTimer

() protected

Pauses Timer

commandPictureDefaults

() protected

commandPictureEffect

() protected

commandPictureMotionBlur

() protected

commandPlayMusic

() protected

commandPlayPictureAnimation

() protected

commandPlaySound

() protected

commandPlayVideo

() protected

commandPrepareSaveGame

() protected

commandRefreshText

() protected

commandResetGlobalData

() protected

commandResetVariables

() protected

commandResumeCommonEvent

() protected

commandResumeMusic

() protected

commandResumeTimer

() protected

Resume Timer

commandReturnToPreviousScene

() protected

commandReturnToTitle

() protected

commandRotateBackground

() protected

commandRotateCharacter

() protected

commandRotatePicture

() protected

commandRotateScreen

() protected

commandRotateText

() protected

commandRotateVideo

() protected

commandSaveGame

() protected

commandSavePersistentData

() protected

commandSaveSettings

() protected

commandScreenEffect

() protected

commandScreenTransition

() protected

commandScript

() protected

commandScrollBackground

() protected

commandScrollBackgroundPath

() protected

commandScrollBackgroundTo

() protected

commandSetGameData

() protected

commandSetMessageArea

() protected

commandSetObjectData

() protected

commandSetTargetMessage

() protected

commandShakeBackground

() protected

commandShakeCharacter

() protected

commandShakePicture

() protected

commandShakeScreen

() protected

commandShowChoice

() protected

commandShowChoices

() protected

commandShowImageMap

() protected

commandShowMessage

() protected

commandShowMessageNVL

() protected

commandShowPicture

() protected

commandShowText

() protected

commandShowVideo

() protected

commandStartTimer

() protected

Start Timer

commandStopMusic

() protected

commandStopSound

() protected

commandStopTimer

() protected

Stop Timer

commandSwitchToLayout

() protected

commandTextEffect

() protected

commandTextMotionBlur

() protected

commandTintBackground

() protected

commandTintCharacter

() protected

commandTintPicture

() protected

commandTintScreen

() protected

commandTintVideo

() protected

commandUIAccess

() protected

commandUnlockCG

() protected

commandVideoDefaults

() protected

commandVideoEffect

() protected

commandVideoMotionBlur

() protected

commandWait

() protected

Wait

commandWaitForInput

() protected

commandZoomBackground

() protected

commandZoomCharacter

() protected

commandZoomPicture

() protected

commandZoomScreen

() protected

commandZoomText

() protected

commandZoomVideo

() protected

compare

(
  • a
  • b
  • operation
)
Boolean

Compares two object using the specified operation and returns the result.

Parameters:

  • a Object
    • Object A.
  • b Object
    • Object B.
  • operation Number
    • The compare-operation to compare Object A with Object B.
    • 0 = Equal To
    • 1 = Not Equal To
    • 2 = Greater Than
    • 3 = Greater or Equal To
    • 4 = Less Than
    • 5 = Less or Equal To

Returns:

Boolean:

The comparison result.

cropObject

(
  • object
  • A
)

Cropes a game object.

Parameters:

  • object gs.Object_Base
    • The game object to crop.
  • A Object

    params object containing additional info.

dispose

()

Disposes the interpreter.

durationValueOf

(
  • object
)
Number

It does the same like numberValueOf with one difference: If the specified object is a variable, it's value is considered as a duration-value in milliseconds and automatically converted into frames.

Parameters:

  • object Number | Object
    • A number variable or constant number value.

Returns:

Number:

The value of the variable.

eraseObject

(
  • object
)
Object

Erases a game object.

Parameters:

  • object gs.Object_Base
    • The game object to erase.

Returns:

Object:

A params object containing additional info.

executeAction

(
  • action
  • stateValue
  • bindValue
)

Executes an action like for a hotspot.

Parameters:

  • action Object
    • Action-Data.
  • stateValue Boolean
    • In case of switch-binding, the switch is set to this value.
  • bindValue Number
    • A number value which be put into the action's bind-value variable.

executeCommand

()

Executes the command at the specified index and increases the command-pointer.

flashObject

(
  • object
  • A
)

Flashes a game object.

Parameters:

  • object gs.Object_Base
    • The game object to flash.
  • A Object

    params object containing additional info.

isInputDataCommand

(
  • pointer
  • commands
)
Boolean

Checks if the command at the specified pointer-index asks for user-input like the Input Number or Input Text command.

Parameters:

  • pointer Number
    • The pointer/index.
  • commands Object
    • The list of commands to check.

Returns:

Boolean:

true if its an input-data command. Otherwise false

isMessageCommand

(
  • pointer
  • commands
)
Boolean

Checks if the command at the specified pointer-index is a game message related command.

Parameters:

  • pointer Number
    • The pointer/index.
  • commands Object
    • The list of commands to check.

Returns:

Boolean:

true if its a game message related command. Otherwise false.

isProcessingMessageInOtherContext

() Boolean

Checks if a game message is currently running by another interpreter like a common-event interpreter.

Returns:

Boolean:

true a game message is running in another context. Otherwise false

jumpToLabel

()

listObjectOf

(
  • object
)
Object

Gets the value of a (possible) list variable.

Parameters:

  • object Object
    • A list variable.

Returns:

Object:

The value of the list variable.

maskObject

(
  • object
  • A
)

Executes a masking-effect on a game object..

Parameters:

  • object gs.Object_Base
    • The game object to execute a masking-effect on.
  • A Object

    params object containing additional info.

messageBoxObject

() gs.Object_Base protected

Gets the current message box object depending on game mode (ADV or NVL).

Returns:

gs.Object_Base:

The message box object.

messageObject

() ui.Object_Message protected

Gets the current message object depending on game mode (ADV or NVL).

Returns:

ui.Object_Message:

The message object.

messageObjectADV

() ui.Object_Message

Gets the game message for adventure-mode.

Returns:

ui.Object_Message:

The ADV game message object.

messageObjectId

() String protected

Gets the current message ID depending on game mode (ADV or NVL).

Returns:

String:

The message object ID.

messageObjectNVL

() ui.Object_Message

Gets the game message for novel-mode.

Returns:

ui.Object_Message:

The NVL game message object.

messageSettings

() Object protected

Gets the current message settings.

Returns:

Object:

The message settings

moveObject

(
  • object
  • position
  • A
)

Moves a game object.

Parameters:

  • object gs.Object_Base
    • The game object to move.
  • position gs.Point
    • The position to move the game object to.
  • A Object

    params object containing additional info.

moveObjectPath

(
  • object
  • path
  • A
)

Moves a game object along a path.

Parameters:

  • object gs.Object_Base
    • The game object to move.
  • path Object
    • The path to move the game object along.
  • A Object

    params object containing additional info.

numberValueAtIndex

(
  • scope
  • index
)
Number

Gets the value the number variable at the specified index.

Parameters:

  • scope Number
    • The variable's scope.
  • index Number
    • The index of the variable to get the value from.

Returns:

Number:

The value of the variable.

numberValueOf

(
  • object
)
Number

Gets the value of a (possible) number variable. If a constant number value is specified, this method does nothing an just returns that constant value. That's to make it more comfortable to just pass a value which can be calculated by variable but also be just a constant value.

Parameters:

  • object Number | Object
    • A number variable or constant number value.

Returns:

Number:

The value of the variable.

objectEffect

(
  • object
  • A
)

Enables an effect on a game object.

Parameters:

  • object gs.Object_Base
    • The game object to execute a masking-effect on.
  • A Object

    params object containing additional info.

objectMotionBlur

(
  • object
  • A
)

Sets the motion blur settings of a game object.

Parameters:

  • object gs.Object_Base
    • The game object to set the motion blur settings for.
  • A Object

    params object containing additional info.

onCallSceneFinish

(
  • sender
)
protected

Called when a scene call finished execution.

Parameters:

  • sender Object
    • The sender of this event.

onChoiceAccept

() Object protected

Called after a choice was selected by the user. It jumps to the corresponding label and also puts the choice into backlog.

Returns:

Object:

Event Object containing additional data like the label, etc.

onCommonEventFinish

() Object protected

Called when a common event finished execution.

Returns:

Object:

Event Object containing additional data.

onInputNumberFinish

() Object protected

Called after an input number dialog was accepted by the user. It takes the user's input and puts it in the configured number variable.

Returns:

Object:

Event Object containing additional data like the number, etc.

onInputTextFinish

() Object protected

Called after an input text dialog was accepted by the user. It takes the user's text input and puts it in the configured string variable.

Returns:

Object:

Event Object containing additional data like the text, etc.

onJumpTo

() Object protected

Called when a hotspot/image-map sends a "jumpTo" event to let the interpreter jump to the position defined in the event object.

Returns:

Object:

Event Object containing additional data.

onJumpTo

() Object protected

Called when a hotspot/image-map sends a "callCommonEvent" event to let the interpreter call the common event defined in the event object.

Returns:

Object:

Event Object containing additional data.

onMessageADVClear

() Object protected

Called when an ADV message finished clear.

Returns:

Object:

Event Object containing additional data.

onMessageADVDisappear

() Object protected

Called when an ADV message finished fade-out.

Returns:

Object:

Event Object containing additional data.

onMessageADVWaiting

() Object protected

Called when a ADV message finished rendering and is now waiting for the user/autom-message timer to proceed.

Returns:

Object:

Event Object containing additional data.

onMessageNVLFinish

() Object protected

Called when a ADV message finishes.

Returns:

Object:

Event Object containing additional data.

onMessageNVLFinish

() Object protected

Called when a NVL message finishes.

Returns:

Object:

Event Object containing additional data.

predefinedObjectPosition

(
  • position
  • object
  • params
)
Object

Gets a position ({x, y}) for the specified predefined object position configured in Database - System.

Parameters:

  • position Number
    • The index/ID of the predefined object position to set.
  • object gs.Object_Base
    • The game object to set the position for.
  • params Object
    • The params object of the scene command.

Returns:

Object:

The position {x, y}.

preview

()

Previews the current scene at the specified pointer. This method is called from the VN Maker Scene-Editor if live-preview is enabled and the user clicked on a command.

restore

(
  • bundle-
)

Restores the interpreter from a data-bundle

Parameters:

  • bundle- Object

    The data-bundle.

resume

()

Resumes the interpreter

rotateObject

(
  • object
  • A
)

Rotates a game object.

Parameters:

  • object gs.Object_Base
    • The game object to rotate.
  • A Object

    params object containing additional info.

scrollObjectPath

(
  • object
  • path
  • A
)

Scrolls a scrollable game object along a path.

Parameters:

  • object gs.Object_Base
    • The game object to scroll.
  • path Object
    • The path to scroll the game object along.
  • A Object

    params object containing additional info.

setBooleanValueAtIndex

(
  • scope
  • index
  • value
)

Sets the value of a number variable at the specified index.

Parameters:

  • scope Number
    • The variable's scope.
  • index Number
    • The index of the variable to set.
  • value Boolean
    • The boolean value to set the variable to.

setBooleanValueTo

(
  • variable
  • value
)

Sets the value of a boolean/switch variable.

Parameters:

  • variable Object
    • The variable to set.
  • value Boolean
    • The boolean value to set the variable to.

setListObjectTo

(
  • variable
  • value
)

Sets the value of a list variable.

Parameters:

  • variable Object
    • The variable to set.
  • value Object
    • The list object to set the variable to.

setNumberValueAtIndex

(
  • scope
  • index
  • value
)

Sets the value of a number variable at the specified index.

Parameters:

  • scope Number
    • The variable's scope.
  • index Number
    • The index of the variable to set.
  • value Number
    • The number value to set the variable to.

setNumberValueTo

(
  • variable
  • value
)

Sets the value of a number variable.

Parameters:

  • variable Number
    • The variable to set.
  • value Number
    • The number value to set the variable to.

setStringValueAtIndex

(
  • scope
  • index
  • value
)

Sets the value of the string variable at the specified index.

Parameters:

  • scope Number
    • The variable scope.
  • index Number
    • The variable's index.
  • value String
    • The value to set.

setStringValueTo

(
  • variable
  • value
)

Sets the value of a string/text variable.

Parameters:

  • variable Object
    • The variable to set.
  • value String
    • The string/text value to set the variable to.

setup

()

Sets up the interpreter.

shakeObject

(
  • object
)
Object

Shakes a game object.

Parameters:

  • object gs.Object_Base
    • The game object to shake.

Returns:

Object:

A params object containing additional info about the shake-animation.

showObject

(
  • object
  • position
  • A
)

Shows a game object on screen.

Parameters:

  • object gs.Object_Base
    • The game object to show.
  • position gs.Point
    • The position where the game object should be shown.
  • A Object

    params object containing additional info.

skip

(
  • indent
  • backward
)

Skips all commands until a command with the specified indent-level is found. So for example: To jump from a Condition-Command to the next Else-Command just pass the indent-level of the Condition/Else command.

Parameters:

  • indent Number
    • The indent-level.
  • backward Boolean
    • If true the skip runs backward.

start

()

Starts the interpreter

stop

()

Stops the interpreter

storeListValue

(
  • id
  • parameters
  • wait
)

Calls a common event and returns the sub-interpreter for it.

Parameters:

  • id Number
    • The ID of the common event to call.
  • parameters Object
    • Optional common event parameters.
  • wait Boolean
    • Indicates if the interpreter should be stay in waiting-mode even if the sub-interpreter is finished.

stringValueAtIndex

(
  • scope
  • index
)
String

Gets the value of the string variable at the specified index.

Parameters:

  • scope Number
    • The variable's scope.
  • index Number
    • The index of the variable to get the value from.

Returns:

String:

The value of the variable.

stringValueOf

(
  • object
)
String

Gets the value of a (possible) string variable. If a constant string value is specified, this method does nothing an just returns that constant value. That's to make it more comfortable to just pass a value which can be calculated by variable but also be just a constant value.

Parameters:

  • object String | Object
    • A string variable or constant string value.

Returns:

String:

The value of the variable.

targetMessage

() ui.Object_Message protected

Gets the current target message object where all message commands are executed on.

Returns:

ui.Object_Message:

The target message object.

targetMessageBox

() ui.Object_UIElement protected

Gets the current target message box containing the current target message.

Returns:

ui.Object_UIElement:

The target message box.

tintObject

(
  • object
  • A
)

Tints a game object.

Parameters:

  • object gs.Object_Base
    • The game object to tint.
  • A Object

    params object containing additional info.

toDataBundle

() Object

Serializes the interpreter into a data-bundle.

Returns:

Object:

The data-bundle.

update

()

Updates the interpreter and executes all commands until the next wait is triggered by a command. So in the case of an endless-loop the method will never return.

wait

(
  • time
  • callback
)

Halts the interpreter for the specified amount of time. An optionally callback function can be passed which is called when the time is up.

Parameters:

  • time Number
    • The time to wait
  • callback gs.Callback
    • Called if the wait time is up.

waitForCompletion

(
  • object
)
Object

Lets the interpreter wait for the completion of a running operation like an animation, etc.

Parameters:

  • object gs.Object_Base
    • The game object the operation is executed on. Can be null.

Returns:

Object:

A params object containing additional info.

waitForMessage

() Boolean

If a game message is currently running by an other interpreter like a common-event interpreter, this method trigger a wait until the other interpreter is finished with the game message.

Returns:

Boolean:

true a game message is running in another context. Otherwise false

zoomObject

(
  • object
  • A
)

Zooms/Scales a game object.

Parameters:

  • object gs.Object_Base
    • The game object to zoom.
  • A Object

    params object containing additional info.

Properties

conditions

Number protected

Stores states of conditions.

context

gs.InterpreterContext protected

The execution context of the interpreter.

graphicAnchorPointsByConstant

gs.Point protected

Mapping table to quickly get the anchor point for the an inserted anchor-point constant such as Top-Left(0), Top(1), Top-Right(2) and so on.

indent

Number protected

Current indent-level of execution

isRunning

Boolean

Indicates if the interpreter is currently running.

isWaiting

Boolean

Indicates if the interpreter is currently waiting.

isWaitingForMessage

Boolean

Indicates if the interpreter is currently waiting until a message processed by another context like a Common Event is finished. FIXME: Conflict handling can be removed maybe.

loops

Number protected

Stores states of loops.

pointer

Number

Index to the next command to execute.

previewData

Object protected

Stores Live-Preview related info passed from the VN Maker editor like the command-index the player clicked on, etc.

previewInfo

Boolean protected

Stores internal preview-info if the game runs currently in Live-Preview.

  • previewInfo.timeout - Timer ID if a timeout for live-preview was configured to exit the game loop after a certain amount of time.
  • previewInfo.waiting - Indicates if Live-Preview is currently waiting for the next user-action. (Selecting another command, etc.)
  • previewInfo.executedCommands - Counts the amount of executed commands since the last interpreter-pause(waiting, etc.). If its more than 500, the interpreter will automatically pause for 1 frame to avoid that Live-Preview freezes the Editor in case of endless loops.

repeat

Boolean

Indicates if the interpreter automatically repeats execution after the last command was executed.

settings

Object protected

Stores interpreter related settings like how to handle messages, etc.

subInterpreter

gs.Component_CommandInterpreter protected

Sub-Interpreter from a Common Event Call. The interpreter will wait until the sub-interpreter is done and set back to null.

waitCounter

Number

Wait-Counter in frames. If greater than 0, the interpreter will for that amount of frames before continue.

waitingFor

Object protected

Stores information about for what the interpreter is currently waiting for like for a ADV message, etc. to restore probably when loaded from a save-game.