Pull.mac for use with MQ2Bot

Chatwiththisname

Learning2Code
Joined
Sep 28, 2008
Messages
1,234
Reaction score
54
Points
48
Location
Texas
Pull.mac

Pull macro

This is more of a melee style pulling macro, but I plan to modify it based on user input. Also hoping to separate melee/hybrid classes from pure caster class attack by default. User input is important in proper creation of a macro that is to be distributed.

So check it out, tell me what you like, what is broken, and what you'd like to see added.

For use in semi open area's unless UseMQ2Nav=True (and you have downloaded the ******** MQ2Nav - NavMeshes) ********
Not intended as a functional afk macro, but rather one you can use while watching TV :)

To manually add something to the "do not target" list make a hotkey or type
Code:
/alert add 1 ${Target.Name}
while targeting what you want to add.

Sample INI is below.

[Configuration]
MedAt=20 //Percentage of mana to stop pull and let the group med, This triggers for any group member.
MedTill=90 //When MedAt triggers, it will wait until that player is above this percentage before breaking out of the loop
Verbose=False //If set to true it will display what the macro is doing in the MQ2 window.
LevelGreater=5 //by default you will attack creates up to your level plus this value. Increase this value to hit tougher targets
Invulnerable=True //will automatically add unreachable/invulnerable targets 20 seconds after you target them.
WaitForHealth=85 //Your health must be above this value before it will pull another target.
HealTill=90 //If your health is below 85 on health check, it will wait until it is above 90 to pull.
ZRange=30 //ZRange is the Z radius (up and down) that it restricts pulling targets from.
UseMQ2Nav=False //Use MQ2Nav Mesh's to navigate instead of straight line movement.



TLO's in use while macro is running.
${Pulling} //Returns TRUE/FALSE, if at the camp and group fighting a mob, typing /echo ${Pulling} should be false

${alertTimer} //Typing /echo ${alertTimer} will tell you the time left on the Invulnerability Sub's timer, if 0 and you are stuck trying to pull something, be aware of the situation that caused it and let me know.

${PullRange} //This is your pull radius you assigned as the /mac pull ${PullRange}

${CampY} //The Anchor Y location

${CampX} //The Anchor X location

${CampZ} //The Anchor Z location

${ZRange} //Your Z Radius used in pulling. /Echo ${ZRange} to see the value in game.

${UseMQ2Nav} //Returns TRUE/FALSE based on INI preference.



Last Updated Saturday, June 24rd 2017 @ 7pm CST
 

Attachments

  • Pull.mac
    13.5 KB · Views: 194
Last edited:
Fixes

Updated the Pull.mac

Changes include:
Check XTarget[1] after you kill your current target before getting a new target
Invulnerability check now verifies that you are targeting the same creature as when the timer started. Was accidentally putting adds that hit you before the subroutine would get a new target (which is where the alertTimer was set) and thus add one of your adds to the alert list unintentionally...which can certainly cause problems for both pulling and killing of adds.

Still todo, check XTarget[1] while medding and stop medding if you got an add.
 
Group mana

I don't use a Merc and so it stands there waiting. When i take health check out it pulls but then doesn't mana check.

Line 27 & line 97. Says No such 'Group' member 'State'

Untitled.png
 
I don't use a Merc and so it stands there waiting. When i take health check out it pulls but then doesn't mana check.

Line 27 & line 97. Says No such 'Group' member 'State'

View attachment 7183

Try this.

I still haven't fixed it to check for adds during a mana check. I commented out the health check. If you want to change the health check so that it uses potions or something then you need to go to the HealthChk subroutine and change the HP values and the /command to corespond with what you would like it to do. But you would have to remove anything corresponding to a mercenary, which I've only done for the manachk subroutine.

I can change the health check to use potion belt item at a certain health percentage as you said you don't use a mercenary, but your feedback is needed to know how to proceed. IE: Always use potionbelt item 1 and at what percentage of health to do so at.
 
Last edited:
Manacheck

Thanks for that. No error with the merc now. I think it was my fault for not being clear, the mana check doesn't check the groups mana no my own. i have a cleric in group and wiz and want them to have some mana before it pulls. The health check doesn't really matter for me as i have a cleric.

