Managana variable handling

The Managana progress code can handle numeric and string variables since the 1.3.0 version. While these variables can be set using the CODE  group, the variables can be widely used among all progress code with simple marks.

numeric variables

If you want to use an assigned numeric variable, just place the # mark before a valid name and Managana will replace it by the corresponding value. If the name is not valid, it is simply ignored. Check ou this example:

CODE->setNumber->myVar->0
this will create a numeric variable named myVar with the value 0

INSTANCE->myInstance->set->x->#myVar
this will make the instance named myInstance to move to x position 0

Conditions may also use the # marks:

CODE->ifNumHigher->1->#myVar
this will return true if 1 is higher than the value stored at myVar

CODE->ifNumEqual->#myVar1->#myVar2
this will check if the variables named myVar1 and myVar2 are equal

string variables

The string variables work much like the numeric ones. Just use the $ mark for them:

STREAM->load->$storedstreamid
this will load the stream id stored at the storedstreamid variable

saving and loading variables

Managana can save the current variable set (numeric and string) to the local filesystem or to your web server (if you prefer, at the cloud). If the user is logged, the save is done at the server, if not, at the local filesystem. Notice that the save and load commands are assynchronous and may not be effective for some time after you call them.

The values are saved and loaded related to the current community, however, unlike you may expect, when you load a new community all values set are kept – they will only be erased from memory if you manually request so, like using CODE->clearAllValues.

community values

To exchange data among users, Managana supports the community values. Unlike normal variables, these values must be defined at the editor at the community menu. Community values may be loaded and set with progress code, but do it carefully: if it is changed by one user, it is changed for all of them. That’s why the number operations for community values are always done directly on server. This enables you to create counters an alikes without messing the data.

Community values can also be used at your progress code: their mark is % if they are numeric or string, like:

INSTANCE->myInstace->set->width->%comSetWidth
this will force the instance myInstance width to the community value named comSetWidth

meta data

You can set meta data fields at the community properties. Then, you may set values for these meta data for each of your streams. In order to retrieve the current stream value for a meta data, use the & mark at the progress code. An example:

CODE->ifStrEqual->&color->red
this will check if the meta value color for current stream is red

Category: Sem categoria One comment »

One Response to “Managana variable handling”

  1. Managana progress code reference — Managana Org

    […] All progress code commands start with the action group name followed by the -> chars. Below, you’ll find some reference about all progress code commands currently available on Managana. Code marked with * was add at the latest version (1.3.0). Also, since version 1.3.0, Managana can handle numeric and string variables. If you want to learn more about how to use them, check this link: http://www.managana.org/managana-variable-handling/ […]


Leave a Reply



Back to top