PeteSampras
Active member
- Joined
- Mar 18, 2012
- RedCents
- 2,143¢
EDIT:
Source code: https://github.com/PeteSampras/MQ2Bot
status board/roadmap: https://app.gitkraken.com/glo/board/Xg3hmI40NwAQ87cJ
So I see a lot of interest in people writing plugins as opposed to macros and thought I might share my process for a couple routines as I rewrite mine. This will benefit the community by showing you some methodology and some best practices that I have found through trial and error, and benefit me by having input from others that actually know c/c++ where as I am just a newb at it. I will be putting up info in individual posts and probably editing this initial thread to show an overall flow. My rework is only just started and I have only created a single struct at this point. So for now, let's just get a a few basic steps done.
I will skip around my thought process im sure so it may get a little confusing at times. Like first I would kind of draw out what I wanted to do, all the tasks i want to accomplish, and then figure out how they connect and where I can use common variables. I am skipping that for right now and doing a little cart before the horse because i know what I need already from writing my mq2bot plugin.
Initial setup:
Follow the how to guide on the VIP site to create a plugin (http://www.macroquest2.com/phpBB3/viewtopic.php?f=31&t=6310), let's say I called this one "MQ2PluginName", and let's set up a header section for what we think we will need for now. You will have a bunch of other sections created in your plugin and we will get to them as we get to them but for now you can just leave them alone.I am sure I will need vectors, and i might need a map.
Simple header for now:
Also let's create a section for our baseline variables and structs that will need to be used.
So that gives me a very basic shell for defining some variables to use while maintaining some easy to read sections later. I am using free visual studio community 2015 with ReSharper as part of the intellisense color coding.
I know that for any plugin that is using spells or skills that I will want some common core information about each spell and several options just like in a macro. I cracked open my bot macro and pulled out every option in there for each spell and made a struct based on that. Also, i know that i may or may not want to use mq2cast and so i might want to include some options from that. So what are some options I want for a spell? This is still a working concept that can easily be modified but here is what I have so far before revisiting mq2cast options by creating a struct called "BotSpells":
Struct:
Oh the whitespacing on this forums is all jacked up and im not going to modify these by hand, but suffice to say the whitespace all works in visual studio for me so that it is easy to read. So every variable i added in that struct is something i plan on having an optional INI entry for that if you dont have an ini entry, it will resort to a default value. I am sure I will add other options as i continue to flesh this out, but that is a solid start of things I would care about a spell on when to use it and when i last used it.
Will pick up more in the next post during lunch or after work.
Source code: https://github.com/PeteSampras/MQ2Bot
status board/roadmap: https://app.gitkraken.com/glo/board/Xg3hmI40NwAQ87cJ
So I see a lot of interest in people writing plugins as opposed to macros and thought I might share my process for a couple routines as I rewrite mine. This will benefit the community by showing you some methodology and some best practices that I have found through trial and error, and benefit me by having input from others that actually know c/c++ where as I am just a newb at it. I will be putting up info in individual posts and probably editing this initial thread to show an overall flow. My rework is only just started and I have only created a single struct at this point. So for now, let's just get a a few basic steps done.
I will skip around my thought process im sure so it may get a little confusing at times. Like first I would kind of draw out what I wanted to do, all the tasks i want to accomplish, and then figure out how they connect and where I can use common variables. I am skipping that for right now and doing a little cart before the horse because i know what I need already from writing my mq2bot plugin.
Initial setup:
Follow the how to guide on the VIP site to create a plugin (http://www.macroquest2.com/phpBB3/viewtopic.php?f=31&t=6310), let's say I called this one "MQ2PluginName", and let's set up a header section for what we think we will need for now. You will have a bunch of other sections created in your plugin and we will get to them as we get to them but for now you can just leave them alone.I am sure I will need vectors, and i might need a map.
Simple header for now:
Rich (BB code):
// MQ2PluginName.cpp : Defines the entry point for the DLL application.
// Author: PeteSampras
#pragma region Headers
// Can safely ignore these warnings
#pragma warning ( disable : 4710 4365 4018 4244 4505 4189 4101 4100 )
#include <vector>
#include <map>
#include <iterator>
#pragma endregion Headers
Also let's create a section for our baseline variables and structs that will need to be used.
Rich (BB code):
#pragma region Structs
#pragma endregion Structs
#pragma region Variables
#pragma endregion Variables
So that gives me a very basic shell for defining some variables to use while maintaining some easy to read sections later. I am using free visual studio community 2015 with ReSharper as part of the intellisense color coding.
I know that for any plugin that is using spells or skills that I will want some common core information about each spell and several options just like in a macro. I cracked open my bot macro and pulled out every option in there for each spell and made a struct based on that. Also, i know that i may or may not want to use mq2cast and so i might want to include some options from that. So what are some options I want for a spell? This is still a working concept that can easily be modified but here is what I have so far before revisiting mq2cast options by creating a struct called "BotSpells":
Struct:
Rich (BB code):
#pragma region Structs
typedef struct _BotSpells
{
PSPELLINFO Spell;
char SpellName[MAX_STRING];
char SpellIconName[MAX_STRING];
char Gem[MAX_STRING];
char If[MAX_STRING];
char Target[MAX_STRING];
char SpellCat[MAX_STRING];
char SpellType[MAX_STRING];
int UseOnce;
int ForceCast;
int Use;
int StartAt;
int StopAt;
int NamedOnly;
int Priority;
ULONGLONG Recast;
ULONGLONG LastCast;
} BotSpells, *PBotSpells;
#pragma endregion Structs
Oh the whitespacing on this forums is all jacked up and im not going to modify these by hand, but suffice to say the whitespace all works in visual studio for me so that it is easy to read. So every variable i added in that struct is something i plan on having an optional INI entry for that if you dont have an ini entry, it will resort to a default value. I am sure I will add other options as i continue to flesh this out, but that is a solid start of things I would care about a spell on when to use it and when i last used it.
Will pick up more in the next post during lunch or after work.
Last edited:

