Scripts in AO are textfiles, they are located in "...\Anarchy Online\Scripts\", they have usually no file extention for better handling ingame. They are basically a list of chat commands to be executed on call.
What a script can and cannot do Edit
Scripts are a powerful way to use emotes, commonly used chat commands and reusable text. You cannot use them to make your character attack, cast nanos or generally do anything that affects mobs or other players (well, except you can annoy them with automated spam).
Due to some bad client code, a line in a script cannot exceed 1024 characters. A script may have as many lines as you like, but each one of them must obey the 1024 character limit, or your client will die a horrible death and crash. The chatserver can handle lines longer than 1024 characters, I'm sure all of you have seen huge information windows generated by chatbots that exceed 1024 characters. The client has no problem receiving or sending larger line scripts, but the code responsible for reading long scripts from a file cannot handle the larger scripts, most likely due to a hardcoded 1k readbuffer.
In general, each single line of a script is seen as a chat message you would normaly type into the client and press enter to send it. All commands you know from normal chatting work in scripts. If you have a normal text line, it will be sent to your currently active chat channel. The channel currently active for the script is the one active in the window you started the script from. Unless a line of chat is forced into another channel with specific commands, or the default channel is changed, everything goes into that channel.
The command /ch <channelname> changes the active/default channel to <channelname>. After the script is finished, this channel will still be selected for further chat.
The following list shows all of the available chatcommands.
- / <text> - Sends <text> to vicinity without changing the default channel. Pay attention to the space between / and <text>.
- /afk <message> - Toggle afk on and off, using <message> as your away message.
- /anon - Toggle annonymous mode on and off. When annonymous the /list command will not show your name.
- /camp - Exit the client the normal, gracefull way.
- /ch <channel> - Change default channel to <channel>.
- /delay <time> - Makes the script wait <time> miliseconds.
- /filter <option> <value> - Allows you to customize and filter out text. Uses Regex engine for advanced filtering. See advanced filtering
- /ignore <name> - Add or remove <name> from your ignore list.
- /lft <message> - Toggle LFT on and off, using <message> as your description.
- To find toons looking to join a team press SHIFT + F to bring up the find team members screen
- /list - Show all players currently in the same zone as you.
- /me <text> - Send the emote <text> to your vicinity without changing the default channel.
- /messagebox <message> - Opens a messagebox with <text> in it and a Ok button to close it. This is NOT the info window we will be using alot later, just a popup message box.
- /o <text> - Sends <text> to orgchat without changing the default channel.
- /option <option> <value> - Changes the games settings. A list of options is found below.
- /pet <name> <command> - Sends <command> to your pet <name>. If you do not specify <name> the command is sent to all your pets. If you specify <name> and your pets name includes spaces you need to add quotationmarks, eg. /pet "Nibbles the dog" terminate.
- /quit - This command will exit the client without further questions. Sometimes used to "fake LD". Not very usefull.
- /s <text> - Shouts <text> in vicinity without changing the default channel.
- /selectself - Target yourself.
- /setoption <option> <value> - Same as /option, but this commad will also display the change made in the chat window.
- /showfile <filename> - Shows the local file <filename> in the info window. This is used by the helpsystem alot. The path defaults to your Anarchy Online root folder (e.g. C:\Program Files\Anarchy Online\), but also checks the Anarchy Online\cd_image\text\help\ directory. Relative pathnames work from both locations.
- /start <target> - Runs an external program. <target> can be a URL that will be opened in your default browser, or even a program name.
- /t <text> - Sends <text> to teamchat without changing default channel.
- /text <text> - Shows <text> only in your own chat window.
- /voice <sound> - Play the voicepack file <sound>.
- /w <text> - Whispers <text> in vicinity without changing the default channel.
Also all the normal emotes can be used.
This is where the power of scripts starts to show.
- %0 - Replaces with the name of the script you are running.
- %1...%9 - Replaces with parameters you gave to your script.
- %f - Replaces with the target you are currently fighting.
- %m - Replaces with your own name.
- %t - Replaces with your current primary target.
Graphics options Edit
Graphics settings can be changed with just a single script. The command is always /option <option> <value>. The <option> name is case sensitive.
- ViewDistance - Accepts values from 0.0 (=0%) to 1.0 (=100%) and defines your max view distance.
- CharViewDistance - Sets the distance in which characters are still visible for you from 5 to 80 in meters.
- BuffsFX - Do you want fancy nano execution effects? Can be 0 (=off) or 1 (=on).
- EnvironmentFX - Do you want environmental effects? Can be 0 or 1.
- MuzzleFlashFX - Want guns to have a visible effect when firing? 0 or 1.
- NanoEffectFX - Want to see visible effects of running nanos like damage shields? 0 or 1.
- TracersFX - Want to see flying bullets? 0 or 1.
- OthersFX - Not sure what is included in "Other" but... heh... 0 or 1.
- Shadows - Do you like shadows? 0 or 1.
- SimpleClouds - Do you want basic cloud effects? 0 or 1.
- RealisticClouds - Do you want even more cloud effects? 0 or 1.
- RealisticMoons - Ugly or nice looking moons? 0 or 1.
- StarRotation - Want the nightsky to look more realistic? 0 or 1.
- ShowAllNames - Want to know the names off all people around you? 0 or 1.
- Wildlife - Want the little, non attackable creatures to roam around? 0 or 1.
- IsSpaceShipsShown - Show the huge alien ships? 0 or 1.
- FogMode - How much fog do you like? Accepts values from 0 (=off) to 3 (=all fog effects)
- MusicOn - Want music? 0 or 1.
- SoundFXOn - Do you want sound effects? 0 or 1.
- SoundOnOff - Do you want sound/music at all? 0 or 1.
There are many more options you can alter with the /option command. To get a full list of all options you can alter, press SHIFT+CTRL+F7 ingame and look through the DistValues list. Some of the changes you can make with this command will not take effect until the client is restarted and some might render the client unable to work. Feel free to experiment but be a little careful.
This is where the fun part begins. Scripts can be used to create a clickable link in the chat window which will open a new window, the info window, with your text in it. This is also the first time we need to worry about the 1024 character limit, because everything that you want to show up inside the window needs to be in the same line, ie it has to be one single chat command.
The very basic framework we will be using is this:
- <a href="text://TEXT GOES HERE">LINK NAME GOES HERE</a>
Copy and paste that into a script file and execute the script in AO. You will get a link "LINK NAME GOES HERE" and when you click it, the info window will open and show "TEXT GOES HERE" in it.
Formatting text Edit
Some normal HTML tags work to format text inside scripts.
- <font color=#ff0000>Text</font>
will show the text between the font tags in red. The color is defined with hexadecimal RGB values. The first two digits are red, the second two are green and the last two are blue. Those double digit values range from 00 (=zero brightness) to FF (=full brightness). FF is 255 in decimal. To get the color you want you just mix red, green and blue accordingly. You want yellow? Mix red and green equally. So #ffff00 is bright yellow. #999900 is a darker shade of yellow. And so on... this gives you 16,7m different colors.
will show the text underlined.
- <div align=right|center>Text</div>
will align the text to the right, or center the text. Of course you can only use right or center, not both at the same time. This tag will only work when used inside the info window.
will create a new line. This is important when you create a info window script where everything has to be in the same line. If you want a new line in this case you need this tag.
Example of all the above:
- <a href="text://First line.<br><font color=#ffff00>Second line in yellow.</font><br><div align=center>Third line centered.</div><br><br><u>That was a empty line.</u>">Example</a>
Chat commands from inside the info window Edit
Now that we can open the info window and put formated text in it, we can try some even more advanced things. It is possible to use chat commands from inside the info window. You will have a link inside the window that will execute the chat command when clicked.
- <a href='chatcmd:///ymca'>Click here to YMCA</a>
is the syntax to use chat commands. Using this alone in a script will result in a link that does nothing when clicked. It has to be done from inside the info window. So we add this to the basic info window framework we discussed above and get:
- <a href="text://<a href='chatcmd:///ymca'>Click here to YMCA</a>">LINK NAME GOES HERE</a>
Copy paste it and try it. You will get a link "LINK NAME GOES HERE" that will open the info window with a link inside named "Click here to YMCA" which will make your toon do that dance when clicked. You can execute any chat command that way. Even the /quit command which would make people that click it logout imediately. However doing things such as the /quit command is considered rude and should not be done.
Images inside the info window Edit
It is possible to use client graphics (from the GUI) and item icons inside the info window. Using GUI graphics is a little difficult, because you need the graphics ID to do it. These are long uppercase descriptors unique to each of the graphics. Posting a list would take too much space and they change with each patch. I'll just give one example. Again, this only works inside the info window (and also with the /lft command, the grahic will show up as your description).
- <img src=tdb://id:GFX_GUI_CONTROLCENTER_TARGET_ICON_SELF>
is the syntax to add a GUI graphic. GFX_GUI_CONTROLCENTER_TARGET_ICON_SELF is the graphics ID. Again this alone won't work, because it has to be done inside the info window. So let's add it to the info window framework again:
- <a href="text://<img src=tdb://id:GFX_GUI_CONTROLCENTER_TARGET_ICON_SELF>">LINK NAME GOES HERE</a>
Try this one. It will open the info window and show the icon the GUI uses to target yourself. A full list of all the GUI graphics IDs can be found at hackersquest if you're really into experimenting. Here is a link to a nice full list with all graphic IDs and the pictures they represent. That list is a little old, so alot of these IDs represent something else now or have been removed. Also you need to be aware of the fact that someone using a custom GUI skin will have different graphics accosiated with some of the IDs than someone using the default skin.
Using item icons is just a tiny bit more easy. You need the icon ID (not the item ID) which is just a number. You can find out the icon ID of the icon you want to use with AUNO or the Anarchy mainframe. The little icons there have a number as a filename which is the icon ID.
- <img src=rdb://86483>
is the syntax to use a item icon. Again this wont work alone... heh... you know the drill. Let's add it to the info window framework.
- <a href="text://<img src=rdb://86483>">LINK NAME GOES HERE</a>
Copy paste this one and you will get a info window with the icon of the Shades of Lucubration in it.
Last but not least it's possible to create item reference links manually. These links also work outside the info window. For these you need the item IDs. To get these you need to activate logging for one of your chat windows, post the item you want to know the ID from and then look inside the chat log. Or... you look up the item at AUNO ar Anarchy Mainframe again and inspect the URL. You will find the IDs there too.
The syntax is:
- <a href='itemref://Low_ID/High_ID/QL'>NAME</a>
Low_ID is the ID of the item at the lowest possible quality in the database. High_ID is the ID of the item at the highest possible quality, and QL is the actual quality you want your linked item to be. NAME is the name of the item, but it doesn't actually have the be the real items name. It can be anything you want. The example below will open a info window with the icon of the Shades of Lubrication that when clicked on will change the info window to the items reference. In this example LowID and HighID are the same, because that item only exists at this quality. When you try to link to, let's say, carbonum armor, they will be different.
- <a href="text://<a href='itemref://152713/152713/165'><img src=rdb://86483></a>">LINK NAME GOES HERE</a>
Changing Chat Channels With Scripts blablabla==Script Examples==
Just copy these, put it in a text file, and save in your scripts folder under any name you choose.
<a href="text://<div align=center><img src=tdb://id:GFX_GUI_OPTION_SLIDER><br><br><br><a href='chatcmd:///macro %t /Assist %t'><img src=rdb://37970><br><font color=#FFFAAA>Click for Assist %t macro</a><br><br><br><br><a href='chatcmd:///Assist %t'><img src=rdb://156598><br>Click for quick Assist %t</a><br><br><br><br><a href='chatcmd:///macro Assist /Assist'><img src=rdb://82982><br><font color=#FFFAAA>Click for Assist macro</a><br><br><br><img src=tdb://id:GFX_GUI_OPTION_SLIDER>">Assist %t</font></a> <font color="#00B400">-|</font><font color="#E10000">Click it!</font><font color="#00B400">|-</font>
- Will create buttons for "assist person", "quick assist", and just "assist". The buttons will look like cherries, a leet, and an omni token board.
/w <font color="#ff6820"><font color="#2DFF2D">UBT</font> landed on <font color="#E10000">%t</font> starting reminder script.</font> /delay 60000 /w <font color="#ff6820">One minute 30 seconds remaining on</font> <font color="#2DFF2D">UBT.</font> /delay 60000 /w <font color="#ff6820">30 Seconds Remaining on </font><font color="#2DFF2D">UBT.</font> /delay 30000 /w <font color="#ff6820">Times up! </font><font color="#2DFF2D">UBT</font> <font color="#ff6820">faded refresh or die!</font>
- Will Whisper with color changes and remind of ubt.
/lft <font color="#2DFF2D">Text here</font>
- To find players looking for teams press SHIFT + F
<a href="text://<font color=#33FF33>Noob Isle formulas<br>Salamander Vest Formula:</font><br><img src=rdb://205493 >+<img src=rdb://144703 >=<img src=rdb://130728 ><br>Antonio's Adaption Factory + Rollerat Intestine = Gut Bowstring <br> <img src=rdb://130728 > + <img src=rdb://161070 > = <img src=rdb://19812 ><br>Gut Bowstring + Swatch of Salamander Skin = <br><a href=itemref://248373/248373/1>Salamander Vest</a><br><font color=#33FF33>Range Meter Formula:</font><br><img src=rdb://205493 >+<img src=rdb://130837 >=<img src=rdb://130777><br>Antonio's Adaption Factory + Optical Enchancer = Recalibrated Scope Unit</font><br><img src=rdb://205493 >+<img src=rdb://20412 >=<img src=rdb://20402><br>Antonio's Adaption Factory + Power Supply = Adapted Power Supply</font><br><img src=rdb://130777 >+<img src=rdb://20402>=<img src=rdb://99262><br>Recalibrated Scope Unit + Adapted Power Supply =<br><a href=itemref://248374/248374/1>Range Meter<br></a>"> Noob Isle item formulas</a>
- Use this to tell others, or yourself how to make some popular items on Noob Isle.
- It looks like this:
Close all Chat Windows and GUI FunctionsEdit
- This script closes all chat windows and gui functions for about 5 seconds so you can take a picture by pressing F11. You will need customize it based on your chat windows.
/option cc_section1 false /option cc_control_center false /option shortcutbar_window false /close "Default Window" /close "Combat" /close "Trade" /close "Chat" /close "Tower Wars" /close "AOFROOBS" /close "Guild" /delay 5000 /option cc_section1 true /option cc_control_center true /option shortcutbar_window true /open "Default Window" /open "Combat" /open "Trade" /open "Chat" /open "Tower Wars" /open "AOFROOBS" /open "Guild"
Scripts under Linux Edit
Scripts work with Anarchy when it's running under Cedega or wine, however bear in mind that UNIX/Linux handles newlines differently to Windows, and Anarchy can only handle Windows newlines. If you try to run a script with UNIX newlines, Anarchy will only run the last line of the script. You should therefore save your scripts with Windows newlines. If you write your scripts in Kate, choose Tools→End of Line→Windows/DOS from the menu before you save the file. There may be similar commands to do the same thing in other editors.