A variable could easily be used to track the score, even between scenes, and then a score gadget can be set by the variable's value and posted. Or the score gadget could be used to track a value, and then a variable gadget could be set by the score's value and persisted between scenes.
# Variable
A variable gadget defines a variable that stores a number value for a name, and can be modified by Variable Modifier gadgets.
The name of the variable is defined by the name of the gadget. These names are case sensitive (eg. P1 is a different variable to p1). (Jj) (Tg)
These values can be stored between scenes and between playthroughs of the Dream the scene is in, by making the variable persistent.
Persistent variables can be used to store and restore the state of gadgets between sessions or scenes. (Tg) They can even be used to detect if the player is coming back to a dream or if they are coming to it for the first time, and change behaviours depending. (Tg)
# Memory: Costs 0.0061% of the things limit per gadget. Costs 0.0061% of the wires & animation limit per connection to a Variable Modifier based on the scoping rules.
There is no limit for non-persistent variables. There is a limit for how many persistent variables can be stored per dream.
Tweak Menu
# Initial Value
The variable will have this value when the variable is not persistent, or has no stored value for the name of the variable. (Tg) If this variable persists in the Dream and its value has been stored as something else, the gadget will have that value instead.
Cannot go below the Minimum Value or above the Maximum Value.
# Minimum Value, Maximum Value
The lowest and highest value the variable can have. (Tg)
The minimum setting cannot go higher than the set initial value.
The maximum setting cannot go lower than the set initial value.
# Multiplayer
When on, each player will have their own value stored within the same variable that can be modified separately. (Jj) (Tg)
# Persist In Dream
When on, the variable’s value will be stored when the player leaves the scene. If the Restore on Rewind setting is off, the value is also stored when the player rewinds the scene or the scene is reset.
Note, there is a limit of how many persistent variables can be stored for a single dream.
When a scene loads that contains a variable gadget with the same name and “Persist in Dream” turned on, the stored value will be retrieved. (Tg) Using this, you can transfer data between scenes and play sessions. (Jj) (Tg)
These values are shared across dreams contained inside a parent dream, unless the “Dream within a Dream” setting is turned on for the sub-dream.
Note, it is not required to have a variable in a scene if it does not need to be accessed. (Tg)
# Force Reset
When on, at the start of the scene the stored value is reset to the initial value. Note this happens even if the variable gadget is unpowered. (Tg)
# Restore Value on Rewind
Dictates how the variable’s value is handled when the player rewinds the scene or the scene is reset using the global settings gadget.
When on, the value will be reset to the initial value. When off, the value will be retained. (Tg)
# Current Value
Sends the current value of the variable. (Tg)
When multiplayer is turned on, each player's variable value is sent as part of the Player Info wire.
# Value Increased, Value Decreased
Pulses when the variable’s value is increased by a variable modifier gadget. (Tg)
# Variable Modifier
A variable modifier gadget changes the value of the variable indicated by its name. (Tg)
Note that there must be an existing variable gadget with that name in the scene, to be able to set its value. (Tg)
Using modifiers, we can create a simple stats system that drains and replenishes in different ways. (Tg) Or a menu that saves your settings for the game. (Tg) Even a value that loops around to the start/end like a selector. (Tg)
Memory: Costs 0.0061% of the things limit per gadget.
Uses 1 wire per variable gadget it can affect.Tweak Menu
# Variable Name
You can adjust the value of this field to cycle through the names of all variable gadgets within the scene and all variable modifier “variable name” values within the scene. (Tg)
Dictates which variable will be modified, by the name of the variable gadget. (Jj)
# Operation Type
How the variable’s value will be modified. (Jj)
# Update Type
When the variable’s value will be modified. (Jj)
# Scope
# Operation Value
The value used to modify the variable, as defined by the operation type.
When the variable has “multiplayer” turned on and a Player Info wire is setting this value, connected players’ variable values will be independently modified according to the values in the wire.
# Variable Value
Outputs the variable’s current value. (Jj)
# Score
Stores the current score, and can post it to a scoreboard of the same name. (Jj)
The name of the gadget is used to set up a new scoreboard if necessary.
Memory: Costs 0.0061% of the things limit per gadget.
# Score Settings Tab
# Multiplayer
If you want to have the score be counted as many players working together, leave this setting off so that it’s just a single score. (Jj)
# Post Score
Will post and replace the player's current score if the following are true (Jj):
- The latest released version of the dream is being played. Or the latest private version of the dream is being played and there is no public version of the dream.
- The dream has a scoreboard set up.
- Their new score is better than their existing score on the scoreboard.
Note, it is recommended to wait a second or two before triggering an exit doorway to ensure posting the score is not interrupted.
If the player's old score was made before this play session, a notification will pop up informing them of their new personal best score.
If no scoreboard is set up and the player is the owner of the dream, a new scoreboard will be created according to the Default Scoreboard Settings, and the score will be posted to it.
When multiplayer is on, if the “post score” input receives a signal that is a Player Info fat wire, only players for whom the corresponding signal is positive > 0 will be posted. (Jj) (Jj) However, if a non-Player Info wire value is sent, all stored scores will be posted. (Jj)
# Scoreboard Default Settings Tab
Used to set up a new scoreboard, when required. Does nothing if a scoreboard has already been set up.
# Score Unit
Sets the scoreboard's Score Unit setting.
Has the options Number (eg. number of coins collected), and Time (eg. a race lap time).
# Better score is…
Sets the scoreboard's Better score is... setting.
Has the options Higher (eg. how many coins were collected), and Lower (eg. a race lap time).
# Multiplayer Boards
Sets the scoreboard's Multiplayer Boards setting.
Has the options Separate (eg. a race lap time), and Combined (eg. how many coins were collected by the team).