Skip to content

Load State

Load State

Loads a previously saved game state from the specified index.

Properties

System

Name Explanation Type
Result The switch to store whether the load operation succeeded. Switch or Value
State Index The index of the saved state to load. Variable or Value
Store Results When enabled, the result of the load operation is stored in a switch. Toggle
Use Transition When enabled, the scene transition effect plays when loading the state. When disabled, the state loads immediately without a transition. Toggle

Examples

Load the Game State from Slot 1

This loads the previously saved game state from slot index 1, playing the scene transition effect.

load_state(1);
{"Data":{"Result":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"StateIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"StoreResults":false,"UseTransition":true,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.StateData.LoadStateCommand"}

Load the Game State without a Transition

This loads the game state from slot 2 immediately, skipping the scene transition effect.

load_state(2, no_transition);
{"Data":{"Result":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"StateIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"2","VariableIndex":0,"Metadata":null},"StoreResults":false,"UseTransition":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.StateData.LoadStateCommand"}

Load a Game State from a Variable and Store the Result

This loads the game state from the slot specified by Global Variable 0, storing whether the load succeeded in Global Switch 0.

$gs[0] = load_state($gv[0]);
{"Data":{"Result":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"StateIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":true,"UseTransition":true,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.StateData.LoadStateCommand"}