11/7/2022 0 Comments Custom tokens![]() ![]() Custom tokens are exactly the same, but rather than having a limited pre-defined set of possible substitutions, they can be used to insert just about anything at all. These are the placeholders like or that you embed into the conversation line to be replaced with the correct actual information during conversation execution. There are many pre-defined tokens available in the conversation editor. If you have made any conversations in NWN, you are probably already quite familiar and indeed comfortable with the use of tokens. During play, when the text block is ready to be displayed, the game replaces the placeholder token in the text block with the current contents of the custom token string variable associated with it through its token number. #Custom tokens codeInstead of regular access methods, and this is where the token part of their name comes from, a special code or placeholder, also known as a token, is embedded into normally static text blocks like conversation dialog lines and journal entries. ![]() Because of this, it is sometimes necessary to duplicate the contents in a local or campaign string variable in order for your scripts to be able to remember what was stored in the token. ![]() In fact, there is (unfortunately) no function that will give you the contents stored in a custom token. Setting them to a specific value in the toolset would effectively cause them to revert back to static text, rendering them useless.Ĭustom tokens are not accessed like other variables, either. As you'll see shortly, if you were to be able to set them in the toolset, they would not be the dynamic entities that they are. This is not short-sighted design, but rather emphasizes their purpose and nature. Custom token values cannot be set in the toolset, only from scripts. You use a function call to change their value from a script, just like you do for local & campaign strings. They start out empty and wait to be given some text to store. This is probably the reason why they are identified by number rather than by name.Ĭustom tokens work much more like local and campaign strings than anything else. No matter where you reference them from, you always get the exact same variable. ![]() Custom tokens are the only truly global variables in NWScript. A local or campaign string on one object and another with the same name on a different object will be separate entities, local to the object they are stored on. With them you can access the same variable from different scripts, as long as you can find the object it is stored on from both places. While local and campaign variables are significantly more global than script variables, they are tied to specific objects. Setting the value of one has no effect on the value of the other. When you declare a string variable in one script, then declare another string with the same name in a different script (or even in just a different spot in the same script), you get two entirely separate variables that don't interfere with each other. Let's remind ourselves how normal string variables work. Unlike other variables, custom token #22 in one script refers to the same variable in every other script. They don't have to be declared like other variables - there are just a set number of them, and they always exist. Custom token variables on the other hand are only identified by number. Most string variables, like parameters and variables defined in scripts, or local and campaign strings stored on objects, are identified using a name you make up. What makes custom tokens different from other strings is how they are stored and used. ) which are used to insert specific game information into a conversation. It is somewhat similar to the pre-defined tokens (e.g. ) is a special type of string variable that can be used to insert any dynamic information of your choice into blocks of text during gameplay. So let's start at the top with a basic definition of what they exactly are.Ī custom token (e.g. What are custom tokens? What are they used for? And how do I use them? Those are the questions this tutorial will explore.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |