I was wondering

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

I was wondering

Post by Hiidan » Wed Oct 06, 2004 10:20 pm

Is there any specific, cut-to-the-chase, guide for making macro's with examples etc? I've searched but haven't found anything really. I'm trying to modify the AFCleric macro for a druid (basically edit out everything for group heals, divine arbitration, DA, Yaulp, etc.) and I'm having some problems with that. So basically I want to start from scratch and try to make my own. Many will criticize that I should just use Genbot, but Genbot is very confusing to me, and although its a very broad spectrum bot program, I just want something simple. Heal, Nuke, Stun, maybe a dot occasionally, and some occasional buffs, which is prolly very complicated.

So... Any good macro creation guides out there so i don't have to bug you all too much?

Pugs
a lesser mummy
a lesser mummy
Posts: 41
Joined: Tue May 11, 2004 11:38 pm

Post by Pugs » Wed Oct 06, 2004 10:51 pm

There is no real guide other than to rtfm and look and see how other macs work, also there is alread a druid heal mac out there
http://www.macroquest2.com/phpBB2/viewtopic.php?t=7538

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Post by Hiidan » Wed Oct 06, 2004 11:18 pm

That one looks too simple :P I like AFCleric because it has a lot of options, and it will interrupt heals, has different heal modes etc. I also kinda wanna learn how to make my own macros, which is why i'm trying to learn.

hiipii
a ghoul
a ghoul
Posts: 93
Joined: Sat Jun 19, 2004 5:01 pm

Post by hiipii » Thu Oct 07, 2004 1:13 am

RTFM not to be mean but thats exactly what the manual is :D it comes complete with explanations for each and every command and examples for usage. That combined with all the macros in the depot == MQ2 macroing for dummys.

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Post by Hiidan » Thu Oct 07, 2004 10:02 pm

I highly disagree. They have what to put, but its not very self explainitory. I've changed my original idea of a simple macro, it has to be complicated. However Im going to start simple and work my way up a step at a time. Interrupt's, Fizzles, Taking damage, buff requests, Etc. Those are the things that i wanna have affect this bot. I am working on a code myself, all this post was for was to see if there was something other than looking at other peoples codes and reading the manual (which look more like a list of commands to me). Thats all.

Lum
a lesser mummy
a lesser mummy
Posts: 68
Joined: Thu Sep 16, 2004 10:12 am

Post by Lum » Fri Oct 08, 2004 12:21 am

Pretty much you right Hiidan, best way to learn is the manual and other's code. Start simple and work your way up and test things :P

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Fri Oct 08, 2004 2:57 am

I highly disagree. They have what to put, but its not very self explainitory
It could just be that you're not very bright.
other than looking at other peoples codes and reading the manual (which look more like a list of commands to me).
Yes, it's a manual. You'll find a 'Search' link above. It behaves a lot like a search function.

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Post by Hiidan » Fri Oct 08, 2004 6:53 am

Nice Sarcasm, its appreciated, and thanks for the personal insults. Not everyone can take 800 commands and just bust out a code, apparently you can.

TheAFKBard
a ghoul
a ghoul
Posts: 133
Joined: Tue Dec 30, 2003 9:48 pm

Post by TheAFKBard » Fri Oct 08, 2004 7:14 am

Quit griping about people telling you to RTFM and just get in there and get your hands dirty. Take a macro that looks like it might do some things you want it to do, sit there with an open copy of the manual in a window side by side with your code window, and go over each line piece by piece, looking up each command that you don't understand. Then make some changes to suit your particular task. Start with changing spell/ability names and work your way from there. Once you've exceeded the ability of the base macro, try writing your own. When you've done all this with some degree of success, come back to the message board with any specific problems you might be encountering.
Whatever you do, don't come here before putting in some of your own effort and ask people to do all the work for you or give you some guide to writing macros, or ask for one-on-one tutoring. That's a slap in the face to all the people who have contributed their time writing macros for the depot and writing the manual.
MQ2 macro language isn't rocket science. It's not C++, it's not FORTRAN or COBOL. It's just a straightthrough scripting language with a few subroutines and some branching capabilities. It's a lot like visual basic (censor: i'm an idiot; please ignore me) or pascal in structure.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Basic Guide to Macro'ing

