Difference between revisions of "Scripts"

From Anarchy Online Wiki [AOWiki]
Line 182: Line 182:
  
 
=Script Examples=
 
=Script Examples=
 +
 +
Just Copy these, put in a notepad, and save in your scripts folder under any name you choose.
 +
 
==Assist==
 
==Assist==
  
 
<nowiki><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></nowiki>
 
<nowiki><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></nowiki>
  
Will create a button for, assist person,quick assist, and just assist button
+
Will create a button for, assist person,quick assist, and just assist button..The buttons will look like
 +
Cherries
 +
Leet
 +
and omni token board
  
 
==UBT Reminder==
 
==UBT Reminder==

Revision as of 07:27, 2 October 2006

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.

How to create and use a script:

  • Open your windows-explorer and go to "...\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"
    • will result in a shout: "Watch out! A <name of your target>!".
  • %f similiar 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.

Scripts are powerfull to utilize emotes, chat commands and text output. 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 by far. The client has no problems receiving or sending those huge line scripts, just the clients code responsibe for reading them from a file cannot handle them (most likely due to a hardcoded 1k readbuffer). Poor code.

Channel.

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.

Commands.

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
  • /ignore <name> - Add or remove <name> from your ignore list.
  • /lft <message> - Toggle LFT on and off, using <message> as your description.
  • /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\cd_image\text\help\ directory.
  • /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.

Variables.

This is where the power of scripts starts to show.

  • %0 - Replaced with the name of the script you are running.
  • %1...%9 - Replaced with parameters you gave to your script.
  • %f - Replaced with the target you currently fight.
  • %m - Replaced with your own name.
  • %t - Replaced with your current primary target.

Options.

Another thing that shows the power of scripts. You can change your graphics settings with just a single script. No more F10 click orgys when your machine starts to drop the framerate. 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 fireing? 0 or 1.
  • NanoEffectFX - Want to see visible effects of running nanos like damage shiels? 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, 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 carefull.

Opening the info window with a link.

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

Formating text.

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

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 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 imediately. DONT DO CRAP LIKE THAT!!!11eleven

Images inside the info window.

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.

Item reference links.

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.

  • <a href='itemref://Low_ID/High_ID/QL'>NAME</a>

is the syntax. 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

Script Examples

Just Copy these, put in a notepad, and save in your scripts folder under any name you choose.

Assist

<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 a button for, assist person,quick assist, and just assist button..The buttons will look like Cherries Leet and omni token board

UBT Reminder

/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

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