• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Macro Tutorial

Status
Not open for further replies.

LordMage

New member
Joined
Jan 18, 2005
RedCents
10¢
I know they have stuff on MacroQuests website, but those guys are a bunch of asses, they will flame you for asking a simple question, so I am starting this thread to help myself and others make or edit Macros

the macro that I am using to start this thread is not mine, it was posted by Redbot, but I am going to breakdown the parts I understand and pose questions about the parts I don't understand.

here it is:
Rich (BB code):
| This macro made for www.Redguides.com
| Don't steal it or we'll punch your fase!
#turbo  
#event camp "personingroup tells the group, 'lets roll'  
#event dzadd "personyouwanttoadd tells you, 'add me'  
#event invite "#*#invites you to join#*#"  
#Event Zoned "#*#You have entered#*#"  
  
  
Sub Main  
  
    
:loopstart 
/doevents  
/call GMcheck  
/if (${Target.Level}>67) /tar npc next 
/if (${Target.Distance}>220) /keypress esc  
/if (${Target.ID}==FALSE) /tar NPC radius 220  
/delay 10  
/goto :loopstart  
/return  
  
 Sub GMcheck  
 /if (${Spawn[gm].ID}) {  
 /echo Gm detected  
 /beep 
 /beep 
 /beep  
 /keypress 9 
 /endmac 
 /unload 
 /q  
 }  
 /return  
  
 Sub event_camp  
 /sit  
 /camp desk  
 /return  
  
 sub event_zoned  
 /delay 5s  
 /sit  
 /camp desk  
 /endmac 
 /return  

 sub event_dzadd 
 /dzadd personyouwanttoadd 
 /return 

 sub event_invite  
 /invite  
 /return
 
okay, in the above post, the macro starts off with some comments they are designated by "|" and run the length of the line they are on.

the next thing is a set of events designated by "#" I don't know what #Turbo does, but I know the other ones are checking for text that has entered the main chat window, I would like an explination of how and why these are used.

next is "sub main" it is the controller of the macro, everything starts here.

the line ":loopstart" is nothing special, it could be called everything. it is just a line label so you have a position you can return to if you want. "/doevents" checks to see if any of the events that were listed above have occured.

"/call GMCheck" is our first function, it escapse the line to line code execution and jumps down to where you see "Sub GMCheck" this function checks to see if a GM has entered the zone you are in.

"/if (${Spawn[gm].ID}) {" does a few things, first the "/if" statement is a checking procedure. it returns either a true or a false back to the interpreter.

the value it is checking is surrounded by "${ }" I don't know why, but every variable wheather it is yours or generated from EQ must be surrounded by these.

"Spawn[gm].ID" is a variable that returns a 1 if it finds a GM in the area, and a 0 if it does not. if it does then the rest of the lines of code will be executed.
"/echo" is a command that displays on the screen in a chat window any text put after it on the same line.

"/beep" is self explanitory.

"/keypress 9" I am unsure about, it looks like it presses 9 but I don't see how that does anything. the lines "/endmac" "/unload" and "/q" do the following in order It ends the current macro, unloads something, my guess is MQ2, let me know if I am wrong, and then camps EQ to the desktop. if no GM is found, then the "/return" command send the interpreter back the the next line after the "/call GMCheck"
 
Last edited by a moderator:
The next lines are "/if (${Target.Level}>67) /tar npc next" which simple test to see if the currently targeted NPC has a level of greater than 67, and if so it targets the next NPC.

"/if (${Target.Distance}>220) /keypress esc" is for when you get a runaway NPC and they leave spell range. it will press escape for you and untarget the NPC.

"/if (${Target.ID}==FALSE) /tar NPC radius 220" this one is checking it see if there are any NPC's in the radius of 220 and if so it is targeting them it only does this if you have no NPCs Targeted already which it checks with Target.ID.

"/delay 10" waits 10 clock ticks and then moves to the next line of code.

"/goto :loopstart" this one send the interpreter back up to the label named ":loopstart" and that is about the end of it. I skipped it earlier on purpose, but when the line "/doevents" is executed if it finds that any of the events are true it runs a function in this case anyway,

"#event camp "personingroup tells the group, 'lets roll' "" I thinks "personingroup" is either a place holder or a desgnater, I am not sure. this checks for a group messege that says "lets roll" if it is found, it runs the "sub event_camp". inside of this functions there aren't many lines, but here they are.