Thanks for looking at it for me, much love
 
Thanks for that. No error with the merc now. I think it was my fault for not being clear, the mana check doesn't check the groups mana no my own. i have a cleric in group and wiz and want them to have some mana before it pulls. The health check doesn't really matter for me as i have a cleric.

Thanks for looking at it for me, much love

I'll try to go through the array for checking the mana of everyone in the group. I apologize for the latent responses, programming homework before this :-x. I suppose it's a two birds with one stone effect doing it that way anyhow, as the Merc will be in the group. I can check if the caster is a cleric type and set their mana around 20% before it waits for mana, for others in the group I can set for 10% I suppose. Not really sure as I don't know what you're wanting the settings to be. Hoping to find some percentages that work for most people running groups.
 
Last edited:
Group mana Check.

Group Mana check has been implemented. I also added check for the zone you are in. If you're in one of the typical "safe" zones where it is considered naughty to be playing with your macro's....then there is a check that will end the Macro. I've adjusted the GMCheck to no longer /unload and /q. Now it only /end's the macro. If you aren't paying attention you will likely die if this occurs. Please refer to the first post to download. This version of the mana check also checks for adds while waiting for mana. Note, that it doesn't force any members of the group to sit down (This includes yourself). Some consideration to be made for the possibility of implementing some EQBC instruction in the future, but that would require different setups and I'm just not down for that at the moment. Until I get some time to figure out how to use INI's everything except your pull radius will be hard coded based on a consensus.

Enjoy :)
 
Last edited:
Overhaul, Group Health Check, INI File, etc.

Implemented use of a config file (Pull_CharName_Class.ini) to allow customization

MedAt=20 (What Percentage of Mana do you want to pause the macro to med)
MedTill=90 (What Percentage of Mana do you want to med until once you are below MedAt value)
Verbose=False (Do you want the macro to tell you what it is doing (Helps for debugging))
LevelGreater=5 (How many levels higher than you do you want to pull)
Invulnerable=True (Automatically check for invulnerable or unreachable targets)
UseMercenary=False (Boolean (True/False) to see if you want to use a mercenary)
WaitForHealth=85 (The Percentage of health you want everyone to have in order to pull)
HealTill=90 (If someones health was lower than the value of WaitForHealth, then wait until their health is higher than this value before pulling again)

Created verbose mode
Changed hard coded information to use the same values as defaults for the INI creation per character.
Moved GroupManaChk sub to before TargetNPC sub (It was pulling when someone had no mana on first run)
Created the GroupHealthCheck that uses WaitForHealth and HealTill INI key values.
Improvements were made (in my opinion) to the pulling mechanics

Still looking for user input. People are downloading (and assumed to be trying it out) the macro, but I have received very little feedback. I can only assume that it works perfectly and no changes should be made.

TIPS:
MQ2MoveUtils has a feature that will leash your characters after each fight, simply go where you want them to be leashed to and type
Code:
/makecamp on 10
and then
Code:
/makecamp leash

Setting yourself as puller will get your mercenary to not follow you around, so it significantly reduces the chance that your mercenary will get aggro.
 
Last edited:
This macro works really well for me! I do have some suggestions for you.

I have attempted to use this macro in Valdeholm pit and it seems to target mobs a lot on a different z axis. This causes the macro to continue to work but the pulling to halt because he cant run uptop when down below. So maybe you could add a Z axis check of some sort.

I use this macro on a bard and with the bot plugin running he is trying to debuff the mob at 100% and he will cast songs/debuffs out in the playing field. So that could be improved somehow.

Also, it would be nice that if the the puller has something targeted for X amount of time without getting aggro he would /alert add 1 ${Target.ID} automatically.

The last thing I saw was that the bard had to melee attack until about 98% before pulling it back to the camp. The problem with this is some mobs summon at that percent so its a cat and mouse game getting him back to camp.
 
This macro works really well for me! I do have some suggestions for you.

I have attempted to use this macro in Valdeholm pit and it seems to target mobs a lot on a different z axis. This causes the macro to continue to work but the pulling to halt because he cant run uptop when down below. So maybe you could add a Z axis check of some sort.

