Macro [WIP] Tutorial.mac

Chatwiththisname

Learning2Code
Joined
Sep 28, 2008
Messages
1,234
Reaction score
54
Points
48
Location
Texas
Yet another tutorial macro? But wait! There's more.

So of all the macros I realize that the majority of people just want to get the skull and port to pok. Well I was a bit bored and decided to go ahead and take it a step or 20 farther.

This tutorial macro uses MQ2Nav, MQ2Mele, and MQ2MoveUtils to navigate the tutorial including completing combat quests. Quests that require you to loot things and turn them in. It's pretty focused on the toturial, so it won't loot items unless they are for the quest.

Things my macro does that others don't.
It goes past getting the skull straight into "The Gloomingdeep Revolt" task
It is currently coded to complete up to task 10 including 1 optional quest (Partially untested. This is a Work in Progress. I coded this as I went through the tasks and tried to let the code do everything. However, in some cases I didn't go back and test a full runthrough of the code.)
It know's where you are at in the tasks based on your location and progress in "The Gloomingdeep Revolt"
Accepts rewards
Completes Basher Alga (added after some of the tutorial macros were made) and loots the runspeed clicky stick.
Navigates into the spider area and completes quests for cocoon silk and Dugan (requires my mesh)
Much more.


I would like assistance in reporting issues on this. Thus far I have done all the coding from scratch and all the testing myself.
The last task that it's setup to attempt is Guard Hobart's "The Battle of Gloomingdeep"
I'm having trouble with it because spiritslavers and wardens tend to be inside the pit and I haven't found a good way to ensure that they get killed without the character getting stuck navigating.

Since this knows what task you are on based on a designed flow and check of things it would be in your interest to stop it after getting your skull and gearing/buffing your toon and reentering the tutorial and resuming the macro.

Please let me know :) Thanks.

| *2/20/2018
| *Cleared Target after speaking with several NPCs so
| that you properly reacted to adds when navigating
| to the next destination
|
| *Elegist - now closing the extra dialog I missed.
|
| *Guard_Vyrinn - now getting both tasks at once.
|
| *Added a check to ensure you didn't have an add before
| attempting to loot items during the spider caves
|
| *Now verifies you are at least level 8 before trying to
| start Scout Zajeer mission. If you aren't will go about
| exping for you. (or trying lol)
|
| *Will now get tasks from Hobart on the way to Scout Zajeer
|
| *Correction to the group mana check sub. Should now properly
| verify group member (mercenaries) mana prior to pulling anything.
|
| *You will now sit when waiting on group members to get mana.
|
| *Navigating while using FarmStuff sub now checks for adds.
|
| *Will now get the quests from Guard Hobart before doing Scout Zajeer
|
| *Changed the name of "rat" to "a_cave_Rat" to avoid attacking Prathun
|
| *Added efficiency to mob hunting task in the way it decides what to kill
| Mostly helpful for bat/rat/nest quest because bats and rats are place
| holders for each other.
|
| *Changed the loot checking sub to now check all items after pulling to
| to avoid killing more than needed.
|
| *Added all friendly NPCs to ignore list....I think.
|
| *Will now check your subscription status and buy the highest level merc
| you can get for your sub.

Known issues.
The pit causes issues. Period. Specifically while hunting up top. I need a better spot to farm EXP from 5-8 or I need to edit the meshes again.
When you die it sucks. Some logic for death attempted. Doesn't always work correctly.
Bot keeps dying trying to do the last task in the list. It's annoying.

It's worth mentioning that | *Will now get tasks from Hobart on the way to Scout Zajeer *| change now reduces the time it takes to do the task because you kill a lot of those mobs while doing goblin slaves and Rookfyn.

