-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'persist' Keyword #463
Comments
The pathmap editor allows you to save & load your pathmaps (see the "How to save & load" section here) by copying the current global variable values in the inspector. The actions copied here can be pasted into a rule to load a save. Any global variables with the For example: // Include the players progress as part of the save game!
persist globalvar Number PlayerProgress = 0;
// Global variable containing an array of effects.
globalvar Any[] EffectArray = []; If the player progresses through the game then saves the game with the action copy, the save will look something like this: actions {
Global.PlayerProgress = 5;
Global.EffectArray = [Null, Null, Null, Null, Null, Null];
} The player can load this save by pasting it into an empty rule. However, the variables
{
global:
0: __loadPersist -- ostw generated variable: will be True if the player is loading a save.
1: PlayerProgress
2: EffectArray
}
-- ostw generated rule to assign variable defaults
rule("Initial Global")
{
actions
{
-- Assigns defaults as normal.
Set Global Variable(EffectArray, Empty Array);
-- Any variables with the `persist` keyword has their initialization placed inside this If.
-- These will not be given the default value if a save was loaded.
If(Not(Global Variable(__loadPersist)));
Set Global Variable(__loadPersist, True);
Set Global Variable(PlayerProgress, 0);
End;
}
}
todo: get this info on the wiki |
I noticed you used the 'persist' keyword in Pathmap, but there's no related documentation in the wiki. Can you tell me what it's used for?
The text was updated successfully, but these errors were encountered: