store( storevar )


Parameters

  Type Description
storevar lvalue variable to store

_result

Not set.

Descriptions

Normally all user variables are cleared at the start of each game in a match. The store command allows a robot to pass the values of variables from one game to the next. This gives robots the ability to learn during a match.

The store command keeps the current value of storevar in a permanent storage location for the entire match. A deep copy of storevar is made so that array and property elements are also kept. When a new game starts, all stored variables are automatically restored. A restored variable has the same value it contained the last time store was called for that variable in a previous game. If the value of a variable changes after store is called, those changes are not restored in the next game.

In the code below the var variable is set to a value of 20 and then stored. This stores 20, the current value of var, in a permanent location. The line following the call to store changes the value of var to 30. This does not affect the stored value for var, however, which remains 20. When the next game starts, the value of var is restored to 20.

var = 20
store( var )
var = 30


The store command can only be used to pass the values of variables between games. This is no way to pass the values of variables between matches.

See Also

user variables