| *2/23/2018
| *Started defining rooms based on your location in
| 3D space in the tutorial to keep track of where you
| are so that the macro can make informed decisions
| on where it should go.
|
| *Corrected the spelling for Subscription from Subsription
|
| *Change the targets for leveling up to 5 from "rat" and "bat"
| to "a_cave_rat" and "a_cave_bat"
|
| *Now casting the Worn Totem received from Basher Alga
|
| *Made corrections to the med routines.
|
| *Fixed targeting a random mob on the add check.
| It will now target your ${Me.XTarget[1].ID} instead
| of the first spawn returned in an area around you.
|
| *Added a check to avoid targets that already have
| an AggroHolder so you don't attack other players mobs.
|
| *Added in Group Task Arachnophobia once you reach level
| 4 which gets you the Helmet.
|
| *Now doing "Spider Caves" "Arachnida" and "Spider Tamer Gugan"
| at the same time.
|
| *Fixed targeting of adds. The check was invalid, it has been
| corrected and now attacks mobs that are on the mercenary
| instead of you.
|
| *Made a new mesh to improve reliability. Better far as
| I can tell.
|
| *

There were a lot more changes and a lot of time spent doing these changes. I simply failed to type in all the changes that were made. My bad :-(. At this point in the macro it takes a long time to do a run through. I typically have to make a change, camp, delete, respawn a toon, start the macro, get it to run all the way through to ensure the change flows well.

With that said. Gold accounts shouldn't have a lot of issues with this current setup. However, if your merc sucks you might find yourself faceplanting.

I know it says "tutoriala.zip" but it's actually both tutorial meshes and their .json files.
 

Attachments

  • tutorial.mac
    57.9 KB · Views: 36
  • tutoriala.zip
    3.2 MB · Views: 24
Last edited:
Update

| *2/20/2018
| *Cleared Target after speaking with several NPCs so
| that you properly reacted to adds when navigating
| to the next destination
|
| *Elegist - now closing the extra dialog I missed.
|
| *Guard_Vyrinn - now getting both tasks at once.
|
| *Added a check to ensure you didn't have an add before
| attempting to loot items during the spider caves
|
| *Now verifies you are at least level 8 before trying to
| start Scout Zajeer mission. If you aren't will go about
| exping for you. (or trying lol)
|
| *Will now get tasks from Hobart on the way to Scout Zajeer
|
| *Correction to the group mana check sub. Should now properly
| verify group member (mercenaries) mana prior to pulling anything.
|
| *You will now sit when waiting on group members to get mana.
|
| *Navigating while using FarmStuff sub now checks for adds.
|
| *Will now get the quests from Guard Hobart before doing Scout Zajeer
|
| *Changed the name of "rat" to "a_cave_Rat" to avoid attacking Prathun
|
| *Added efficiency to mob hunting task in the way it decides what to kill
| Mostly helpful for bat/rat/nest quest because bats and rats are place
| holders for each other.
|
| *Changed the loot checking sub to now check all items after pulling to
| to avoid killing more than needed.
|
| *Added all friendly NPCs to ignore list....I think.
|
| *Will now check your subscription status and buy the highest level merc
| you can get for your sub.

Known issues.
The pit causes issues. Period. Specifically while hunting up top. I need a better spot to farm EXP from 5-8 or I need to edit the meshes again.
When you die it sucks. Some logic for death attempted. Doesn't always work correctly.
Bot keeps dying trying to do the last task in the list. It's annoying.

It's worth mentioning that | *Will now get tasks from Hobart on the way to Scout Zajeer *| change now reduces the time it takes to do the task because you kill a lot of those mobs while doing goblin slaves and Rookfyn.
 
!remindme 1 day. I forgot about this when you were talking about it, but i made this and a generic fill in your own task macro awhile back. you just set the ini entries and it can do quests. i will see if i can dig it out. or its on the boards somewhere. i used tutorial as one of the examples.
 
!remindme 1 day. I forgot about this when you were talking about it, but i made this and a generic fill in your own task macro awhile back. you just set the ini entries and it can do quests. i will see if i can dig it out. or its on the boards somewhere. i used tutorial as one of the examples.


Its on the boards somewhere, I remember I helped you test it!
 
| *2/23/2018
| *Started defining rooms based on your location in
| 3D space in the tutorial to keep track of where you
| are so that the macro can make informed decisions
| on where it should go.
|
| *Corrected the spelling for Subscription from Subsription
|
| *Change the targets for leveling up to 5 from "rat" and "bat"
| to "a_cave_rat" and "a_cave_bat"
|
| *Now casting the Worn Totem received from Basher Alga
|
| *Made corrections to the med routines.
|
| *Fixed targeting a random mob on the add check.
| It will now target your ${Me.XTarget[1].ID} instead
| of the first spawn returned in an area around you.
|
| *Added a check to avoid targets that already have
| an AggroHolder so you don't attack other players mobs.
|
| *Added in Group Task Arachnophobia once you reach level
| 4 which gets you the Helmet.
|
| *Now doing "Spider Caves" "Arachnida" and "Spider Tamer Gugan"
| at the same time.
|
| *Fixed targeting of adds. The check was invalid, it has been
| corrected and now attacks mobs that are on the mercenary
| instead of you.
|
| *Made a new mesh to improve reliability. Better far as
| I can tell.
|
| *

There were a lot more changes and a lot of time spent doing these changes. I simply failed to type in all the changes that were made. My bad :-(. At this point in the macro it takes a long time to do a run through. I typically have to make a change, camp, delete, respawn a toon, start the macro, get it to run all the way through to ensure the change flows well.

With that said. Gold accounts shouldn't have a lot of issues with this current setup. However, if your merc sucks you might find yourself faceplanting.
 
I have been testing the macro on a Free account character. Made a mage, and ran into some of the issues you listed above, namely the death issues. When he loses the merc, he never seemed to revive it.

One thing that seemed to help was for me to load bot once it was available (actually I didn't do it until I was lvl 6, but that was because I was just letting it run)

Maybe a section to load bot once it can be done, then also some pet creation stuff.

Anyway, good stuff. Once I get a chance, I will try to read through the macro and see what all you have in there. Thanks again!
 
I ran the previous edition on gold, silver and bronze accounts. The gold account doesn't have any trouble keeping up and never died. There was -supposed- to be code to check the merc. However I haven't lost a merc since this last update. The macro will try to continue without the merc if it is down.

Code:
Sub WaitNav(NavTargetID)
	/while (${Spawn[id ${NavTargetID}].Distance} > 15) {
		/call CheckSwiftness
		/call WhereAmI
		/if (${Navigation.Active}) {
			/if (${Me.XTarget[1].ID}) {
				/if (${Navigation.Active}) /nav stop
				/varset TargetType npc
				/call FarmStuff
			} else {
				/call CheckMerc
			}

So in this snippet of code I'm saying if I'm trying to move from one location to another, I want to check to see if I can cast or already have swiftness buff from the clicky Basher Alga gives. Then I /call WhereAmI which is what sets ${myLocation} to a string based on some predefined 3D coordinate ranges.

Then if my navigation is active I want to check for an Add, if I don't have an add then I want to check that my merc is alive using the sub CheckMerc which is as follows.

Code:
Sub CheckMerc
	/if (${Mercenary.State.Equal[DEAD]}) {
		/if (${Group} && ${Window[MMGW_ManageWnd].Child[MMGW_SuspendButton].Tooltip.Equal[Revive your current mercenary.]} && ${Window[MMGW_ManageWnd].Child[MMGW_SuspendButton].Enabled}) /notify MMGW_ManageWnd MMGW_SuspendButton leftmouseup
	}
/return

Which says if my mercenary state is dead, and I'm in a group and my merc window shows the tooltip text "Revive your current mercenary." and the SuspendButton is Enabled (meaning I can click it) then click it.

Problems I've encounted in the tutorial using this method. Merc will spawn, but it will have 1% health. Making the group health check report someone is low on health and wait for the merc to heal. However, the problem is their health is -stuck- at 1% and never increases. For some reason this bug occurs. I cannot be certain what causes it and reloading the UI did not fix it. The merc needed to be hit in order for their hps to reflect correctly.

For the casting and such. Currently I've added no routines for casting at all with the exception of clicking the speed stick. There is a possibility I will add in casting routines for casting classes as well as a different mercenary for different classes, such as a tank for healers. As it stands this is all been testing using only a berserker (about 50 new character creations and deletions) just for the sake of ensuring that the routines for each quest is properly updating and getting through each step.

I had it doing the entire quest but I've now started added in the Optional quests at the bottom of the list. Which is causing some hanging near the end. IE: Busted Locks and Flutterwing's Dilemma. were recently added but are incomplete. I believe I have an issue getting from Flutterwing to Ruga, so I've added in a stop to Maddoc to get an additional quest there, then I am going to add in getting "Busted Locks" from Kaikachi. Which will let me go to the jail area and kill the locksmith followed by Ruga for the egg for Flutterwing's sibling.

Immediately following that it should return and do turn ins for them and then start off to kill Gnikan which is the classes weapon. Then I'll have to sort out a sub/method of switching weapons from your current weapon to the new weapon. Being that the weapon is never actually on your cursor it is something I may have to consider coding in per class. Whereas at the start I get a partial name from your currently equipped weapon and then look for an item with a similar name to know what to equip. It goes so fast you probably thought that when you turn in your starting weapon and get the slightly upgraded variant that it automatically went to your primary hand, which is not the case. Speaking of which, how is that setup working with a mage or any other class? Does it appear to be automatically upgrading the weapon during the first portion of the quest?

Come to think of it, once the Gnikan quest is complete and before you accept the quest I could just remove the item from your primary slot prior to accepting the weapon upgrade from the task to allow it to equip it, followed by auto inventorying the old weapon. Then I don't have to guess/figure it out.

Navigational issues are probably my biggest hurdle. Specifically when navigating in and out of area's with illusionary walls like the spider area's. But also, because the water tunnel exists when you try to navigate from the start area to area's near the Scouts or the jail it will try to go through the tunnel as that is technically the shortest path. However, it won't go all the way through and gets hung up at the end of the tunnel. So I'm forced to manually create a path to leave the start area to RatBat up hall2 to ratbat2 into hall3 to PitTop, then issue the command to go toward the scouts. Otherwise they will get hung up.

I haven't finished mapping the zone and assigning area's string names for the intelligent path choosing options per quest to be fully implemented. For my trouble area's I have added in checks for the spider caves to check that ${myLocation.Equal[Spider1]} to be true while doing spider quests. If not /call GotoSpiders to navigate into the spider cave. But I can issue that from the start area, so in a way it's "Checking for death".

Navigation does a /call GroupDeathChk. Which has

Code:
/while (${Me.STATE.Equal[DEAD]} ) {
			/delay 10
			/call AmIDead
		}

So if you're dead it sticks you in a loop. Previously this was used in Pull.mac where if you were dead you just waited until you weren't anymore. I've since added a check

Code:
Sub AmIDead
	/if (!${Me.PctHPs} && ${Window[RespawnWnd].Child[RW_OptionsList].List[1,2].Equal[Bind Location]}) {
		/notify RespawnWnd RW_OptionsList listselect 1
		/notify RespawnWnd RW_SelectButton leftmouseup
		/delay 5s ${Me.X}==-152&&${Me.Y}==-31
		/call TutorialCheck "The Gloomingdeep Revolt"
		/if (${Macro.Return.Equal[TRUE]}) {
			/declare i int local
			/declare step int local
			/for i 1 to 12
			/if (!${Window[TaskWND].Child[Task_TaskElementList].List[${i},2].Equal[Done]}) {
				/varset step ${i}
				/break
			}
			/next i
			/if (${Select[${Step},7,8,9]}) {
				/call NavToLoc -527 -582 -2
			}
		}
	}
/return

Where it checks each step of the quest and depending on what step in the task you're in on what it does. I haven't died at every step to know what every step should do on death. So this is a work in progress and currently only reacts to steps 7 8 and 9. However, I'm painfully aware that other steps need implementation. Additionally, in it's current state the GroupHealthChk will incorrectly report that you or a group member are low on health when you/them are actually dead, which will cause it to never reach this point. I need to add another TLO check for the toon or mercenary in question to not be dead so that it will make it to the death check instead of getting hung up at the health or mana check.

Another issue is when doing "Lurkers" in the spider caves, sometimes it tries to path into the Queen's section past the web. I need to create a sub that verifies that my target is in the same defined room as myself and then navigate into that room for situations like that. Handling these illusionary walls has been a challenge.

These are all things that I'm tracking that need to be done. Just a matter of getting it all implemented and tested.

The hope is that I can get this setup for use with any class with any subscription level.
 
No problem, I was just running it in another window while I am doing other things. I figured if I can report things to you, that should help a little bit. I am a programmer myself, so I understand what you are trying to accomplish. I just haven't had much free time to look through the code.

Another issue I am seeing is pathing problems when I am in the pit, and trying to path to Flutterwing. It keeps trying to go through a wall, and can't get to Flutterwing. I ran him up to the top and then restarted, and he then found his way back.

Also, while running to Ruga, he doesn't do a health check, so by the time I get to Ruga, I was at 50%, so then got killed.

I also killed the locksmith while on the way to Ruga, but didn't auto loot the key. I manually looted the key, which updated the task though.
 
No problem, I was just running it in another window while I am doing other things. I figured if I can report things to you, that should help a little bit. I am a programmer myself, so I understand what you are trying to accomplish. I just haven't had much free time to look through the code.

Another issue I am seeing is pathing problems when I am in the pit, and trying to path to Flutterwing. It keeps trying to go through a wall, and can't get to Flutterwing. I ran him up to the top and then restarted, and he then found his way back.

Also, while running to Ruga, he doesn't do a health check, so by the time I get to Ruga, I was at 50%, so then got killed.

I also killed the locksmith while on the way to Ruga, but didn't auto loot the key. I manually looted the key, which updated the task though.

Yeah I was still working on that bit and hadn't included any code for finding and killing the locksmith yet, that occured by happenstance.

Currently I only have the code to get the task, not to go do it.

Code:
Sub Scout_KaikachiB
	/call TutorialCheck "The Revolt of Gloomingdeep"
	/if (!${Window[TaskWND].Child[Task_TaskElementList].List[18,2].Equal[Done]}) {
		/call TutorialCheck "Busted Locks"
		/if (!${Macro.Return.Equal[TRUE]}) {
			/call WaitNav ${Spawn[Kaikachi].ID}
			/call AcceptTask
			/squelch /target clear
		}
	}
/return

I plan to change the location for the NavToLoc for Ruga to something near him instead of on top of him. The health checks are done when FarmStuff is called irrc and it should see that your health is jacked prior to engaging, but since I set the nav location to right on top of him it didn't do that. What I should actually be doing is getting him to the entrance of the jail and calling for the locksmith kill then follow it up with a call to kill Ruga.

Code:
Sub FarmStuff(string Enemy)
	/if (${Bool[${Enemy}]}) {
		/varset FarmMob ${Enemy}
		/if (${Debugging} && !${reportTarget}) {
			/echo Looking for: ${FarmMob}
			/varset reportTarget ${reportTarget.OriginalValue}
		}
	} else {
		/echo Attacking anything I can get my grubby paws on.
	}
	:findMob
	/if (${Target.Type.Equal[corpse]}) /squelch /target clear
	/if (${Window[RespawnWnd].Open}) /call GroupDeathChk
	/if (!${Me.XTarget[1].ID} || ${Window[RespawnWnd].Open}) {
		/call GroupDeathChk
		/call GroupHealthChk
		/call GroupManaChk
	}

Is the location for the health checks, which it only does if you don't have an XTarget and you're not dead waiting on a rez.

I suppose I could include them into the navigation loops as well so that health checks are done prior to movement in all cases instead of just when calling for combat. My logic for not doing it in the first place was I could still run around without health. But in hindsight I see that it makes more sense to always check your health, both when searching for something to fight and when navigating.

Pending verification you could swap out some sub with the update now.

Code:
Sub WaitNav(NavTargetID)
	/while (${Spawn[id ${NavTargetID}].Distance} > 15) {
		/call CheckSwiftness
		/call WhereAmI
		/if (${Navigation.Active}) {
			/if (${Me.XTarget[1].ID}) {
				/if (${Navigation.Active}) /nav stop
				/varset TargetType npc
				/call FarmStuff
			} else {
				/call GroupDeathChk
				/call GroupHealthChk
				/call GroupManaChk
				/call CheckMerc
			}
			/if (${Me.Combat} && !${Me.XTarget[1].ID}) /squelch /target clear
			/delay 10
		} else {
			/if (${Me.XTarget[1].ID}) {
				/if (${Navigation.Active}) /nav stop
				/target id ${Me.XTarget[1].ID}
				/varset TargetType npc
				/call FarmStuff
			} else {
				/call GroupDeathChk
				/call GroupHealthChk
				/call GroupManaChk
				/call CheckMerc
			}
			/if (${Me.Combat} && !${Me.XTarget[1].ID}) /squelch /target clear
			/nav id ${NavTargetID}
		}
	}
	/if (${Navigation.Active}) /nav stop
	:target
	/target id ${NavTargetID}
	/delay 2s ${Target.CleanName.Equal[${Spawn[id ${NavTargetID}].CleanName}]}
	/if (!${Target.CleanName.Equal[${Spawn[id ${NavTargetID}].CleanName}]}) {
		/goto :target
	}
	/keypress H
/return

Code:
Sub NavToLoc(int Y,int X,int Z)
	/while (${Math.Distance[${Me.Y}, ${Me.X}, ${Me.Z}: ${Y}, ${X}, ${Z}]} > 15) {
		/call CheckSwiftness
		/call WhereAmI
		/if (${Navigation.Active}) {
			/if (${Me.XTarget[1].ID}) {
				/if (${Navigation.Active}) /nav stop
				/varset TargetType npc
				/call FarmStuff
			} else {
				/call GroupDeathChk
				/call GroupHealthChk
				/call GroupManaChk
				/call CheckMerc
			}
			/if (${Me.Combat} && !${Me.XTarget[1].ID}) /squelch /target clear
			/delay 10
		} else {
			/if (${Me.XTarget[1].ID}) {
				/if (${Navigation.Active}) /nav stop
				/varset TargetType npc
				/call FarmStuff
			} else {
				/call GroupDeathChk
				/call GroupHealthChk
				/call GroupManaChk
				/call CheckMerc
			}
			/if (${Me.Combat} && !${Me.XTarget[1].ID}) /squelch /target clear
			/nav loc ${Y} ${X} ${Z}
		}
	}
	/if (${Navigation.Active}) /nav stop
/return


Code:
Sub CheckMerc
	/if (${Mercenary.State.Equal[DEAD]}) {
		/echo Your mercenary has died. Waiting to be able to revive them. 
		:waitForMerc
		/if (${Group} && ${Window[MMGW_ManageWnd].Child[MMGW_SuspendButton].Tooltip.Equal[Revive your current mercenary.]} && ${Window[MMGW_ManageWnd].Child[MMGW_SuspendButton].Enabled}) /notify MMGW_ManageWnd MMGW_SuspendButton leftmouseup
		/if (${Mercenary.State.Equal[DEAD]} && !${Me.XTarget[1].ID}) /goto :waitForMerc
	}
/return
 
Last edited:
On the Ruga pathing, I noticed I ran a straight line through the center, which aggroed a lot of the mobs in the center. Maybe run around the side areas instead.. Been too long since I did the missions for real, so I can't remember how I approached it.
 
On the Ruga pathing, I noticed I ran a straight line through the center, which aggroed a lot of the mobs in the center. Maybe run around the side areas instead.. Been too long since I did the missions for real, so I can't remember how I approached it.

I could edit the mesh again to say the middle is water so he'll avoid the center lol. Easiest fix I can think of.

But again this falls to using my mesh over a personal one, which is the case for some things in this tutorial.mac anyway. I couldn't help but notice that the downloads for the mesh are not the same as the downloads for the macro. /sigh. I guess people are under the impression that I didn't do anything but hit build.