Lazy faction

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

aamlord
a lesser mummy
a lesser mummy
Posts: 35
Joined: Wed Feb 07, 2007 3:56 pm

Lazy faction

Post by aamlord » Tue Feb 27, 2007 6:20 pm

I needed a quick way to raise faction with Brood of Di'Zok and one way is to kill goblins in frontier mountain. But rather than to keep running around and sending pet off I wrote this little bit to handle it:

Code: Select all

sub Main
   /if (${GameState.Equal[CHARSELECT]}) /endmacro
     :Loop
         /call CheckForPCs
         /keypress F8
         /if (${Target.ID}) {
             /pet attack
             /delay 500000000000m !${Target.ID}
           } 
      /goto :Loop
/return

Sub CheckForPCs
   /if (${Spawn[gm].ID}) {
      /echo SHIT!!  GM in Zone!
      /popup GM!! GM!! GM!!
      /call DummyMode
   }
   /if (${SpawnCount[pc radius 150 loc -140 640]}>1) {
   |/if (${SpawnCount[pc]} > 1) {
      /echo PC nearby!
      /call DummyMode
   }
/return

Sub DummyMode
   /echo Entering Dummy Mode...
   /delay 1s
   :waitabit
      /delay 15m
      /if (${Spawn[gm].ID} || (${SpawnCount[pc radius 150 loc -140 640]}>1)) /goto :waitabit
   /delay 1s
/return
PC and GM detection was ripped from another script (Kaladim mushroom harvesting script I think) but the main part is my original.

What it does is spam F8 key to grab nearby target and when something shows up, sends pet to attack then pause for 10 seconds so I don't get spammed with pet attacking message. Once the 10 seconds is up, it repeats.

I choose to spam keypress F8 rather than targeting by name is so the pet would stay close by and not end up halfway across the zone.

It's probably best used in zones where you are in no danger of getting killed since there's nothing for self healing or gating if the player's health drops too low. Frontier mountain is fairly low level for my main 70 Beast and short of delibrate train it's next to impossible for me to get killed there.

Yeah this script could be viewed as afk use but as written, it's not much use in higher level zones and simply gets me the needed faction a little sooner than mashing my keyboard (and getting carpel tunnel syndrome in the process)

EDIT: replaced delay 10s with delay or when target clears, use instead of the if-then loop I posted below.
Last edited by aamlord on Tue Feb 27, 2007 9:00 pm, edited 1 time in total.

aamlord
a lesser mummy
a lesser mummy
Posts: 35
Joined: Wed Feb 07, 2007 3:56 pm

Post by aamlord » Tue Feb 27, 2007 6:40 pm

Right after I posted the above code, I changed to remove the 10 sec delay and just wait until current target cleared before getting new one and sending pet off. Replace the line /delay 10s with:

Code: Select all

          :Stillhastarget
             /if (${Target.ID}) /goto :Stillhastarget
Causes the script to loop itself until target is cleared or dead then resume looking for another visible target.

DO remember to turn the macro off when you're done. Wouldn't want to gate or port into your hometown and have your pet run off attacking npc's.

Maybe something to auto /endmacro when you zone for the absent minded players? :)

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Tue Feb 27, 2007 7:47 pm

aamlord wrote:Right after I posted the above code, I changed to remove the 10 sec delay and just wait until current target cleared before getting new one and sending pet off. Replace the line /delay 10s with:

Code: Select all

          :Stillhastarget
             /if (${Target.ID}) /goto :Stillhastarget
Causes the script to loop itself until target is cleared or dead then resume looking for another visible target.

DO remember to turn the macro off when you're done. Wouldn't want to gate or port into your hometown and have your pet run off attacking npc's.

Maybe something to auto /endmacro when you zone for the absent minded players? :)
that is the worst possible way to do a delay, your computer sits there processing those three lines over and over and over and over and over and over an infinite amount of time all while crushing your processor.

A better way to do this is to use a conditional delay.

Code: Select all

/delay 500000000000m !${Target.ID}
This single line delays for 500000000000m OR until I no longer have a Target, but at least it allows for the macro to continue at some point.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

aamlord
a lesser mummy
a lesser mummy
Posts: 35
Joined: Wed Feb 07, 2007 3:56 pm

Post by aamlord » Tue Feb 27, 2007 8:59 pm

Thanks for the tip. The revised code works.

I haven't done any programming that involved if-then statement since when Commodore 64 was the king and BASIC was very common language for most people.

Yes I am old. Old enough to remember when punch cards were used and when my school also taught PILOT and COBOL.