New website for the relaunch

This legacy website pertains to the classic version of The Secret World. We have made a brand new website for Secret World Legends, the relaunched game!

Go to new website
Post Details

Chat Scripts

Posted by Chosen-Blood on March 5, 2015
Last updated by Vikestart on March 6, 2015
More Less Jump to:



Scripts should be used with respect for other players. Big fonts or too many bright colors directly in the chat window will not be appreciated and may cause people to put you in their ignore list.

Also make sure to test your scripts in a custom channel before using them in populated chat rooms. If something in your script is broken, the chat window will fill up with broken code. To create your own custom channel type:

/chat join [ChannelName]

Where [ChannelName] should be replaced with the name you want to use for your test channel.


Scripts in TSW is a way to significantly expand the range of things we can do in the chat window. Some common tasks we can accomplish with scripts are:

  • Colored text
  • Sequences of chat commands
  • Pop-up windows
  • Links

Before we go into making our own scripts we will first have a look at what scripts are and how to use them.

Script files

Scripts are text files stored in a specific folder inside your game folder. For a script to be available in game, it has to be stored in the following location:

 ../The Secret World/Scripts

If the Scripts folder does not exist on your computer, you can create it yourself in the location listed above.

In the game script files are accessed by their full names, including the file extension. It’s therefore common to leave script files without an extension. If you’re using the regular notepad on windows, it will automatically add .txt to the end of your file name. To remove the extension, go into your Scripts folder, make sure the folder is set to show file extensions. Then remove the extension from the name.

Using Scripts

Using scripts is simple. Go to your chat window in the game, type a forward slash followed by the name of your script file. For example, a file called helloworld.txt would by called by typing the following in the chat:


If your script outputs text, it will show in the currently active channel.


Scripts can use variables to pass along words from the chat into the script. Each word after the file name will be put into the variables %1, %2, %3… and so on, or %* for all the words that follow.

Example 1

My name is %1 and I like %2.
/helloworld.txt Chosen-Blood tacos
My name is Chosen-Blood and I like tacos.

Example 2

I love %*!
/helloworld.txt TSWDB and ice cream
I love TSWDB and ice cream!

Other variables

%m – Your own name

%t – Your target’s name

%f – Hostile target’s name

%0 – The name of the script


We use the <font> tag along with the color attribute to write in a different color.

For the sake of the rest of us, please don’t use colors directly in the chat more than necessary.

Example 1

This text is <font color=red>red</font>.
This text is red.

Example 2

<font color=#ed8ec9>%*</font>
/pink This text is pink.
This text is pink.

List of some available predefined colors:

Text size

There is a limited amount of sizes you can choose from. Each size (font face) is defined in file inside your game folder. This file can be altered to change how big the text in your own chat window will appear. This also means that people who have altered this file may see your scripts differently than you do.

And even more so here than with the colors, think before you cover the entire chat window with a huge font.

Example 1

<font face=normal>Smaller text</font>
Smaller text

Example 2

<font face=large_bold>%*</font>.
/bold This text is bold.
This text is bold.

Note: The standard font face in the chat window is LARGE

Full list of font faces:

Chat commands

Basically you could think of your notepad as a chat window. Each new row is another line in the chat. And on any one of those lines you can use any command you would in the game.

Example 1

/say Hi %t
1 – Emote: wavebig
2 – Hi Vikestart

There is one command in particular that you will have use for in your scripts. The delay command will allow you to set an ammount of time in milliseconds that will pass before the next command is executed.

Example 2

/delay 5000
/delay 5000
1 – Emote: dance_runningman
– 5 second delay
2 – Emote: dance_gangnam_style
– 5 second delay
3 – Emote: dance_samba

You can also cause the script to call itself. This will cause an infinite loop. The script will continue to repeat itself until the game thinks you’ve had enough or you reload your ui (ctrl + shift + F1).

Example 3

/delay 4000
1 – Emote: dance_funkychicken
– 4 second delay
2 – Emote: dance_funkychicken
– 4 second delay
3 – …


Before going into popups you should have some knowledge of the different types of links we can use. If you’re familiar with HTML, you’ll recognize the <a href=””> … </a> tag for links.

