Therefore, I am going to help that process along by breaking down the file into manageble sections, posting them here, and having *EVERYONE* submit new wording, changes.
PLEASE read through everything here and help us by replying with sections that you wish to have rewritten. Please (/quote) the section you're changing, then just type in what you want it to say. Don't worry so much about formatting, etc...I'll take care of that.
ALSO, please feel free to write any ADDITIONS that you feel need to be ADDED to this file.
Let's get this updated to help with new people learning MQ!
Code: Select all
[b]3a. Macro Fundamentals[/b]
Pound Commands
Pre-execution commands that are not run during the macro.
[b]#turbo[/b] <maximum>
Runs macro commands as fast as possible
maximum will limit the number of commands per iteration. This will prevent bad macros from locking up the client. The default is 500. A value of 1 will essecially disable #turbo.
[b]#define[/b] short replacement
Replaces all offurances of short with replacement throughout the macro.
[b]#include[/b] filename
Includes another macro file.
[b]#event[/b] name string
Creates a custom event (Sub Event_name) that occurs whenever string is sent to the chat box.
[b]#chat[/b] channel
Declares where Event_Chat channels you want to handle can be: say, ooc, shout, tell, group, auc,chat
--------------------------------------------
[b]Comments[/b]
Descriptive lines in a macro to make reading easier. These are not executed when the macro runs.
Single line comment: Start with | (pipe character)
| This is a single line comment
Multi line comments: Start with |** and end with **|
|** This is a multiple
line comment **|
--------------------------------------------------------------
[b]
Subroutines[/b]
Every macro then has a Sub Main that defines the macro's entry point.
Additional Subs can be defined in the code and /called.
Special subroutines starting with Event_ are used by /doevents
Sub Event_Chat: Event callback for messages
$p0 - Channel of message (ooc etc., chat channels will callback with the name of the channel)
(ie. /join port ... callback will have $p0==port)
$p1 - Name of the person who sent the message
$p2 - Text they sent
Sub Event_Timer: Event callback for when a timer hits 0
$p0 - Timer that fired
$p1 - Value timer was originally set to
Sub Event_name: Custom event callback defined by #event
$p0 - Line that triggered event
--------------------------------------------------------------------------------
[b]3b. Macro Commands[/b]
[b]/finditem[/b] [similar] [item name]
Finds an item in your inventory by name.
similar Searches for substrings in name.
Opens pack if needed, clicks it, and closes pack again if it was closed.
If there was an item on the cursor, $getlasterror is set to FIND_HANDSFULL
If it was unable to open a pack, $getlasterror is set to FIND_PACKNOTOPEN
If the item wasn't found, $getlasteror is set to FIND_NOTFOUND
[b]/identify[/b]
Cross between the Identify spell and right-clicking an item for info
[b]/items[/b] <filter>
Lists all ground spawns in the zone
<filter> is a text substring filter
[b]/itemtarget[/b] <filter>
"Targets" a ground spawn for use with /face item and $distance(item)
<filter> is a text substring filter
[b]/where [/b]<filter>
Lists where the closest spawn is
<filter> is a text substring filter
[b]/doors[/b] <filter>
Lists all doors in the zone
[b]/doortarget [/b]<id number> <filter>
"Targets" a door for use with /face door and $door(xxx)
Aliases are shorter versions of a command. For instance, /mana is a build in alias.
[b]/alias[/b] list
Lists all aliases
/alias <name> <command>
Adds an alias
/alias <name> delete
Deletes an alias
[b]/alert[/b] add # [pc|npc|corpse|any] [radius radius] [range min max] spawn
Adds an alert to watch for a spawn
Options are similar to those on /who and /where
/alert clear #
Clears alert list #
/alert list #
Lists all alerts on list #
[b]/mouseto[/b] [+,-] <x> <y>
Moves the mouse to a position (+|- make it relative)
/mouseto bank <inv> <slot>
Moves the mouse to a main inventory (or bank) slot.
/mouseto npctrade <0,1,2,3,give>
Moves the mouse to an npc trade slot.
/mouseto hotkey <0-9|previous|next>
Moves the mouse to a hotkey slot.
/mouseto merchant <slot,up,down,buy,sell>
Moves the mouse to a merchant slot.
/mouseto corpse <slot|up|down>
Moves the mouse to a corpse slot.
/mouseto <bank> pack <number> <slot,combine,done>
Moves the mouse to a pack slot/button.
/mouseto item
Moves the mouse to the currently /itemtarget'd item if it is on the screen.
WARNING: Good chance this will not work with the old 640x480 bordered mode.
/mouseto target
Moves the mouse to the current target if it is on the screen.
WARNING: Good chance this will not work with the old 640x480 bordered mode.
/mouseto equip <position>
Moves the mouse to an equipment position.
position can be: ear1, ear2, neck, face, head, finger1, finger2, wrist1, wrist2,
arms, hands, shoulder, chest, back, waist, legs, feet,
primary, secondary, ranged, ammo
/mouseto auto
Moves the mouse to the autoequip spot.
/mouseto hslider <left,right,done>
Moves the mouse to a slider button.
/mouseto <bank> <plat,gold,silver,copper>
Moves the mouse to money spots.
/mouseto destroy
Moves the mouse to the destroy button.
/mouseto enviro <slot,combine,done>
Moves the mouse to enviromental pack slot/button.
This is 100% faked based on default position.
No checks can be made if it is actually open.
Contents cannot be viewed unless picked up.
[b]/cleanup[/b]
Cleans up open windows and then reopens inventory
Sends ESC, ESC, ESC, ESC, ESC, I
[b]/sendkey[/b] <up, down> <key>
Sends a key up or down
For a list of keys, see Appendix B.
[b]/press[/b] <key>
Sends a keystroke (up and down)
For a list of keys, see Appendix B.
[b]/click[/b] <left|right> <mouseloc>
Clicks the left/right mouse button
mouseloc is the same format as /mouseto
[b]/hslider[/b] <value>
Sets the slider to a specific value, or it's max value if too high.
[b]/mqpause[/b] [on|off]
Pauses/resumes a macro to aid in debugging or chatting.
No parameter will toggle on/off, useful for hotkeys
[b]/commands[/b]
Lists all commands available to the client
[b]/skills[/b] [filter]
Lists all your skills
[b]/macro[/b] <filename> [param [param...]]
Starts running a macro
[b]/endmacro[/b]
Stops a macro
[b]/listmacros[/b] <filter>
Lists macro files in the 'macro directory' (listed alphabetically)
[b]/perl [/b]<restart|eval [string to evaluate]|exec [file to execute]>
restart: Restarts the PERL interpreter in case it gets in a bad state.
eval: Runs one PERL command
exec: Starts execution of a PERL script
[b]/mqlog[/b] <text, clear>
Logs text to Logs subdirectory or Clears log file
[b]/if [/b]<n> <condition> <command>
Runs a command if the condition is true. (n makes the compare numeric)
Condition understands comparison operators
== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
~~ Contains operator (string only)
!~ Does not contain operator (string only)
Command can be { which will run everything up to the next }
} can be followed by else and a command.
WARNING: Nested {}s are not handled as of yet
/if $v1==0 {
/echo Zero
} else /if $v1==1 {
/echo One
} else {
/echo Something else
}
[b]/for[/b] v# <val1><to,downto> <val2> [step <val3>]
... commands ...
[b]/next[/b] v#
For/Next loop... runs commands while changing v# from val1 to val2 in steps of val3 (default is 1)
to adds the step each time; downto subtracts the step each time.
You can only use v#, p#, and l# variables; a(#,#) is not handled.
[b]/goto [/b]<label>
Moves macro execution to a label
:<label name>
A label for /goto
[b]/zapvars[/b] [novars|noarrays|notimers]
Clears all variables, arrays, and timers
[b]/seterror[/b] errormsg
Sets $getlasterror
/seterror clear
Clears $getlasterror
[b]/memspell[/b] gem# "spell name"
Attempts to memorize "spell name" into gem#
You must know the spell, be the right level, have your book open, and the gem must be empty.
[b]/msgbox [/b]<text>
Pops up a message box with an ok button. Do not use this if you are not running EQW.
[b]/varset[/b] <v#,p#,l#,t#,a(#,#)> <value>
[b]/varadd[/b] <v#,p#,l#,t#,a(#,#)> <value>
[b]/varsub[/b] <v#,p#,l#,t#,a(#,#)> <value>
v,p,l: Set, add, or subtract variables
a: Set, add, or subraact array variables
t: Set, add, or subtract time from a timer (in 10ths of a second, suffix s for seconds, m for minutes)
[b]/varcalc [/b]<v#,p#,l#,a(#,#)> <equation>
Handles +, -, /, *,\ (integer divide), % (mod), and ^ (power)
[b]/delay[/b] <time> <s, m>
Fully pauses macro for a set amount of time
time: Time in 10ths of a second (or suffixes s/m)
[b]/call [/b]<subroutine> [param [param...]]
Calls a subroutine (defined by Sub <name>)
[b]/return [/b][value]
Returns from a subroutine, returning a value if specified
[b]/doevents[/b] [flush|specificevent]
Runs any events that have queued up or flush queued events
If a specificevent is specified, only those events will run (/doevents chat will only run "chat" events)
[b]/merchant [/b][similar] "item name"
When with a merchant, will select that item if the merchant is selling it.
[b]/unload[/b]
Unloads MacroQuest
[b]/breakin[/b]
__asm int 3 (You must have a debugger attached)
--------------------------------------------------------------------------------
[b]3c. Macro Variables[/b]
[b]$pack([bank,]pack,xxx)[/b]
Returns pack information, use "e" for pack to get enviromental pack information.
xxx can be: name, open, size, slots, weight, space, empty
[b]$cursor(xxx)[/b]
Returns cursor item information
xxx can be: name, value, size, stack, weight, lore, nodrop, norent, magic
[b]$item([bank,]inv/pack,slot,xxx)[/b]
[b]$equip(position,xxx)[/b]
Returns inventory item information, use "e" for pack to get enviromental pack information
xxx can be: name, value, size, stack, weight, lore, nodrop, norent, magic
position can be: ear1, ear2, neck, face, head, finger1, finger2, wrist1, wrist2,
arms, hands, shoulder, chest, back, waist, legs, feet,
primary, secondary, ranged, ammo
Samples:
$item(3,5,value): value of item in slot 5 of pack in slot 3.
$item(inv,7,name): name of item in inventory slot 7.
$item(e,0): is there an item in enviromental pack slot 0.
$item(bank,0,4,weight): weight of item in slot 0 of bank pack 4.
$item(bank,inv,2): is there an item in bank slot 2.
$equip(primary): do you have something equiped in your primary hand.
$equip(arms,name): name of item equiped in arm slot.
[b]$pack([bank,]slot,xxx): [/b]returns pack information.
xxx can be: name, combine, open, size, weight, slots, space, empty
For a list of combine types, see Appendix D.
[b]$count(itemname)[/b]
Returns the total count of itemname in your inventory
[b]$freeinv(xxx)[/b]
Returns information about free pack space
xxx can be: space, size
[b]$hslider(xxx)[/b]
Returns information about the slider
xxx can be: cur, max
[b]$find(xxx)[/b]
Returns status of the last /finditem command
xxx can be: pack
[b]$mouse(xxx)[/b]
Returns mouse coords.
xxx can be: x, y
[b]$distance(y,x)[/b]
Returns the distance to a location
[b]$distance(item)[/b]
Returns the distance to last /itemtarget
[b]$distance(door)[/b]
Returns the distance to last /doortarget
[b]$id(n)[/b]
Returns the ID for the N'th spawn.
[b]$id(spawnname)[/b]
Returns the ID for the first spawn named spawnname
[b]$group(count)[/b]
Returns number of members in your group, will always return at least 1 (yourself)
[b]$group(0-5)[/b]
Returns the spawn ID for a group member, 0 if they are out of the zone, or -1 if that member doesn't exist
0 is yourself, 1-5 are the other members.
[b]$alert(#)[/b]
Returns TRUE if any alert on list # is true
[b]$zone(bound|birth)[/b]
Returns your current zone without switches.
Else returns the zone you are bound/born in.
[b]$lasttell[/b]
Returns the name of the last person to send you a tell
[b]$target(xxx)[/b]
Returns information on the current target
xxx can be: name[,clean], surname, id, x, y, z, heading, headingto, state, speed, distance[,nopredict|x|y|z], type, level, gm, class, race, gender, light, pet, master
state can return: STAND, SIT, DUCK, BIND, FEIGN, DEAD
$target(hp,xxx) returns the target's hp: cur, max, pct
$target(next/prev) returns the id of the next/previous spawn.
$target(held,xxx) returns the model name for a held slot
xxx can be: right, left, shield
[b]$spawn(id,xxx)[/b]
Returns information on a spawn
xxx can be: name[clean], surname, id, x, y, z, heading, headingto, state, speed, distance[,nopredict|x|y|z], type, level, gm, class, race, gender, light, pet, master
state can return: STAND, SIT, DUCK, BIND, FEIGN, DEAD
$spawn(id,hp,xxx) returns the spawn's hp: cur, max, pct
$spawn(id,next/prev) returns the id of the next/previous spawn.
$spawn(id,held,xxx) returns the model name for a held slot
xxx can be: right, left, shield
[b]$door(xxx)[/b]
Returns information on the last /doortarget
xxx can be: name, id, x, y, z, heading, defaultx, defaulty, defaultz, defaultheading, headingto, distance, open
[b]$ground(xxx)[/b]
Returns information on the last /itemtarget
xxx can be: name, id, x, y, z
[b]$heading(y,x)[/b]
Returns the heading to a location
[b]$char(xxx)[/b]
Returns information on the current target
xxx can be: name, surname, id, x, y, z, heading, speed, ismoving, state, type, level, exp, class, race, gender, light, pet, cash (total cash in copper), plat, gold, silver, copper
state can return: STAND, SIT, DUCK, BIND, FEIGN, DEAD, STUN
$char(xxx,bank) returns your bank values for cash, plat, gold, silver, or copper
$char(skill,xxx) returns skill level (see Appendix C)
$char(hp,xxx) returns your hp: cur, max, pct
$char(mana,xxx) returns your mana: cur, max, pct
$char(stamina,xxx) returns 0 -- will be your stamina: cur, max, pct
$char(aa,xxx) returns Alternate Advancement information: exp, points, rank
$char(ability,xxx) returns what /doability you have a skill set to (see Appendix C)
Also can return:
0: Skill not on an ability button
-1: You do not have that skill
-2: The ability is on a button but unusable right now
$char(ability,#) returns the ability name for a /doability slot
$char(buff,xxx) returns the buff slot for a spell name, or 0 if the buff isn't up
$char(buff,#[,xxx]) returns information on a buff slot, or NULL if the slot is empty
If xxx is omitted, the spell name is returned, otherwise, xxx can be: spellid, level, duration (in ticks remaining)
$char(gem,xxx) returns the casting gem for a spell
Also can return:
0: Spell not on an gem
-2: The spell is on a gem but unusable right now
$char(gem,#) returns the spell name for a casting gem
$char(book,xxx) returns the spell book slot for a spell
$char(book,#) returns the spell name for a spell book slot
$char(held,xxx) returns the model name for a held slot
xxx can be: right, left, shield
[b]$combat[/b]
Returns TRUE if you are in attack mode.
[b]$invpanel[/b]
Returns TRUE if your inventory is open.
[b]$merchant[/b]
Returns TRUE if a merchant window is open.
[b]$merchant(has,"item name")[/b]
Returns TRUE if merchant has an item.
[b]$return[/b]
Returns the return value from the last /call
[b]$rand(max)[/b]
Returns a random number between 0 and max
[b]$getlasterror[/b]
Returns the last error if any
[b]$gm[/b]
Returns TRUE if a GM or Guide is in the zone
[b]$arg(num,string)[/b]
Returns a space delimited substring.
ie. $arg(2,"Am I here?") will return "I"
[b]$left(num,string)[/b]
Returns a couple of the characters from the left side of string
ie. $left(4,"Am I here?") will return "Am I"
[b]$right(num,string)[/b]
Returns a couple of the characters from the right side of string
ie. $left(4,"Am I here?") will return "ere?"
[b]$ucase(string)[/b]
Returns the string in uppercase
ie. $ucase("Am I here?") will return "AM I HERE?"
[b]$lcase(string)[/b]
Returns the string in lowercase
ie. $lcase("Am I here?") will return "am i here?"
[b]$strlen(string)[/b]
Returns the length of the string
ie. $strlen("Am I here?") will return 10
[b]$instr(word,string)[/b]
Returns the location of word inside string, returns -1 if not found
ie. $instr(here,"Am I here?") will return 5
[b]$mid(start,num,string)[/b]
Returns a part of string based on start and num
ie. $mid(5,4,"Am I here?") will return "here"
[b]$if([n,]cond,truestr,falsestr)[/b]
If cond is true (n does a numeric comparison), returns truestr else returns falsestr
Generally used for min/max (ie. $if(n,$v99<$v98,$v99,$v98) will return the smaller of v99/v98)
or plurals (ie. /echo There $if(n,$l0==1,is,are) $l0 fl$if(n,$l0==1,y,ies) here. will format the string correctly depending if l0 is 1 or not)
[b]$calc(formula)[/b]
Returns value of formula, same parsing as /varcalc
[b]$abs(value)[/b]
Returns the absolute value of value
[b]$int(value)[/b]
Truncates value to an integer
[b]$lastcommand[/b]
Returns the last command run
[b]$sin(formula), $cos(formula), $tan(formula), $asin(formula), $acos(formula), $atan(formula)[/b]
Return the value of the corresponding trigonometric function, same parsing as /varcalc
[b]$v#[/b]
Returns a user variable, set by /varset, /varadd, or /varsub
[b]$p#[/b]
Returns a subroutine parameter
[b]$l#[/b]
Returns a local variable.
[b]$a(#,#)[/b]
Returns an array variable
[b]$t#[/b]
Returns a timer value (there are 40 timers now, up to t39)
[b]$running[/b]
Returns the number of seconds the macro has been running
[b]$time(xxx)[/b]
Returns the time.
xxx can be: h, m, s
[b]$date(xxx)[/b]
Returns the date.
xxx can be: y, m, d
[b]$spell("spell name",xxx)[/b]
Returns information on a spell
xxx can be: id, level, mana, range, casttime, recoverytime, recasttime, duration
casttime, recoverytime, recasttime, and duration are in seconds
duration can also return INSTANT, PERMANENT or UNKNOWN