"/sit" "/camp desk" and "/return" this puts you on your but, camps you to the desktop and returns execution back to main. next is "#event dzadd "personyouwanttoadd tells you, 'add me'". "personyouwanttoadd" is the same type as "personingroup" if someone could elaborate for me on the function of these please do. this event check for a tell saying "add me", if it finds it then execution goes to "Sub event_dzadd".

here it is "/dzadd personyouwanttoadd" this invites "personyouwanttoadd" to your group. the next two events are about the same up top, the "#*#" are like using * in a search and simple ignore text infront of the statement you are looking for. for event invite, the line "/invite" is used to accept an invitation from someone.

and in event zoned the line "/delay 5s" is different from "/delay 10" used earlier, it will actually delay for 5 whole seconds and opposed to ticks. the rest of the function is just like event camp except it ends the macro before you camp out, by using "/endmac" the reason it does this is because you are in a different zone and chances are you died, so you don't want to attack random NPC in your hometown.

I will gladly accept any questions or comments, and please add snippets of code with explination if you have it or questions if you have them. I will try to answer what I can, and hopefully others will answer what I can't
 
Last edited by a moderator:
Made some paraphgraphs for ya LordMage. It's a good breakdown of the macro, and if anyone reads it they should have enough knowledge to do some minor editing on their own.

And yes,

/keypress 9

presses 9 on the keypad, which I have assigned to Fading Memories (bard AA).
 
normally i just use the following line.
/aa act "Fading Memories"
 
LordMage said:
the value it is checking is surrounded by "${ }" I don't know why, but every variable wheather it is yours or generated from EQ must be surrounded by these.

In programming "$" is very common to denote a variable. The ${...} will donote a variable that contains a variable string i.e. ....

${Me} = My Character
${Me.Name} = My Character's Name

These varaibles can become very complex i.e. ...

${Me.AbilityReady[Backstab]} = My Character has the "Backstab" available and ready. What is inside the "[...]" is a qualitative value.

Every "." in the varable string will build on itself. Here are some examples common string starters and some sub variables that I have found in various macros (granted this is a very small list compared to all of the variables):

Rich (BB code):
${Me.Name} = My Character's Name
${Me.Surname} = My Character's Surname
${Me.Level} = My Character's Level
${Me.Race} = My Character's Race
${Me.Class} = My Character's Class
${Target.Name} = My Target's Name
${Target.Level} = My Target's Level
${Target.Race} = My Target's Race
${Target.Class} = My Target's Class
${Me.Inventory[head].Name}
${Me.Inventory[face].Name}
${Me.Inventory[neck].Name}
${Me.Inventory[rightear].Name}
${Me.Inventory[leftear].Name}
${Me.Inventory[arms].Name}
${Me.Inventory[hands].Name}
${Me.Inventory[rightwrist].Name}
${Me.Inventory[leftwrist].Name}
${Me.Inventory[rightfinger].Name}
${Me.Inventory[leftfinger].Name}
${Me.Inventory[shoulder].Name}
${Me.Inventory[back].Name}
${Me.Inventory[chest].Name}
${Me.Inventory[waist].Name}
${Me.Inventory[legs].Name}
${Me.Inventory[feet].Name}
${Me.Inventory[mainhand].Name}
${Me.Inventory[offhand].Name}
${Me.Inventory[ranged].Name}
${Me.Inventory[ammo].Name}
${Me.Platinum}
${Me.Gold}
${Me.Silver}
${Me.Copper}
${Me.PlatinumBank}
${Me.GoldBank}
${Me.SilverBank}
${Me.CopperBank}
${Me.HPBonus}
${Me.ManaBonus}  
${Me.EnduranceBonus}
${Me.HPRegenBonus}
${Me.ManaRegenBonus}
${Me.ShieldingBonus}  
${Me.SpellShieldBonus}
${Me.DoTShieldBonus}
${Me.AccuracyBonus}
${Me.AttackBonus}
${Me.StrikeThroughBonus}
${Me.CombatEffectsBonus}
${Me.DamageShieldBonus}
${Me.AvoidanceBonus}
${Me.StunResistBonus}
 
Last edited:
wow good info ..

Lang.mac has been done... i posted a modified version in questions and answers forum.

good for an over night or two to max a grp of toons their lang skills


has someone done one already? YES! 8-)

