Custom tokens

Custom Tokens
Easier than one might think. All a custom token is, is simply a number representation of a string, kinda like the Constants in nwscript. Here is a simple "follow along" tutorial for custom tokens.


 * Make a conversation on a NPC like the following,

+Root 1 - NPC: "Hello" 2 - ..PC: "What is your favorite Color?" 3 - ....NPC: "My Favorite Color is "

Save the file and and attach it to a NPC.


 * Place this script in the "Actions Taken" of Line 1. This will set up the custom token for you, chooseing a random color.

void main {   switch(d4) {       case 1: SetCustomToken(2000,"Red");break; case 2: SetCustomToken(2000,"Blue");break; case 3: SetCustomToken(2000,"Green");break; case 4: SetCustomToken(2000,"Yellow");break; } }

Now when Line 3 is spoken, either Red, Blue, Green, or Yellow will be spoken in place of the .

Some points to remember: Custom tokens, once set, will remain set until changed, so be sure to set them up before you need them. Custom Tokens will work in the names of placeables, but not NPC names, or Item names. They do not work in the discriptions of placables.