I use this macro on a bard and with the bot plugin running he is trying to debuff the mob at 100% and he will cast songs/debuffs out in the playing field. So that could be improved somehow.

Also, it would be nice that if the the puller has something targeted for X amount of time without getting aggro he would /alert add 1 ${Target.ID} automatically.

The last thing I saw was that the bard had to melee attack until about 98% before pulling it back to the camp. The problem with this is some mobs summon at that percent so its a cat and mouse game getting him back to camp.


I'll look into the Z-axis issue. I have also used it in the pit in Valdeholm and found myself adding a lot of creatures to the alert list. Aggro TLO wasn't working right when i attempted to use it, but ill attempt to use Xtarget to check for aggro as I've done in other locations.

MQ2Melee does have its own settings, they may conflict with MQ2Bot. Try disabling the plugin to see if that fixes your songs in the field. PeteSampras has advised against turning the bot off and on with slash command inside the macro, but a quick fix is to do that where it says \varset Pulling True, and then false with \bot off and \bot on when you want the bot to quit doing things. Pete gave me a list of ways to halt his plugin temporarily, ill have to go over it and pull with my bard a bit.

The InvulnerabilityChk sub does have a timer that is created in the TargetNPC sub with a hard coded timer. In your INI set Verbose=True and you will get spammed as the timer counts down. (Along with everything else the macro does) If it reaches 0, and your target is the same target it was initialized on, and the health hasn't changed from when you targeted it till the timer counts to zero....-then- it will automatically add it, clear current target, and call the TargetNPC Sub. Which checks XTarget first, then looks for a new target if you don'thave one.

In the pull sub, change the if statement to pull at 99% or wait until I have time to address these issues, which I will do all at once. This is finals review week for my College classes and that will be my primary focus. I do have insomnia so ill probably do it tomorrow night :)

I test all my code myself, so be patient, I'm not as fluent as the coders that work for MMOBugs. But I create the circumstance that would cause something to happen based on the conditions of a statement to ensure it works before giving out broken/faulty code.

Thanks a ton for the input, this is the kind of feedback I need to know in order the prepare myself for my future as a programmer!
 
Last edited:
No worries man! Take your time on the updates. I got it to work for me by changing the below to < 100 instead of < 99. I guess you could change the code to be < or = 99 so that it would pull it once the mob is at 99% instead of waiting until 98% because that's how the code is currently working.

