Keyword Parsing

Sometimes messages and other elements need customization, such as inserting player names or extra descriptors. This can be achieved by using the built in parsing capability of Multistage.

General Parsing

Parsing replaces a particular key expression with a corresponding value. The implementation chosen for Multistage is to have the keys in the form of a key-pod. A key-pod is an expression of a key surrounded by '%' For example, %this% is a key-pod.<br> Further implementation details (these apply to both server and client side):

  1. A key-pod will be ignored if it is preceded by a \. For example, this \%key-pod% is ignored. This is intended to be used to write %'s without being interpreted.
  2. If a key-pod is not found in any of the resources available, the key-pod will not be replaced.

Server-Side Parsing

Parsing can be done on server side using the parseString method. The server-side has two information sources to search: the configuration file and a Hashtable passed in. The default order for searching is to search the Hashtable first, and then resort to the configuration file only if it does not find it in the Hashtable. If no Hashtable is passed into the parseString method, then it defaults to searching the configuration file.

Client-Side Parsing

Parsing can also be done on client side using the parseString method. Unlike server-side parsing, the client-side has only one source of information. All keys must be passed in as keys in the Information object sent in the ask* methods. Also, unlike the server-side, there are several key-pods that are reserved for system use (or rather, they take precedence over any user defined keys of the same name). These keys are currently:

  1. id: the ClientData ID
  2. groupSize: the group size
  3. partnerNum: the partner number index

Parsing Danger

There is no implementation in the parsing software to stop a spinlock. This means that if a key-pod points to itself it will not break from it. For example, don't set the following:

        #conf file or hashtable
        first = %first%

Since the process is iterative, it will not stop parsing. This will not be a problem unless you make it a problem. There is no legitimate use.