Scripts

From AOWiki
Jump to: navigation, search


Scripts in AO are text files, they are located in "%localappdata%\Funcom\Anarchy Online\…\Anarchy Online\scripts\", they have usually no file extension for better handling ingame. They are basically a list of chat commands to be executed on call.

How to create and use a script:

  • Open your windows-explorer and go to "%localappdata%\Funcom\Anarchy Online\…\Anarchy Online\scripts\"
  • Create a new Textfile "testscript" in this folder.
  • Open it and type: "/w well well, this is a script, who would have figured...."
  • Save and close the file. Go ingame (scripts can be modiefied while logged in.)
  • type "/testscript" in some chatwindow

Watch yourself whispering, "well well, this is a script, who would have figured...."

All chat commands can be used in scripts, from emotes (/ymca) over shouting (/s) to specific groups (/g "<orgname>"). Some special command usually only used in scripts are:

  •  %m = a variable replaced with your name
  •  %1 = a variable, it is the 1st word you typed after the scriptname
    • script: "/s Watch out! A %1!"
    • macro: "/macro watch_out /script %t"

This will result in a shout: "Watch out! A <name of your target>!".

  •  %f similar to %t but its the fighting target.
  • /delay x = will pause the script for x milliseconds ( x = 1000 = 1 second)
  • /selectself = target yourself

A great location for premade scripts is Zanthyna's Website.

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 with a weapon, cast nanos or generally do anything that affects mobs or other players (well, except you can annoy them with automated spam), however pet professions can use scripts to command their pets to attack and MPs only to heal.

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.

Channel[edit]

In general, each single line of a script is seen as a chat message you would normally 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.

Changing Chat Channels With Scripts

Commands[edit]

The following list shows most commonly scripted chat commands. There are many emote commands used in dancing script plus other commands such as Org Commands not listed here.

  • / <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 anonymous mode on and off. When anonymous the /list command will not show your name.
  • /camp - Exit the client the normal, graceful way.
  • /ch <channel> - Change default channel to <channel>.
  • /delay
  • /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 message box with <text> in it and an Ok button to close it. This is NOT the info window we will be using a lot 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 useful.
  • /s <text> - Shouts <text> in vicinity without changing the default channel.
  • /selectself - Target yourself.
  • /setoption <option> <value> - Same as /option, but this command 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 help system a lot. The path defaults to your root Anarchy Online folder (e.g. C:\Program Files\Anarchy Online\) but will also look in the Anarchy Online\cd_image\text\help\ directory. Relative pathnames work from both.
  • /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 team chat without changing default channel.
  • /text <text> - Shows <text> only in your own chat window. This is helpful in testing scripts.
  • /voice <sound> - Play the voice pack file <sound>.
  • /w <text> - Whispers <text> in vicinity without changing the default channel.

Also all the normal emotes can be used.

Variables[edit]

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 currently fight.
  • %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 - Want to see a glowing light around dyna/team mission bosses? 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.

Tip: press SHIFT+CTRL+F7 for list of all options.

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.

Opening the info window with a link[edit]

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.

  • <u>Text</u>

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.

  • <br>

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.

Exapmle 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 formatted 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 scrip 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 go LD immediately. DONT DO CRAP LIKE THAT!!!11eleven

Images inside the info window[edit]

It is possible to use client graphics (from the GUI) and item icons inside the info window.

GUI Graphics[edit]

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 graphic 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. For additional images see GUI Graphic IDs which has a full list of all images. You need to be aware of the fact that someone using a custom GUI skin will have different graphics associated with some of the IDs than someone using the default skin.

Icons[edit]

Using item icons is just a tiny bit easier. 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.

Item reference links[edit]

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 them 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 can look up the item at AOItems 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 to be the real items name. It can be anything you want.

The example below will open an 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>


Script Examples[edit]

Just copy these, put it in a text file, and save in your scripts folder under any name you choose.

Assist[edit]

<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.

UBT Reminder[edit]

/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.

Colored LFT[edit]

/lft <font color="#2DFF2D">Text here</font>

To find players looking for teams press SHIFT + F

Close all Chat Windows and GUI Functions[edit]

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 to customize it based on your chat windows. If you have your inventory, PF map or pet info window open you can close them with: /option inventory_window false /option map_window false /option pet_window false and set them true to turn them back on.

The close and open commands will need to be changed to use the names of your chat tab names.


/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"

Engi`s Tradeskill Window[edit]

Nice and easy setup.

<font color='#FFFF00'>***</font> <a href="text://<img src=tdb://id:GFX_GUI_CC_NEW_PROF3><font 

color='#FFCC33'><br><center>?your name?</font> <font color='#009500'>?your LVL?</font><br>Mechanical 

Engineering<br>????<br>Electrical Engineering<br>????<br>Field Quantum Physics<br>????<br>Weapon 

Smithing<br>????<br>Pharmaceuticals<br>????<br>Computer 

Literacy<br>????<br>Chemistry<br>????<br>Psychology<br>????<br>Breaking and Entry<br>????<br><a 

href='chatcmd:///tell ?your name?'>Tell</a><br><font color='#666666'></font>">?your name? 

TradesKills</a><font color='#FFFF00'> ***


Recursive Script[edit]

To make a script loop, in other words execute itself add the command /script %0 at the bottom the script. It will then call itself when it finishes. This technique is often used in dancing scripts and automating assist attacks with pets.

To stop the looping script, execute another script in the same chat window. Example, create a script named Stop with one line of code /delay 1. The current script should stop after the existing script finishes its currently executing commands.