• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Learning how to write plugins (1 Viewer)

mybstfrnd3

New member
Joined
Dec 5, 2006
RedCents
I would love to learn how to write macros and plugins, where does one start? to all the writers out there= where did you start?
 
Last edited:
Re: Leaning how to write plugins

Chapter 1 : Introduction

Welcome to the complete idiots guide to writing macros for Macroquest 2. If your reading this, I am going to assume you know absolutely nothing about writing a macro. In the chapters to come we will cover many different parts of writing and maintaining a macro.

The first thing to remember is that this guide is not going to teach you everything, this guide will also not cover all of the aspects to macros, for that you can look up more advanced features on many different websites.

If this is your first time ever writing a macro or even looking at macro code, you will want to read this chapter completely. I am going to explain the different parts of a macro including subs and events.

First thing your going to want to do is open a copy of notepad. Now what were going to do is write a very simple macro. With all other types of programming languages it is customary to write a program called “Hello World”. We will do the same thing, write the following into notepad…

Sub Main
/popup Hello World!
/echo Hello World!
/end

Okay, now that we have that in note pad we are going to want to save it into our \MQ2\Macros\ directory. Here is how we do this…

Click on File > Save As


img1.JPG


This should open a box that looks like this…

img2.JPG


Now, what we want to do is save it as a mac file and not a text file. To do this you will need to change Save as type: Text Documents (*.txt) to All Files. So use the drop down box and choose all files….

It should then look like this….

img3.JPG


Now, name the macro helloworld.mac and click save. That’s it were done and ready to run our first macro. When your logged into Everquest, type /macro helloworld.

You should see in your MQ2 window, Hello World! And you should have had a pop up on your screen similar to task completions that also said Hello World! If you didn’t, then you did something wrong and start back at the beginning. Congradulations, you have created your first working macro! Pat yourself on the back and get yourself a Pepsi while I show you what all that meant that we typed into the macro.

For teaching purposes, I am going to number the lines that we typed into the macro, you don’t need to number the lines for any macro and it will screw it up if you do so.

1 Sub Main
2 /echo Hello World!
3 /popup Hello World!
4 /end

1 Sub Main
Sub main is used in every single macro you will ever write, it is the constant sub that will always be called upon while your macro is running. It will always be at the top of the macro and all variables are usually defined here as well as any looping. Most all other subs are called through sub main, except in some cases which we will talk about later.

2 /echo
The /echo command can be used for many things, like relaying stats or other information or just to say something in the MQ2 window. In this case, we used /echo to just say Hello World! In the MQ2 window.

3 /popup
The popup command is mainly used for effects you want to add to your macro, to make it more snappy and hyped up. It will always just say something in the middle of your Everquest window. In this example, we used it to say Hello World!

4 /end
The /end command is used to end the macro for various reasons. Some macros aren’t supposed to loop, some will end when a certain goal and been achived, others will end when a certain amount of time has passed ect. This is all done in different parts of a macro depending on events set up in the macro.

Well, there you have it! Now you should have some basic knowledge of macros and more importantly, you know how to save a macro. Things of note, macros are never compiled, they are just written and ran. So when talking about a macro, never use the word compile as to not confuse yourself or others that may not know.

Lets move on to the next chapter where we will work on events.


Chapter 2 : Events and Loops

Alright, here in chapter two were going to deal with events and loops usage in your macro. We will start with loops since you pretty much need a looping macro to have an event work anyways.

Loops:

Using a loop in a macro is a way to keep a macro or even a certain sup going until something, be it an event or waiting for mana or hit points to regen to a certain point.

Adding a look into a macro is fairly simple and pretty much just all part of Sub Main. Here is an example for you that continues in a loop until a certain event happens, in this case we will use a event with it, but don’t worry about the event line right now.

#event quit “#*#hey I did it#*#”

Sub Main
:loop
/doevents
/goto :loop

Sub event_quit
/echo You did it!
/end

Okay, in this example, your loop is actually called ‘loop’. If you read the macro its got :loop which is a marker for the /goto command to go back to. So you can have as many lines in between :loop and /goto :loop as you wish to add. And the macro will run those commands or look for certain events until it is told to stop either by the macro or by you. In this case if we were to read this in English it would read like this…

Were looking for a chat event that says “hey I did it” in any chat form. So we will start here (:loop) check to see if “hey I did it” has been said in any form (/doevents). If it has it will call the event quit. If not go back to :loop (/goto :loop)

You can name loop anything as long as your /goto command tells the macro to goto where you want it to(what you called :loop). For example, you can do :start and /goto :start. The thing to remember is when using this type of formatting, is the sole purpose to a continuing circle doing what you ask the macro to do.

Now, events are things you want your macro to look for at certain times or even all the time. In the case of an event you will put a line like this above Sub Main

#event MyEvent (Your events)

Now the event will also need its own sub for when it happens. The Sub will be called Sub event_MyEvent or whatever your event is named. And then you will put your commands in to that sub that you want to run when that event happens. In the case of the macro above, its just echoing that it was done properly and /end, thus ending the macro.

Events can be used for things such as pausing a macro if you get a tell, when an npc does something or says something you need to react to or even if your weight changes it can make a beep. Events are a very big part of macros. I hope now you understand more of how events and loops work.

The more macros you attempt to write and the more macros you read will give you more ideas on what you can do with events and loops. These are both very big part of writing macros and without them you could no loop a macro and you could not have a macro react to what happens in the world.

My best advise for learning more than what I have here is to look at other macros that you know exactly what they do in game, open them up and read though it.
 
Re: Leaning how to write plugins

Thats pretty much exactly what I was looking for. Thanks a bunch, just wish there was more info in the guide- I was afraid that I'd have to teach myself by studying the source code of pre-written macros.
 
Re: Leaning how to write plugins

mybstfrnd3 said:
Thats pretty much exactly what I was looking for. Thanks a bunch, just wish there was more info in the guide- I was afraid that I'd have to teach myself by studying the source code of pre-written macros.

Thats pretty much the way that every macro writer has learned.

http://www.macroquest2.com/includes/wassup/manual.php
is the holy grail of macro commands and writing.

http://www.macroquest2.com/wiki/index.php/Main_Page
is the wiki, but I've always stuck with the manual

As far as learning how to write plugins learn some C++ get the basics down, syntax etc.
 
The absolute best way to learn how to write good macros is by reading good macros. Personally I would suggest some of the shm macros for a good basic knowledge and for a good starting point any of the shorter ones... uhm can't think I kow my old one for vishimitar was pretty simple. I have posted a ton of them randomly for people if you look them up most of those are pretty simple.

Gotta love making fun of yourself =).

Oh I attached my old macros folder I have some I made myself some other people made. The ones I made are not really well commented but if you rummage through them can probably find some helpful code.
 
Learning how to write plugins

Users who are viewing this thread

Back
Top