Post by dman » Fri Oct 08, 2004 8:13 am

** Note, example only and could be bad to actually use, besides, its 6am and my baby woke me up so I'm bored **

1. Determine what you want your macro to do
Example: If my hps drop below 99%, target myself, cast the aa divine arbitration, cast the aa celestial regeneration, tell the group they suck, and gate.

2. Create your macros framework
Example: As we will have a macro that is continuously checking the circumstances, we will put in a basic loop.

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop

 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
3. Flesh out the outline with psuedocode to get an idea of how you want things to be done.
Example:

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   if my hitpoints go below 99% then (
     target myself
     cast aa DA
     cast aa CR
     /g fuck off asshats and learn to control agro
     cast gate
   )
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
4. Pull out the manual and start searching for what we want to do.
Example: First we need to find out how to do an if statement, lets check the Macroquest commands section, and we find:
/if (conditions) {command(s)}
Runs command(s) if conditions evaluates to TRUE.
conditions are ONLY numeric compares. You must use MQ2Data string comparison to turn string compares into numeric compares.

conditions gets evaluated down to a single term from however many terms there are (You may use && and || freely.)

Multiple commands can be surrounded by { }, allowing multiple commands to be executed if the comparison is true.
} can be followed by else and a command. (also see /multiline)

Example:
/if (${String[${firstvar}].Equal[This is true]}) {


/echo TRUE


} else /if (!${secondvar}) {


/echo FALSE

/mqlog secondvar equals: ${secondvar}


} else {


/echo It's Something else


}
Now we are getting somewhere, lets change the psuedocode to the actual code show in the usage.

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   /if (my hitpoints go below 99%) {
     target myself
     cast aa DA
     cast aa CR
     /g fuck off asshats and learn to control agro
     cast gate
   }
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Next we want to find out how to determine our characters hit points, lets search the manual for 'hit point', and we find:
character (inherits spawn)
Members
...
int PctHPs Percent hit points
We aren't quite done with this yet, as we need to find a TLO (Top Level Object) that accesses type character, to allow us to use the PctHPs object. Browsing the TLO reference in the manual and we come up with:
character Me
access to types: character, spawn
character object which allows you to get properties of you as a character
${Me} is a character object, so has access to all of the properties of the character reference Type. The character Type also has access to the properties of the spawn Type.
Ok, now lets put that together with the code:

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   /if (${Me.PctHPs}<=99) {
     target myself
     cast aa DA
     cast aa CR
     /g fuck off asshats and learn to control agro
     cast gate
   }
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Using the above steps we target ourselves by find the /target command, and find out how to figure out who to target (in this case, we'll just use our name).

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   /if (${Me.PctHPs}<=99) {
     /target ${Me.Name}
     cast aa DA
     cast aa CR
     /g fuck off asshats and learn to control agro
     cast gate
   }
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
/alt activate is an eq command, but we need the aa id number to use it, so lets get that out, the manual spits out:
altability
Members
...
int ID ID number
and the TLO to access that is aptly named
AltAbility
altability AltAbility[n]
Alt ability by number

altability AltAbility[name]
Alt ability by name
access to types: altability
putting things together leads to

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   /if (${Me.PctHPs}<=99) {
     /target ${Me.Name}
     /alt activate ${AltAbility[Divine Arbitration].ID}
     /delay 1
     /alt activate ${AltAbility[Celestial Regeneration].ID}
     /delay 1
     /g fuck off asshats and learn to control agro
     cast gate
   }
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Hmm, looks like we are almost there, so back to the manual and find a command to cast a spell.
/cast ["spellname"|"${varname}"]
  • [item "itemname"]
    Will cast the specified spell, or perform a right click of an item that has a right click spell
This looks to be a good choice and so:

Code: Select all

|  Savemyass.mac, usage /macro savemyass.mac
|  I use this to heal in groups with my cleric

Sub Main
 :loop
   /if (${Me.PctHPs}<=99) {
     /target ${Me.Name}
     /alt activate ${AltAbility[Divine Arbitration].ID}
     /delay 1
     /alt activate ${AltAbility[Celestial Regeneration].ID}
     /delay 1
     /g fuck off asshats and learn to control agro
     /cast "Gate"
   }
 /goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Now, this code should be functional at this point, but just fire up eq and playtest it. Things noticed while playtesting it might be: this macro needs to check if I'm actually in a group, my AA's are ready, or if my spell fizzles and I need to recast, or if I forgot to memorize gate, and so forth. Once you figure out what else you need, its back to the manual to flesh out the macro a bit more to make it more robust.
I didn't say you were at fault,
I said I was going to blame you.

SuperNoob
orc pawn
orc pawn
Posts: 24
Joined: Fri Aug 27, 2004 10:34 am

Post by SuperNoob » Fri Oct 08, 2004 9:09 am

ya know dman, that is a very nice outline of code development approach, it would be a good to include in the manual or faq for those folks that do not have a programming background. I think it is taken for granted that most folks have some programming ability, but it is nice to see the methodology in a short simple example.
What do you mean read the fabulous manual? What do you mean search? Why does everyone always ask me that?

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Post by Hiidan » Fri Oct 08, 2004 9:23 pm

Thanks Dman that helped.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Oct 09, 2004 1:34 am

Hiidan wrote:I highly disagree. They have what to put, but its not very self explainitory. I've changed my original idea of a simple macro, it has to be complicated. However Im going to start simple and work my way up a step at a time. Interrupt's, Fizzles, Taking damage, buff requests, Etc. Those are the things that i wanna have affect this bot. I am working on a code myself, all this post was for was to see if there was something other than looking at other peoples codes and reading the manual (which look more like a list of commands to me). Thats all.
TFM is more than a 'list of commands'. It's a reference.

Data types are not commands. But they play a rather large part of most macro's.

Using / commands is easy. All you have to do with those in some cases is copy/paste.

Understanding how the TLO's and data types work is the more challenging part.

endymion
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Feb 21, 2004 8:37 pm

Post by endymion » Mon Oct 18, 2004 5:00 am

TheAFKBard wrote:Quit griping about people telling you to RTFM and just get in there and get your hands dirty. Take a macro that looks like it might do some things you want it to do, sit there with an open copy of the manual in a window side by side with your code window, and go over each line piece by piece, looking up each command that you don't understand. Then make some changes to suit your particular task. Start with changing spell/ability names and work your way from there. Once you've exceeded the ability of the base macro, try writing your own. When you've done all this with some degree of success, come back to the message board with any specific problems you might be encountering.
Whatever you do, don't come here before putting in some of your own effort and ask people to do all the work for you or give you some guide to writing macros, or ask for one-on-one tutoring. That's a slap in the face to all the people who have contributed their time writing macros for the depot and writing the manual.
MQ2 macro language isn't rocket science. It's not C++, it's not FORTRAN or COBOL. It's just a straightthrough scripting language with a few subroutines and some branching capabilities. It's a lot like visual basic (censor: i'm an idiot; please ignore me) or pascal in structure.
Some of us actually aren't smart enough to pick up scripting languages on the fly, so we ask for help. I no longer do this, personally, since when I asked for help making an auto-summon macro for mages to automatically summon gear for whatever class asked them for it, I was shot down instantly saying I was a 'money macroer' and I only wanted to exploit. So, now I write my own little crappy macros that beep when I get a tell, or make a little /popup that tells me certain spells drop, and thats about all I have the talent for.

I think if people dropped the elitist attitude and actually helped some of us stupidniks (stupidniks, I might add, that frequently use the search command and read the fucking manual DAILY) there may be a bit more contributing. But then, I read on another post *cough* the heriarchy of the MacroQuest community, and I rated somewhere deep in the 'everyone else' category, so I think I'm shouting at a brick here.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon Oct 18, 2004 9:54 am

Hiidan wrote:...Interrupt's, Fizzles, Taking damage, buff requests, Etc. Those are the things that i wanna have affect this bot.
Do not worry about coding for Interrupts or Fizzles. Go to the snippets section and get SpellCast.inc or Spell_routines.inc. Both if these includes will take care of things like recasting when you fizzle or get interrupted. Spell_routines can even include a routine to interrupt your cast (like if someone else heals your target after you start casting, but before your heal hits.)

As for the rest I dont really know what to tell you. You can probably find good examples for most of the functions you want. I would start copying and pasting what you like and edit it to suit your needs. Post what you have once you get an idea of what you want, and people can try to help you make it better.