Game Tech: Scripting, Basic
  Preparing a briefing for an event? Want to post information in the guildchat again and again and macroing it doesnt work because your text is too long? Want to make your pets autoguard/heal you at the press of a single button? Then scripting is the thing for you.      
 
What are scripts?
Scripts are series of commands executed in a sequence, with an optional delay in between them. Script commands will be covered shortly in this tutorial on how to make a script.

First things first
The first thing you will need to do is to locate your Anarchy Online folder on your harddrive. Inside this folder, you should have another folder, called "scripts". If this folder doesnt exist, you will have to create it. All scripts must be stored here in order for AO to find them, so our next step is to

Create a Script
Create a .txt file using Notepad preferably, lets call it "test.txt". Please note that if you have the option "do not show extensions" in Windows, your file will appear to be named "test" and not "test.txt" - this is perfectly alright, and we will get to that later, right now we will concentrate on writing the script instead.

The test script
We'll do something really simple for our test-script, just type this into your text-file:

/disco
/say Woop!

And save it. That will do for our first test. Now start Anarchy Online and we are going to try...

Executing the Script
Calling on scripts from AO is pretty easy - its just like any other command there is, but instead of the actual command, you type the filename instead, so our test-script would be called up like this:

/test.txt

If you were enterprising enough to remove the suffix ".txt" from the filename when you created the script (I prefer to remove the .txt myself, since the purpose of scripts is to NOT make you have to type any long sentences to make AO do what you want to), you will get an error message saying "command not recognized, go cry in the corner", but thats easily remedied. If you removed the ".txt" part, type this instead:

/test

Easy, isn't it? If you want to easily access this script at any time, you can now make a macro out of it, like this:

/macro Test /test.txt

And put the macro icon in your hotbar.

Putting in a Delay between commands
In case you didnt think about it - all the commands in your scripts are executed almost instantly without any delay inbetween them. This means that this script:

/shrug
/angry

Would show the first microsecond of the /shrug animation and then instantly perform the /angry animation. What you need is a delay between the two, which just happens to be called just that - namely

/delay 1000

The number after the command is the delay in milliseconds - IE 1000 would be 1 second. For large chunks of text, this is vital to know, since it takes time for the reader to absorb the information on screen.
Try altering the test-script we made into this:

/me starts to dance
/delay 3000
/disco
/say Woop!

And you will see that emoting works too, at the same time as demonstrating the /delay command. Timing is always hard for scripts, since people read at different speeds, there is unfortunately no good tip about this - as a rule of thumb I use a 8 second delay - "/delay 8000" for longer sentences and a 4 second delay for shorter ones - "/delay 4000". This also prevents the Spam Protection to kick in and ruin your script just as you are going to show your friends that latest joke you found and scripted.

What are all the commands?
The basic rule is that everything you can type as a command inside AO, will work as a script-command too. You might want to check out the help index on looking at the different commands available if you aren't familiar with this already. The help index can be reached by typing

/help

And will display a number of sections with commands in them. After you learn the various emotes, the hyphenations for some commands, and the rest, you will see that making scripts really isn't all that hard.

This is where I'm going to end the basic tutorial and I will continue in the advanced tutorial where I am going to go into something called Variables and also, we will make use of a very popular bot out there - HelpBot (if you don't know what HelpBot is - try doing "/tell helpbot help" in the game, and you will see).


Last updated 07. May 2003