Code:
/if ((${Target.ID}) && (${Target.PctHPs} < 99) && (${Target.PctHPs} > 20)

Changed to 

/if ((${Target.ID}) && (${Target.PctHPs} < 100) && (${Target.PctHPs} > 20)

The other thing I did was to change at what % the bard debuffs. That stopped the casting while pulling. I for some reason had him debuffing at 100%.
 
Thanks

thanks so much for the mana and health checks they wwork perfectly!! I also had the same problem as above cos my bard could do 1 point of dmg lol but i found that line and adjusted it myself!

Great work. I Really appreciate it
 
Changes
ZRadius parameter declared and incorporated into targeting conditions. INI Setting added for ZRadius with a default value of 30. Update Macro to current release and run again for the key to be added to the INI with default value, then open it to make changes as needed.

Changed /keypress esc to /target clear so it would quit closing windows that the user might be looking at while running the macro (Apologies for that oversight)

Change the requirement to pull from <99 only requiring you have an XTarget. If this causes anyone problems please let me know. I've tested it for about 20 minutes before feeling ok with putting it in.

Incorporated use of EQBC using a boolean value of True/False. Default value is false. If true it will automatically make EQBC Members sit to rest for health and mana, and automatically /makecamp on 10 and /makecamp leash for all but puller. More suggestions welcome.

Using Plugin MQ2Cecho to make initialization colorful. This is purely aesthetics and doesn't affect the operation of the macro beyond the color of the output when you start the macro.

Things to come

I've been approached by another members Freewilly that says he had already created code for various things to do with pulling to include bow pulling, summoning/creating more arrows etc. He has offered to let me look over the code and I will implement his code as is seen nessesary by myself. INI keys for using these things will be created to set it to true/false boolean values for if you want to use it or not.

Now looking into using MQ2Navigation for pathing. This will greatly increase the usability of this macro to be more functional as far as pulling creatures without running into obstacles and accidentally zoning (Like in the pit in valdeholm I've pathed down into the cave trying to make a straight line pull of a target). This Plugin is pretty up there as far as complication goes for setting up. However the mesh files can be downloaded from the MMOBugs files site and you can also make your own mesh files. Trust me when I say that this plugin is golden for avoiding obstacles. It will also save me a ton of problems. Of course if you prefer the way it is setup now, there will be a boolean value for UseMQ2Navigation=False for default and an INI entry will be created for changing that. If the variable is True it will use commands for MQ2Navigation and if it is false it will use the current commands for MQ2MoveUtils. According to the WIKI for MQ2Navigation MQ2EQDraw will be required for the plugin to open doors, but it doesn't load for me. So I will be doing some indepth testing privately before making this a public thing.
 
Last edited:
Looking into class specific pulling options based on ${Me.Class.ID} currently I found a list of ID's per class on EQEmu, wanted to get players to assist me in confirming as I don't have access to all classes.

Class ID’s: 1=Warrior, 2=Cleric, 3=Paladin, 4=Ranger, 5=Shadow Knight, 6=Druid, 7=Monk, 8=Bard, 9=Rogue,
10=Shaman, 11=Necromancer, 12=Wizard, 13=Magician, 14=Enchanter, 15=BeastLord, 16=Berserker.

I will create a boolean for UseRanged=false, in the event the user wants to use ranged weapon (be it thrown or shot)
 
Those ID's seem to be correct. I've tested Cleric/Shaman/Mage/Ranger/Warrior and those all matched.
 
I keep this handy dandy list around for mq2bot:
Code:
PCHAR szClasses[] = {
    "0", // 0x0
    "1", // Warrior
    "2", // Cleric
    "3", // Paladin
    "4", // Ranger
    "5", // Shadow Knight
    "6", // Druid
    "7", // Monk
    "8", // Bard
    "9", // Rogue
    "10", // Shaman
    "11", // Necromancer
    "12", // Wizard
    "13", // Magician
    "14", // Enchanter
    "15", // Beastlord
    "16" // Berserker
};
 
I keep this handy dandy list around for mq2bot:
Code:
PCHAR szClasses[] = {
    "0", // 0x0
    "1", // Warrior
    "2", // Cleric
    "3", // Paladin
    "4", // Ranger
    "5", // Shadow Knight
    "6", // Druid
    "7", // Monk
    "8", // Bard
    "9", // Rogue
    "10", // Shaman
    "11", // Necromancer
    "12", // Wizard
    "13", // Magician
    "14", // Enchanter
    "15", // Beastlord
    "16" // Berserker
};

Initially I just looked at the values compared to what is there. Now that I pay more attention to what I'm looking at that is an array you created outside of the macros. Though I don't understand the syntax entirely. On a side note, thanks for the array values :)
 
it is c/c++. at any rate. i forgot if i told you or not, but if you are using mq2navigation, your pull macro could almost be as easy as something like:

Code:
Sub main
:main
/if (!${Bot.Pulling}) {
    /if (${ConditionsThatIMakeUp}) /findmob
    }
/goto :main
/return
Also, if you are actually willing to test it, i can just finish the pulling within the plugin. I didnt want to mention that since you seemed to be having fun learning how to code and I dont want to interfere with that.
 
it is c/c++. at any rate. i forgot if i told you or not, but if you are using mq2navigation, your pull macro could almost be as easy as something like:

Code:
Sub main
:main
/if (!${Bot.Pulling}) {
    /if (${ConditionsThatIMakeUp}) /findmob
    }
/goto :main
/return
Also, if you are actually willing to test it, i can just finish the pulling within the plugin. I didnt want to mention that since you seemed to be having fun learning how to code and I dont want to interfere with that.

By all means finish your code to make it an all round bot. I'll continue with or without. I'll test your code now.