• Season 2 of Secret World Legends is now live with Dawn of the Morninglight!

    Please avoid posting any story spoilers on the forums. If you must share info or ask for help with a mission, be sure to use a [spoiler] tag!

The Script Crypt

Bagofcats

Cat Delivery System
Staff member
Officer
Slayer of Spam
We chatted about this with Shizu and Morven a couple of days ago (thank you Shizu & Morven, great idea! XD). So here we start. We'll make it grow with time. Add each script into its own reply-post, with a short description of what it does, a link to the script file or the actual script in between code tags, like this

[CODE]
code line
code line
etc
[/CODE]

I, or another moderator, will add it to the list here :)

-------------------------------------------

A scripts repository

Auto Login - file auto_login automatically executes a list of commands as you login. Mostly used to auto-join different chat channels, although other commands will also be executed, for example /logcombat on.
Auto Teleport - file auto_teleport, also an internal SWL call, works in the same way as auto_login, except it executes when zoning and anima well-jumping. I don't have current information, but once upon a time in TSW, switching characters could drop your auto_login subscriptions and you could thus re-subscribe by just zoning.

Simple Code of Conduct Clickable Chat Check - The usual have you read and do you accept, etc, conditions for joining LoMS - without fluff or cookies
LoMS Recruitment Script - In Technicolor!
Chat shortcuts - and it's also a good introduction to the use of the alias command
Gear Manager Script - for the command line ninjas out there
 
Last edited:
The basics of scripting

For more advanced scripting, there's a neat add-on: Script Builder

Note - Make a custom channel to test your script, don't spam the common channel: /chat join test (or replace 'test' with whatever name you want to use)

To create a script just create a basic raw text file. Any raw text or code editor will do fine: Notepad, Notepad++, Atom, Brackets, TextWrangler, to just list a few of the more popular options.
  • Each line will be a separate command
  • Give the file a name, usually without a type extension (although it works as well with the default extension of .txt)
  • Save the file in the scripts folder in main installation folder of Secret World Legends
  • Call it up from the chat line with /file_name (or /file_name.txt if you saved the file with a .txt extension)

scripts-directory.png

To use the Code of Conduct check script as an example, it looks like this:
Code:
Have you read and do you accept the cabal's <a href="text://<font face=Large><a href='chatcmd:///option WebBrowserStartURL &quot;http://www.lomsglobal.com/index.php?threads/code-of-conduct.240/&quot; \n /option web_browser 1'>Weblink to the cabal's Code of Conduct (click)</a></font>">Code of Conduct? (click for link)</a>

For a parse of the different parts in this line, here's a good intro to scripts:
(Legacy) Chat Scripts - TSW Database
 
Last edited:
Auto Login script
File name: auto_login
This is an internal SWL call, so the script file must be called auto_login
Code:
delay 5000
/chat join LoMSGlobal
/chat join Badgers
/chat join Sanctuary
/logcombat on

  • The 'delay' command is necessary to give SWL some time to cook the chat interface before it starts to process commands (delay in milliseconds, so 5000 = 5 seconds).
  • The /logcombat on is not recommended unless you need it for statistics of parsing combat, for example if you're using the ACT addon. It will create a file called CombatLog-date_#### (e.g. CombatLog-2017-09-05_1012) for each login in the SWL installation folder, and it will fill up your folder with them unless you delete the old ones.
  • Of course which chat channel you choose to auto-join is up to you. Add and/or replace as necessary.
  • In TSW there used to be a limit of 13 chat-join commands in auto_login, but I have no idea whether it's still the case here. On the other hand, 13 is a whole lot channels.
  • And please note the capitalization of LoMSGlobal ;)
 
Last edited:
A simple code of conduct clickable chat check (CoCCCC, etc), for recruiters and other busybodies
File name: coc
Call up: /coc

Code:
Have you read and do you accept the cabal's <a href="text://<font face=Large><a href='chatcmd:///option WebBrowserStartURL &quot;http://www.lomsglobal.com/index.php?threads/code-of-conduct.240/&quot; \n /option web_browser 1'>Weblink to the cabal's Code of Conduct (click)</a></font>">Code of Conduct? (click for link)</a>

All in one line, as it's one clickable chat line :)
 
Last edited:
LoMS Recruitment Script
File name: lomsrecruitment
Call up: /lomsrecruitment

Code:
<font color=yellow>The League of Monster Slayers</font> ~~ the fun loving cabal is always recruiting, </font><a href="text://<div align=center><font face=headline color=yellow>The League of Monster Slayers<br>PvE/PvP Cabal</font><br><br><br><font face=huge color=red>-------------<BR></font><font face=LARGE>We welcome any players new and veterans.<br>All members are asked to treat each other respectfully and keep a somewhat mature behaviour.<br><br>We are recruiting non-elitist members looking to have fun and enjoying the pve and pvp content in the game.<br><br>We use teamspeak and discord for voicecommunication and a custom chat channel.<br><font face=huge color=red>------------<BR><br><br>For more information: <br></font><font face=LARGE><a href='chatcmd:///option WebBrowserStartURL &quot;http://www.lomsglobal.com&quot; \n /option web_browser 1'><font face=LARGE>Website</font></a><br><br>Make sure to read and accept our code of conduct: <br></font><font face=LARGE><a href='chatcmd:///option WebBrowserStartURL &quot;http://tinyurl.com/LoMSCoC&quot; \n /option web_browser 1'><font face=LARGE>CoC</font></a><br><br><font face=LARGE color=red>Or click here to join our custom channel:</font><br><a href='chatcmd:///chat join LoMSGlobal'><font face=LARGE>LoMSGlobal</font></a><font face=LARGE color=red> and ask for an invite.</font><br><br>For the scripts to autojoin LoMSGlobal custom channel on login see here: <br></font><font face=LARGE><a href='chatcmd:///option WebBrowserStartURL &quot;http://www.lomsglobal.com/index.php?threads/in-game-chat-channel.129/&quot; \n /option web_browser 1'><font face=LARGE>link</font></a><br><br><br><br><font face=huge color=red>-~~~-</font></div>">click here for more info.</a>
 
