In a browser, JavaScript scripts can store persistent data (the data which survives page reload) using a localStorage mechanism.
We’ve added the similar functionality to the Bots Playground: localStorage.set() and localStorage.get() functions.
These two functions store and retrieve values to/from a persistent storage:
var controlling_avatar = localStorage.get("my_master"); ... if(new_master) { controlling_avatar = new_master; // We want to know our master's name even after a script restart localStorage.set("my_master", new_master); }
You can use them to keep data when your Playground script restarts, or even share the data between scripts of the same bot (different bots can’t share their localStorages yet).
Check for more new functions usage examples in Bots Playground Examples section.