Thanks stiflersmom!!!
 
Last edited:
I did a language macro, but only for 1 language :p
 
what does #turbo do?

Does /DZadd work? is it a plugin or something from moveutil?

is there someplace to find out what all moveutil allows us to do?

Hopefully the answers to these might help some of us NOOB macro coders

8-)
 
armysoldier said:
what does #turbo do?

Does /DZadd work? is it a plugin or something from moveutil?

is there someplace to find out what all moveutil allows us to do?

Hopefully the answers to these might help some of us NOOB macro coders

8-)

#turbo will prevent bad macros from locking up the client by allowing you to limit the number of commands per iteration. The default is 20, which is also the maximum value. A value of 1 will essentially disable #turbo.

/DZadd (name) will add a person to your expedition.

And I think soul has a list of plugins and what the commands are and what they do.
 
This is all quoted from Mq2 Wiki

Pound Commands

Pound commands are pre-execution commands that are not run during the macro.

#turbo [#] This will prevent bad macros from locking up the client by allowing you to limit the number of commands per iteration. The default is 20, while the maximum value is 40. A value of 1 will essentially disable #turbo.

#turbo is active with the default of 20 in all macros even if you do not use #turbo in your macro.

#define replaceme replacement Replaces all occurrences of replaceme with replacement throughout the macro.

Example #define Me charactername When the macro executes, when Me occurs, it will be replaced with charactername

#include "filename" Allows you to use functions from another macro file by using /call.

Normally the filename extension .inc is used to indicate that it is an include file, but you may use any extension name that you like.

Subs present in an include file are accessible by the calling macro as if the Sub existed within the calling macro.

#event eventname "string" Creates a custom event (Sub Event_eventname) that occurs whenever string is sent to the chat box.


Example #event SpellFizzle "Your spell fizzles!"

Matching Sub: Event_SpellFizzle


A matching Sub must be used. Custom events are further explained in Subroutines


Please see Custom Events for additional information about events.
 
Subroutines

Every macro has a Sub Main that defines the macro's entry point. Sub Main accepts parameters if desired.


Sub Main . code . /return


Additional Subs can be defined and used with /call. /return will return to the statement after the /call.

All subroutines and Sub Main accept passed in parameters. Some information you need to remember is: You do not have to define parameters for a sub Parameters passed to a Sub without defined parameters will default to Param0, Param1, ... Paramn Default parameters are of type string If you define the parameters of a Sub, the parameters can be of any data type that exists in MQ2DataVars If the type of a defined parameter is not given, it will default to string When you define the parameters, you may use the parameter names as variables in the sub If parameters are undefined, you would use Param0, Param1,...Paramn as the variable names Sub Main(int MyParam1, MyParam2, float MyParam3) /if (${Defined[MyVar2]}) /goto :DoThis /call MySub ${var1} ${var3} /echo This value was returned from MySub: ${Macro.Return} /return

Sub without defined parameters

Sub MySub /if (${Defined[Param0]}) /goto :DoThis . execute this code when /call MySub is executed. Parameters are not necessary. . /return [value|${varname}]

Sub with defined parameters

Sub MySub(int MyParam0, bool MyParam1, MyParam2) . execute this code when /call MySub is executed. . /return [value|${varname}] The above Sub has 3 Parameters, MyParam0 is an int type, MyParam1 is a boolean type , and MyParam2 is a string type.

Special subroutines (Chat, Timers, and Custom) starting with Event_ are used in conjunction with the command /doevents


Chat Events


Sub Event_Chat[(ChatType,Sender,ChatText)]

ChatType : Channel of message (tell, group, say) Sender : Name of the person who sent the message ChatText : Text they sent


Example

Sub Event_Chat[(ChatType,Sender,ChatText)] . This code is executed when /doevents finds(queues) text in the channel defined by #chat "channel" . /return [value|${varname}]


Timer Events


Sub Event_Timer[(Timer,OriginalValue)] Timer: Timer that fired OriginalValue : Value timer was originally set to Example

Sub Event_Timer[(Timer,OriginalValue)] . This code is executed when /doevents detects(queues) any defined timer reaching 0 . /return [value|${varname}]

Retrieved from "http://www.macroquest2.com/wiki/index.php/Subroutines"
 
Custom Events

The new Custom Event system requires that you use the entire line of chat, BUT allows for making sections of the line a parameter.