Hi! *waves* thanks for starting this. Since I had a hand in suggesting it I thought I'd post one of my scripts too!

What is does: Typing "/<shortcut> <message>" would post a message to any chat channel the shortcut is linked to

Step 1: Set up an auto-login script using the instructions in here: Scripts for Customchats. Basically, (i) create a Scripts folder in your Secret World Legends Folder (i.e. ...\Secret World Legends\Scripts), (ii) paste /chat join <channel name> into a .txt file (e.g. /chat join sanctuary), (iii) save it (with any name) without the .txt extension.

Step 2: In your script (you can open it with notepad to edit it), below the "/chat join ..." line, type "/alias <shortcut> <#channel name> %1" without the quotations (e.g. /alias 1 #sanctuary %1 would result in "/1 hello" posting the message "hello" to the channel "/#sanctuary". What number you use after % seems to be valid until at least 40. Click "OK".

Step 3: Between the "/chat join..." line and the "/alias <shortcut> <#channel name> %1" line, type "/alias <shortcut>". Your text file should have a "/chat join <channel name>", followed by "/alias <shortcut>", and lastly "/alias <shortcut> <#channel name> %1". It doesn't matter if you have any other lines in between the three. So an example would be:
Code:
/chat join sanctuary
/chat join lomsglobal
/chat join noobmares
/alias 1
/alias 2
/alias 3
/alias 1 #sanctuary %1
/alias 2 #lomsglobal %2
/alias 3 #noobmares %3

Step 4: Type /alias in your chatbox to confirm that your script is working correctly. It should list all your chat shortcuts line-by-line in this format /<shortcut> Message.

To undo the changes, simply remove the "/alias..." lines in your script, relog, and then type /alias <shortcut> in your in-game chatbox. So typing "/alias 1" without the quotations would delete the shortcut for "/1"

Note: Typing /alias <shortcut> <channel name> %1 directly into your chat box will not work because the chat box seems to escape the %1 syntax
 
Good explanation of the use of alias, thx Shizu! One detail I'd like to comment on:

Code:
/chat join sanctuary
/chat join lomsglobal
...

The capitalization of LoMSGlobal. This is what causes that sometimes after a reset we seem to loose our auto subcription to the LoMS channel.

TL;DR
Well, yes and no. It's a bug (or feature, opinions are divided) of the chat interface implementation. Commands are not case sensitive. The channel assignment to a chat window tab though, is.

The first player to chat-join a channel after a reset defines the capitalization of that channel, and it stays that way until the next reset.

So, for example, when the first LoMSer to login after a reset has an auto_login with 'lomsglobal', or otherwise chat-joins lomsglobal, others after them with variant capitalization (LoMSGlobal, Lomsglobal, etc) will also chat-join the same channel, but the tab needs to re-register to the new capitalization. Which is why it becomes necessary to open the Public channels list and re-check the LoMS channel so it again gets assigned to the tab.
/TL;DR

So, the shorter version:
Code:
/chat join LoMSGlobal
:)
 
Last edited:
Can someone please help me as I necro this thread with a chat script variable issue? I have an auto_login line that says /chat join Vyxenne that works perfectly, correctly creating and joining a Vyxenne channel, but it doesn't work if I try to use the player-name variable, i.e. /chat join %m so it will work on any character I log in with.

Also, I have a persistent-channel-change script (as opposed to simply redirecting a message to a channel without changing the talk-to channel) that issues the persistent-change-talk-to-channel command /ch #Vyxenne , adding the pound sign # because the /ch command requires it as a prefix on the channel name.

So I want to replace the explicit "Vyxenne" with %m (the player-name variable) so it will join and change my talk-to chat to the appropriate character-name-dependent channel, but /ch #%m does not work, returning a self-contradictory error message "Unknown channel name '#Vyxenne'" even though the channel exists at that point, confirmed by entering /ch #Vyxenne. When I tried to use /ch %m (without the pound sign) I got the same perverse error: "Unknown channel name 'Vyxenne'". Hilariously, both error messages confirm that the %m variable is kinda-sorta working by regurgitating the appropriate channel name while refusing to act upon it. o_O

I have Googled this without finding an answer, or, if I found one, without recognizing it as usable in this situation. Anybody got any idea how I can get a change-to-character-name-channel script to work? Thanks.
 
Last edited:
Hmm i have to put some testing into that, haven't used it like that. Ingame chat is an ancient, customized IRC implementation "hold together by black magic and duct tape" (quoting the lead designer here)
 
Hmm i have to put some testing into that, haven't used it like that. Ingame chat is an ancient, customized IRC implementation "hold together by black magic and duct tape" (quoting the lead designer here)
I would appreciate any info you can come up with on how to apply the PlayerName variable to a /ch command- I'm at my wits' end. Thank you.
 
Back
Top