There are three different types of links we can use in the game.

<a href=”itemref:// … “>Click Here</a>
All linked items in the game uses this. Sometimes when someone links too many items at once (exceeds the character limit of scripts), the code will brake and you will see this between the lines. Will not be going into depth on item references in this guide.
<a href=”chatcmd:// … “>Click Here</a>
Used to trigger chat commands from within a popup. Using this in a popup will allow you to create buttons which other players can click to trigger chat commands.
<a href=”text:// … “>Click Here</a>
This is how we create a popup.

There are 3 important things in particular you’ll want to keep track of when creating links.

1. The character limit is somewhere around 3000 characters. If you start approaching this limit, make sure to test your script with a friend first. Only people other than you will see if your script breaks due to the character limit being breached.
2. Everything in your script has to be written on the same line. A new line is the same as a new command, which will break your link. (However 2 different links of up to around 3000 characters each can be placed on 2 different rows.)
1. If you’re nesting links (a button in a popup), you need to keep track of your quotation marks. Generally you’ll want to use double quotations for the outermost one, single quotations for the next and if you need more quotations you can use &quot;. If you start a link with a double quotation and use another double quotation within the link, the game will read it as the end of the link.


Make sure you read the paragraph about links above before continuing. If you have done so, you know the most important things we’ll need to create our first popup.

Example 1 – Simple popup

<a href=”text://<CENTER><BR><FONT FACE=HEADLINE COLOR=ENCHANTED>My first popup!</FONT></CENTER>”>Click me!</a>

Tags that can be used in popups

<FONT> … </FONT>
Applies from start tag to end tag, described in the beginning of the guide.
<A HREF=’chatcmd:// … ‘> … </A>
Additional links can be put inside the popup to trigger chat commands (including opening the browser).
Creates a new line, requires no end tag.
Aligns all text to the left from start to end tag.
Centers all text from start tag to end tag.
Aligns all text to the right from start to end tag.

Example 2 – Emote Link

<a href=”text://<DIV ALIGN=CENTER><A HREF=’chatcmd:///lookup’>Up</A></DIV><DIV ALIGN=LEFT><A HREF=’chatcmd:///lookleft’>Left</A></DIV><DIV ALIGN=RIGHT><A HREF=’chatcmd:///lookright’>Right</A></DIV>”>Look here!</a>

Up – Emote: lookup
Left – Emote: lookleft
Right – Emote: lookright

Example 3 – Browser Link

<a href=”text://<CENTER><FONT COLOR=#AACCFF FACE=COMBAT_FEEDBACK>Browser Link</FONT><BR><BR><FONT FACE=HYBORIANLARGE><A HREF=’chatcmd:///option WebBrowserStartURL &quot;%1&quot; \n /option web_browser 1′>%1</A></FONT>”>%1</a>

Link – Open browser to

Something you’ll notice in the previous example if you look closely is we’re using two commands in the same link. The first to set the starting URL of the browser, the second to open the browser. Between them you can see the character \n which is the character for a line break. As stated earlier, a new line means a new command. So setting a new line within our link allows us to call more than one command.

Example 4 – Styled Link

<a style=”text-decoration:none” href=”text://<CENTER><A STYLE=’text-decoration:none’ HREF=’chatcmd:///option WebBrowserStartURL &quot;; \n /option web_browser 1′><FONT FACE=LARGE COLOR=#FF99EE>[Pony]</FONT></A>”><font face=LARGE color=#FF99EE>[Pony]</font></a>

Pony – Opens a picture of ponies

Special Scripts

There are script names that are reserved for the game. For example we can’t name our scripts magic or tp since these are commands for game masters. But there are two special script names we can use. These are auto_login and auto_teleport.

auto_login will trigger whenever you log onto your character.
auto_teleport will trigger whenever your character enters a new zone.

These files are very useful for joining custom chats such as #noobmares and #sanctuary automatically when you log on. You can read more about these scripts and other useful channels to join in this forum thread by Hatkake:

Like what we do? Help us keep doing it!
A small donation goes a long way to keep the site up and running. Donate