Macro fundamentals

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Macro fundamentals

Post by Malachi » Thu Nov 21, 2002 9:42 pm

Hi all, I have some ideas for some custom macros, and I was wondering if anyone could help me out with some things.

First...I'm intrigued with /target and /face. I know from using hunter.mac that these commands can find a spawn in the zone. My questions are these: Is there a distance limit/is it zone wide? and....how? This is probably a secret, I'm just wondering.

Next, I'm a little confused with #define.
for example

Code: Select all

#define NoMoreCash v50
Does this make it so that subroutine NoMoreCash may now be called like this?

Code: Select all

/call v50? or in an if switch like /if v50==1
Or is it something else not related to subroutines? And, lastly, is there a limit on these variables? is it v01 or v1, through v99? Just wondering. I usually like to name variables starting low and working up, and I see lots of scripts starting w/ like v50, so I'm wondering if I'm missing some convention.

Last question...if I want MQ to pay attention to a keypress that's not a traditional number/letter, like say "shift" or "Esc", and I make an event for it, would that look like

Code: Select all

#event ShutDown "esc"
or would I need the ascii equiv?

Thanks for the help everyone!

~Malachi
~Oh danny boy, the pipes the pipes are calling.~

Lurker_005
a lesser mummy
a lesser mummy
Posts: 51
Joined: Thu Oct 17, 2002 12:08 pm

Post by Lurker_005 » Fri Nov 22, 2002 9:54 am

Code: Select all

#define NoMoreCash v50
just gives teh v50 variable a user defined alias of NoMoreCash It has nothing to do with subrutines.

#events match chat type text , not key presses that I am aware of.

Code: Select all

#event ShutDown "esc"
would fire off the event_ShutDown sub when /doevents found "esc" in a chat type message

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

Post by Nerfy » Fri Nov 22, 2002 11:19 am

Don't take this wrong, but there's a lot of information in the file 'readme.html' that is included in the download. Problem is that it's not set up as a how-to, but as a language definition. So you have to know what syntax you're looking up before you can use it. I learned by grabbing a simple MAC and then looking up all the terms from it until I understood what every line did - then I tried a harder mac.

Just to show that this isn't a RTFM post, I'll try to help you out.

#define actually replaces all instances of the first word with the second at runtime. so if I did this:

Code: Select all

#define GetOut /q
and then did this

Code: Select all

sub Main
   Getout
/return
Then it would quit me out. People use this to keep their variables straight. Let's say that I want to run something 4 times. I need a counter that adds up to 4, then quits. Example:

Code: Select all

#define counter v1

sub Main
   /varset counter 0
   :Loop
      /varadd counter 1
   /if n $counter!=4 /goto :Loop
/return

Notice that the define is the name only, no dollar sign. If you're talking about the variable don't use the $, if you're talking about the value of the variable, use the $. So when I'm comparing the value above in my if statement - I use the $. When I'm setting the value in my varset and varadd statments, I don't use the $.

Also remember from above that define replaces the text. So if I had done this:

Code: Select all

#define $counter v1
then it would only have place v1 into the code where I put $counter, the word counter would have been left alone and that would be bad. Alternatively, this:

Code: Select all

#define counter $v1
would have replaced all words counter wit $v1. So when I tried to set the variable there would be a problem, and when I tried to get it's value (using $counter) it would yell as well (this would translate into $$v1).

I don't know if there is a limit to the number of variables, I do know that single digit vars are done as v1, NOT as v01. v01 won't work.

Events as I've always used them are only kicked off from information to the chat window. As Lurker said, these moniter the text window for text and then call the sub routine that you specify. This is useful for kicking off an action in response to the outside world.

/target and /face are zone wide. These are nifty in that you don't need a macro. When hunting just type /target X and then type /face. Walk a ways and you'll hit what you're looking for. This is very handy in hard to navigate zones. In Lesser Faydark I usually just do a /target priest (targets the priest of Discord) and then /face, followed by an autorun. Takes me right to the lift.

How? Not really a secret, all things in a zone are sent to your machine when you zone in. MQ listens in on this data, and lets you know about them. Remember, the graphics in the game are just there to be pretty. When it comes down to it a zone is just a list of pointers to items with in that zone and your character is just one row in a database.

Hope that helps.
----------
* Nerfy *

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Thanks Nerfy

Post by Malachi » Fri Nov 22, 2002 12:50 pm

Thanks for the help folks. I had read over the readme, a lot, spent a lot of time switching between that and the hunter script actually, I just had those questions, which are answered now. Thanks again!

~Malachi
~Oh danny boy, the pipes the pipes are calling.~