Skip to content

GameVariablesModule

ChrisVoice edited this page Dec 3, 2015 · 2 revisions

Game Variables

The game variables module allows having server variables that are stored in the database, created and modified in the editor and can be accessed on both cache and slave servers. Any changes made in the editor will trigger the reloading of the variables on the servers from the database. The variables can be an integer, float, string or an anonymous object (entered as JSON-encoded string in the editor).

Creating and editing game variables does not require any special APIs. You can click the "Game variables" link located in the top menu of the editor and see the add variable form and the list of existing variables.

The slave server game variables module is snipe.slave.modules.VarsModuleCore. It provides various get methods for different variable types. Its cache server copy is called snipe.cache.modules.VarsModuleCacheCore.

The usage example is simple:

var price = server.coreVarsModule.getInt('battle.price');
Clone this wiki locally