Server Custom Tokens

From Sinfar

Server Custom Tokens

This system is a mandatory alternative to the default CustomToken system, where all <CUSTOMXXX> occurrence get replaced by a value set by the SetServerCustomToken(XXX, "value"); function.

It works the same way except that these tokens use the format:

%%%%XXXX

where XXXX is the ID of the token, for example:

My name is %%%%2010

Its value is set by using the Get/SetServerCustomToken functions.

SetServerCustomToken(2010, "Name");

The listen token will always be

%%%%1000

The node print token will always be equal or superior to 2000

%%%%2XXX

The difference with the default system is that these tokens are replaced in the text before that the text is sent to the client. This system should fix the issue where players sometime don't see the right token value. Also, those tokens can be used in more places: any name, description, chat message and more...

Furthermore the default system custom tokens are sent to everyone and every time when they are set or edited. So it is a potential cause of latency, server and client side.

Therefor any scripted conversation HAS TO USE this system !

If you want to add colors to your dialog, you still need to use a default custom token, but it is not really a problem since color tokens only need to be set once and then never change. There is a shared ERF for everyone to add the color tags that they need: https://nwn.sinfar.net/res_nss_edit.php?name=cstmtok_ev_load.