Game Tech: Scripting, Advanced
  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.      
 
Here we will show you how to use variables inside your scripts, to really make things happen. We will also talk a bit about Helpbot, and how to use Helpbots features, as well as give you some examplescripts to play around with on your own.

Variables
Variables are user-inputted keywords that the script can use. To understand what a variable is, you only have to compare this:

/help

to this:

/help emote

As you will see, the second example sends you directly to the Emote Help section of the text, and saves you some time. AO Variables work in the same way, for when you call on your scripts, lets make another testscript, this time naming it "add". Write the following into your script:

/cc addbuddy %1

Save your script, and start AO. Call on your script like this:

/add Twicer

You will now have added me to your friendslist. If I am in there already, you will see the text "Player Twicer is already in your friendslist" so in either case you will see it working. The %1 in the script picks up with which variables you are calling the script with. Here is another example:

/cc addbuddy %1
/cc addbuddy %2

This will add two people to your friendslist, and would be called upon like this:

/add Twicer Ellusion

There, now the two smaertiest metas in the game are in your friendslist! Happy days! Think of all the nanoprogramming we...uh..nevermind.

Other variables
There are other variables as well, one of which you might have used time upon time and not given much thought, and these are them:

%m (displays your nick, like this : Twicer)
%t (displays whatever you are currently targeting)
%f (displays the target you are currently attacking, not necessarily what you are targeting)

When you are using these variables, its important to remember to use lower-case letters only - %T instead of %t will not work.

Helpbot
Ah, yes, this is really a remarkable piece of art. I dare say not a day goes by without me using this bot, and the player behind it should be awarded Nobels Peace Price several times in a row. Well, maybe not, but its one of the best tools there is, and believe me, once you start using Helpbot there is no turning back.

I'm not going to explain all the different features of Helpbot here (doing a "/tell helpbot help" will explain things to you) but what I will explain is how you can make Helpbot work much more smoother with scripting. The principle is very easy - Helpbot has a string of commands, some with variables of their own, so instead of writing this:

/tell helpbot whois Twicer

You could with a simple script named "whois" containing the following...

/tell helpbot whois %1

...have the same results by calling on your script like this:

/whois Twicer

Much shorter, wouldnt you say?

Now you should have some ideas about making scripts of your own - I'm fairly certain you are already thinking about making some neat stuff to make things just a bit easier in AO. Scripts are especially powerful with variables, and some of the commands in AO are rather lenghty to write.

I wrote a few (13) scripts for you to look over and poke around with if you still feel uncertain about scripting, available here, available in a small zip-file for you to download, complete with an Instruction.txt file which will explain each command.

Get the examples.zip here


Last updated 13. December 2002