Old Event system

Event SelfEcho "[MQ2] Genbot "
Here is what the new Event look like:

Event SelfEcho "[MQ2] Genbot #1#"
The #1# in the middle of the match text is what you use to indicate "this part of the message should be given to me in a parameter". The number between the # signs says what parameter number you want this to be in your Sub Event_Whatever.

The first parameter in the sub will be the entire line itself... 1 starts AFTER that. e.g. this event could look like this:

Sub Event_SelfEcho(string Line, string Command)
Imagine this is the text that matches the event text:

"[MQ2] Genbot THIS IS MY COMMAND"
The two parameters are:

Line=[MQ2] Genbot THIS IS MY COMMAND
Command=THIS IS MY COMMAND
The system also allows you to grab a MQ2Data value like this:

#Event SelfEcho "[MQ2] Genbot |${Me}| #1#"
The system itself has no idea that MQ2Data even exists, and is just looking for the | or #.

MQ2 makes it parse what's inside the || as MQ2Data when the system checks to see if the event is a match.

So, this event would only hit when, if ${Me} is currently "Lax", the message starts like..

"[MQ2] Genbot Lax whatever"
Notes:

Because this system lets you pick the parameter number of any portion of the message, some parameters might not get made (e.g. wont be ${Defined}... it's up to you to make sure you get the ones you need defined. The MQ2Data is not immediately parsed when the event is made, it gets parsed when the system checks to see if the event is a match. If you need to SKIP a portion of the text (dont care about it, just need to ignore part of the text that might not match, whatever), you can use #*#. Example

Event SkillUp "You have become better at #1#! (#2#)"
Sub Event_SkillUp(SkillUpText,Skill,int Amount) /popup ${Skill} increased - ${Amount} ... /echo ${Skill} increased - ${Amount} ... /return

SkillUpText = "You have become better at #1#! (#2#)" Skill = Parameter 1 = #1# Amount = Parameter 2 = #2#

Also, you can have custom events that record all chat of a certain type, such as tell via the #Chat pound command

#Chat tell
These are activated with the Sub Event_Chat which takes the parameters of the type of chat (ie. tell), the sender, and the message text

Retrieved from "http://www.macroquest2.com/wiki/index.php/Custom_Events"
 
MQ2DataVars

MQ2Data was designed so that accessing information could be done utilizing a uniform system. User variables are utilized as MQ2Data Top-Level Objects.

About Types

User variables can be declared as any MQ2DataVars type, however there is no reason to create a variable that is an independent type such as the macroquest type, although it will work.

Scopes

There are three scopes used by macros.

global Variables of global scope ALWAYS exist until they are deleted or macroquest ends

outer Variables of outer scope exist while a macro is running

local (default) Variables of local scope only exist while within a macro function or "Sub"

Commands specific to user defined variables

/declare varname|varname[array extents] [type] [local|global|outer] [defaultvalue] Creates a variable within a particular scope and of a particular type. The parameters must be given in order, but any after varname may be skipped to use the default.


The default type is string The default scope is local The default value is nothing (empty string, or 0) These variables can be of any type that exist in MQ2DataVars. The variable will then have access to the members of that type.


Examples

/declare MyVar int outer
Creates an int variable named MyVar that exists while the macro is running

/declare MyVar local
Creates a string variable named MyVar that exists within the Sub it was created in

/declare MyTimer timer outer 3000
Creates a timer named MyTime that is set to 3000 at creation and exists while the macro is running

Arrays

To create an array, attach brackets to the end of the variable name and place in it the number of elements per dimension.


Array Examples

MyArray[10] int Creates a single-dimension local array of int with 10 elements (1-10) all 0

MyArray[10,10] int outer 5 Creates a 2-dimensional 10x10 elements(1-10,1-10) int array of scope outer with all values of 5

MyArray[4,5,6] string outer UNDEFINED-ARRAY-ELEMENT Creates a 3-dimensional array with 4x5x6 elements (1-4,1-5, 1-6) with UNDEFINED-ARRAY-ELEMENT in each location There is no limit to the number of dimensions or the number of elements in each dimension, but use your own good judgement.

Note: You cannot make an array of timers.

/deletevar varname [*|global]
Deletes the variable varname. Using * global will delete all global variables.

/varset varname [newvalue]
Sets a variable directly to a new value. Keep in mind that the type itself may reject this value depending on what you give it. To clear the value of the variable, you may omit the new value.


Examples

/varset MyString ${MyString}stuff
concatenate a string variable

/varset MyString stuff${MyString}
inserts stuff at the front of ${MyString}

/varset MyInt 123
Sets MyInt to 123

/varset MyTimer 123s
Sets MyTimer to 123 seconds

/varset MyFloat 1.23
Sets MyFloat to 1.23

/varset MyIntArray[n] 123
Sets array element n to 123




/varcalc varname formula
Sets a variable directly to the numeric result of a calculation. Keep in mind that the type itself may reject this value depending on what you give it. This will NOT work on strings!


Examples

/varcalc MyInt 1+2*2+1

/varcalc MyInt 1+(2*2)+1

/varcalc NumBuffSlots ${Me.FreeBuffSlots}+${Me.CountBuffs}



/vardata varname newMQ2Datavalue
Sets a variable directly to the end result of a MQ2Data string. To use this, do NOT put ${} around the outer data to parse This is most useful for when you want to keep the result of something instead of trying to make the variable accept a string with /varset.


Example

/vardata MyFloat Math.Calc[${Me.X}+${Me.Y}]
Parsing

It is important to note that parsing of variables is performed from the inside to the outside, so any ${} inside your MQ2Data usage get evaluated before continuing.


Example

${MyString${MyVar}}
The parser first evaluates ${MyVar}. If MyVar's value is 1, this is then ${MyString1}. ${MyString1} is then evaluated, giving the value of whatever MyString1 is. ${${MyString}} will get the value of a MQ2Data query stored in MyString. This could be Me.Buff[1], or a variable name, or anything that is valid inside ${}. There is no limit to this recursion.

${${${${${${${${${${MyString}}}}}}}}}} will evaluate inside to outside until there is nothing left to evaluate.

This is also true for arrays: ${MyArray[${MyInt}]} has no problems.

Retrieved from "http://www.macroquest2.com/wiki/index.php/MQ2DataVars"
 
so what would ${Target.CleanName} do in a event or in a if statement? pretty much what is the cleanname part?
 
.CleanName is what the player by default is 'supposed' to see.

If you use .Name, you'll get something like an_orc_pawn02 or #Granitesmash (# in front of name is often used for named mobs)... the uses of cleanname are basically if you want to make the output prettier for yourself, or (most importantly) if it is in a line that other players that are not mqers might see. ${Target.CleanName} is for all intents and purposes identical to EQ's %t, but .CleanName is a member of spawn so it doesn't necesarily have to be your target.

Imagine...
" tells the raid, INCOMING an_ikaav_ruiner03!"
 
i just wanna know how i start the macro after i have it in my files and i load into game and am rdy to use
 
Rich (BB code):
/mac <macroname>.mac

Replacing <macroname> with the name of the macro

(Fast enough?)
 
/mac <macroname>

works as well. I didn't even know it worked with .mac on it...learn something every day.
 
It depends if you have show file extenions on or not. If you do, the NAME of the file has .mac, therefore you type .mac. If you don't, don't type .mac. Didn't know people still have that off....
 
I have file extensions showing. It works anyway, either way. It assumes the extension is .mac if you don't say it.
 
deacon85 said:
says /mac is not valid command perhaps i am saving my macros in wrong area?

in the folder your macroquest.exe file is.... look in there...

now you should see a macros folder

all macros should be in there

Rich (BB code):
example:

E:\My Documents\EQ\macroquest\ReleaseST

E:\My Documents\EQ\macroquest\ReleaseST\macros



then click on your MQ window that you see on your screen

note: most MQ2 users use this window or hot keys ,,, so that not trace of the commands are in your log files

now type

case said:
/mac <macroname>.mac

replace <macname> with the name of your macro

Rich (BB code):
example:

/mac castskills.mac

hope that helps





if that does not work

then delete your whole releasedst directory and get a new download (which we will be doing anyways with patch) and start from scratch







ps make sure any macs u have gotten of this site or another .. was saved as .mac and not .txt

8-)
 
is there a site that lists all the various variables? such as Me.Name, Me.Surname, Target.Distance, etc.?
 
Go to the MQ2 wiki and search "TLO", then click the first option.
 
Macro Tutorial
Status
Not open for further replies.

Users who are viewing this thread

Back
Top
Cart