Need help making archery shooting macro.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

Need help making archery shooting macro.

Post by skysurf » Mon Jan 12, 2004 11:59 am

I basically just want a macro that I can make a hotkey for that presses my hotkey for ranged attack as soon as it comes up and then when $target goes NULL have it call endmacro.

This is what I got, and the timing on the archery hotkey is a bit slow sometimes, and the /endmacro isnt working when target goes NULL.



Sub main
:Loop
/press 2

/if #target==NULL /call Mac_end
/goto :Loop
/return


Sub Mac_end
/endmacro
/return


Thanks in advance :)

Sky

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Jan 12, 2004 12:12 pm

Try this, it should do what you were looking for.

Code: Select all

#turbo 30

Sub main 
/declare ArcheryDelay timer
:MainLoop
/press 2 
| This is set for 3 seconds, replace this with how long the refresh actually is on your ranged attack. 
/varset ArcheryDelay 3s
:WaitLoop
/delay 1
/if $target()==FALSE /call Mac_end 
| Added in doevents simply because if you ever choose to use events you'd probably forget and tear your hair out  :)
/doevents
/if n @ArcheryDelay>0 /goto :WaitLoop
/goto :MainLoop 
/return 

Sub Mac_end 
/endmacro 
/return

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

Post by skysurf » Mon Jan 12, 2004 12:23 pm

Well, you answered my question as to how to end the macro when target went null, but im still curious if there is a built in thingy(dont know what to call it) in MQ that tells you when an ability is ready to use?

Sky

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Jan 12, 2004 12:33 pm

I don't think there is one for the ranged attack button.

Brambo
orc pawn
orc pawn
Posts: 19
Joined: Thu Dec 18, 2003 4:08 am

Post by Brambo » Mon Jan 12, 2004 7:28 pm

Playing a ranger myself I've made this macro for Auto Archery. My ranged attack was on hotbutton two as well, but numpad 0 also pushes hotbutton 2, this makes it such that you can still type while autoshooting and not get strings of 2222s in your text:

Code: Select all

#turbo

Sub Main

   /echo Autofire ON
   :Loop
      /if $target(type)==NPC {
         /if $char(casting)==FALSE {
            /press Num_0
            /delay 1
         }
         /goto :Loop
      } else {
         /echo No NPC targeted
      }
      /echo Autofire OFF
/return
The macro stops if your target is no longer an NPC, so you can hit escape to stop it.. or target a player for buff or heal easily.

After using it for a few weeks I wanted to have a macro that I would start when I logged on and that would be perma running. Events set an autoarchery toggle, so in order to turn it on or off you make a hotbutton with "/echo Auto-Archery". Code for this last macro looks like:

Code: Select all

#turbo

#event eToggleArchery "Auto-Archery"

Sub Main

/declare vArcheryToggle global

/varset vArcheryToggle "FALSE"

/echo Ranger Assistant Started

:MainLoop
   /if "@vArcheryToggle"=="TRUE" {
      /if $target(type)==NPC {
         /if $char(casting)==FALSE {
            /press Num_0
            /delay 1
         }
      } else {
         | /varset vArcheryToggle "FALSE"
         /echo Auto-Archery
      }
   }
   /doevents
/goto :MainLoop

/return

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Sub Event_eToggleArchery

/if "@vArcheryToggle"!="TRUE" {
   /varset vArcheryToggle "TRUE"
   /echo ON
} else {
   /varset vArcheryToggle "FALSE"
   /echo OFF
}

/return | Event_eToggleArchery