Ok i have been working on a howto for macroquest. Its not finished by any means but I have a lot on at work atm so I havent had time to finish it.
Heres what I have so far. Id welcome your comments.
Prerequisites for this guide
---------------------------
UI Choice
---------
Firstly a lot of MacroQuests (MQ hereafter) commands do work using EverQuest's (EQ hereafter) New UI. However none of the commands for clicking on windows such as your inventory slots work under the New UI so I am going to assume you are using the Old UI. You can change to the old UI by changing the NewUI=TRUE to NewUI=FALSE setting in your eqclient.ini file. I find it helpful to put a shortcut to the eqclient.ini file on the desktop to make switching this setting less painful.
Editing Environment
-------------------
Since EQ is supposed to run full screen only you can not edit your scripts and run them without constantly stopping and Starting EQ. There is however a way around this and that is a program called EQW by a talented individual called Just Some Dude. You can get it at http://www.eqwindows.com/ if you run this you can have EQ running and your favourite text editor running at the same time and switch between the two for editing and testing. Always make sure that your script has stopped running in the EQ Client before you make changes to it. If your script is still running and you make changes and save it when you run your script again in the EQ Client then your newly edited script will not be the one that runs. The previous version that is still in memory will run instead and none of your changes will take effect. This will lead to you questioning your sanity, shouting at your computer, or kicking the dog because your script still doesn't work.
A Functioning MacroQuest Version
-------------------------------
I am going to assume that you have started MQ logged into EQ and MQ is working. In fact to check it is working type the following MQScript line at the EQ command prompt.
/echo Hello World
The /echo command just outputs text to the screen. All MQ echo output is prefixed by [Macroquest] so if you see the following Output in the default EQ chat window.
[Macroquest] Hello World
If you don't see this it possible that the release of MQ you installed already has filters set up. This is especially likely if you are using a Beta (also known as IRC) release. type;
/filter macros all
The all filter setting means we want to see all macro messages. This seems counterintuitive but this is the way filters already work in EQ so having it any different would just add to the confusion.
If you see still don't see any output then you have another problem, See Troubleshooting at the end of this document.
Assuming MQ is working fine we can begin.
What are Scripts?
-----------------
A MacroQuest script is a series of MQScript commands saved as a plain text file with a .mac file extension. Scripts are stored in the \Macros directory below the directory where you have installed MQ. You can get a list of available macro's from within your EQ client by using the command.
/listmacros
This will display a list of all macros in alphabetical order.
To run a macro you use the following command.
/macro <Filename>
The Filename is the name you saved your macro as (duh) you don't need to add the .mac extension if you don't want.
Hello World
-----------
We are going to start by writing our own macro and then running it. It is very simple. In fact you have already used the MQScript command once to check MQ was working.
To create scripts you need to use an editor that produces plain text file's. Notepad is perfectly suited to the task or if you are of a mind to you can go get one of the more feature rich editors like TextPad (http://www.textpad.com) TextPad can do syntax highlighting that makes your scripts easier to debug. I created one for MQ script and it is posted on the MQ forums at http://macroquest2.com/phpBB2/viewtopic.php?t=879. Ok start you text editor and then enter the following 3 lines.
sub main
/echo Hello World
/return
Save this as HelloWorld.mac into your \Macros directory.
Ok in your EQ Client type
/macro helloworld
You will see the following output.
[Macroquest] Hello World
Look familiar? Yes it exactly the same as test you did before but you probably noticed that you typed 3 lines to make this script whereas before you only typed on line. Well for our script to work MQ needs to know where to start and stop. Heres the script again with some explanation.
sub main <- This line signifies that this is where our script starts.
/echo Hello World <- This line is actually our script code
/return <- This line signifies that this is where our script ends.
Well that is a very simple example to get you started. Next we will look at some more useful commands.
Macro Variables
---------------
So your in EQ wandering through a zone an you see somebody auctioning a Crown of King Tranix for 2K. Well you know that is too good a deal to pass up but do you have enough cash in the bank. Well its a long way to the bank and by the time you get there and check it may have gone. Fear not we can write a small script to tell us how much money we have. Just enter this into your text editor and save it as balance.mac.
sub main
/echo Cash in the bank : $char(plat,bank)pp $char(gold,bank)gp $char(silver,bank)sp $char(copper,bank)cp
/return
Ok within EQ type
/macro balance
and you will see the following output.
[Macroquest] Cash in the bank : 1800pp 15gp 28sp 10cp
Of course your actual values will depend upon what you really have in the bank. As you can see I shouldn't have any trouble affording the Crown :-).
What the script did is use some macro variables to get the values of each denomination of coin and then display them using the /echo command. There are many different macro variables, they are all documented in the Readme.html command reference so it might be an idea to keep that handy whilst reading this guide.
Of course you might not have enough in the bank alone but you are carrying money too so we can change the script to show the money you are carrying too. You could of course just look at the inventory screen but here it is in the script, Open you balance.mac script in your text editor. Make the following changes and save it again.
sub main
/echo Cash in the bank : $char(plat,bank)pp $char(gold,bank)gp $char(silver,bank)sp $char(copper,bank)cp
/echo Cash on you : $char(plat)pp $char(gold)gp $char(silver)sp $char(copper)cp
/return
Ok once again within EQ type
/macro balance
and you will see the following output.
[Macroquest] Cash in the bank : 1800pp 15gp 28sp 10cp
[Macroquest] Cash on you : 415pp 134gp 38sp 23cp
Again of course the numbers will vary.
Calculations
------------
There is also a quick way of checking how much in total you have in the bank or on you. This is useful if you can't do mental arithmetic or for some perverse reason you don't convert all your cash to pp when you bank.
The MQ variable $char(cash,bank) will return the total amount of cash you have in the bank in cp. This will probably be a quite a long number especially if you are a wannabe Rockefeller. It would be nice to have this figure in pp. Well this leads us nicely into how to do calculations in MQScript. As it happens there are a few different ways of doing it. Here's one that doesn't use any extra variables.
sub main
/echo Cash in the bank : $calc($char(cash,bank)/1000)
/return
Here we are using the $calc() macro variable to just divide our total cash by 1000, simple huh. The $calc() command accept's the usual arithmetic operators, see the Readme.html for a full list.
You could do the same for you cash you are carrying too but I'll let you do that yourself. Maybe try adding the two figures together with $calc() as well.
Now I said theres a couple of ways of doing calculations. Heres another.
sub main
/varcalc v99 $char(cash,bank)/1000
/echo Cash in the bank : $v99
/return
In this example we are using /varcalc. What this command does is calculates the result of the arithmetic expression, stores it in a variable, and then uses /echo to display it. which leads us nicely onto.....
Variables
---------
You'll often find you want to work out a calculation or something and then store it for later use. To store value we use a variable. MQScript has a limited set of variables available, and some of them have special uses. Here they are.
v# or l# - a user variable, set by /varset, /varadd, or /varsub
p# - a subroutine parameter
a(#,#) - an array variable
t# - a timer value (there are 40 timers now, up to t39)
we will just talk about user variable for now, the other types will be covered later.
User variables are able to store text and string data. MQ script works out what it is when you use it so you don't have to worry about type conversion. Variables are named v# where # is a number between 1 and 99. To set a variable use the following command;
/varset v# <value>
So if we want to set up a variable called v1 to hold the value 10 we would do;
/varset v1 10
Then maybe set up another
/varset v2 20
Ok now we have to variables set what can we do with them. Well we can display them;
/echo $v1 $v2
notice the $ in front of the variable, that means we want to get the value of the variable don't forget to put it in, our you will see some funky errors when you run your scripts.
There are few other commands that work on variables
/varadd v# <value>
/varsub v# <value>
These are pretty self explanatory /varadd adds <value> to the variable v# and, you guessed it /varsub subtracts <value> from the variable v#. So to continue with our examples above
/varadd v1 10
/echo $v1
should display the value 20, and
/varsub v2 10
/echo $v2
should display 10 to the screen. So continuing on from above We can also do;
/varsub v1 $v2
/echo $v1
that should result in displaying 10. Notice for the value to subtract we used the $ to get the value of the v2 variable.
and finally /varcalc. we have seen this one before so I wont go into it again.


