avatar weapons

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

koad
Plugins Czar
Posts: 127
Joined: Fri May 16, 2003 8:32 pm

avatar weapons

Post by koad » Thu Dec 04, 2003 6:04 am

a few people who toss me ideas bugged me for an avatar weapon script, so i thought i'd share it here. macro is designed to me modular, if you #include kavatar.mac in your existing macro, and as long as you have /doevents checking in your melee loop, weapon will get switched.
this changes to avatar only after you lose avatar so until you put on avatar weapon for the first time, it doesnt do anything, since the event needs to trigger. theres some buff redundancy checking, to avoid the macro switching unnecessarily from bad triggers (player text 'the avatar departs?! :(' of melee bitching, etc) this method also avoids pressing escape, so you dont lose target/dps as part of weapon swtiching

please note this method avoids bag lag by assuming and replacing your weapons in a base inventory slot

Code: Select all

|kavatar.mac -- koad
|avatar switching/events
|edit defines for your weapons

#define AVATARWEAPON "Ancient Prismatic Warsword"
#define NORMALWEAPON "Blade of Strategy"
| primary  or  secondary
#define WEAPONSLOT   secondary

#event avatarfade "The Avatar departs."
#event avatarproc "Your body screams with the power of an Avatar."

sub Event_avatarfade
  /if n $char(buff,"Avatar")==0 /call equipavatar
/return

sub Event_avatarproc
  /if n $char(buff,"Avatar")>0 /call equipnormal
/return

sub equipavatar
  /press i
  /finditem "AVATARWEAPON"
  /delay 2
  /click left WEAPONSLOT
  /autoinv
  /press i
/return

sub equipnormal
  /press i
  /finditem "NORMALWEAPON"
  /delay 2
  /click left WEAPONSLOT
  /autoinv
  /press i
/return

or if you want, you can add this code and this macro will stand alone and switch weapons for you. this is setup to put on primal if you dont have avatar to start

Code: Select all

sub main
  /if n $char(buff,"Avatar")==0 /call equipavatar
  :main
  /doevents
  /delay 1
  /goto :main
/return

morannon
a lesser mummy
a lesser mummy
Posts: 57
Joined: Sun Nov 03, 2002 3:50 pm

Post by morannon » Thu Dec 04, 2003 7:00 pm

Given that you can find buff remaining duration, how about having it swap automatically with say 1min left on avatar ?

morannon
a lesser mummy
a lesser mummy
Posts: 57
Joined: Sun Nov 03, 2002 3:50 pm

Post by morannon » Thu Dec 04, 2003 7:02 pm

EDIT : Ack dupe

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

Post by ml2517 » Sat Dec 06, 2003 1:47 am

Messed around with this some. I have it so that it will auto-cleanup if you left bags etc open. If you currently have a target it will remember it and resume targeting after cleanup.

This will ensure that your primal gets swapped in if you don't currently have avatar or your avatar has 60 seconds or less left on the effect.

Once your avatar effect has longer than 60 seconds it should swap back to your normal weapon.

As was stated in the previous posts makes sure to set the proper weapon names and which weapon slot you want to swap into. Feel free to make it modular like Koad had it originally.

Thanks for the original script Koad :D

:Edit: Fixed a few problems. :?

Code: Select all

|kavatar.mac -- koad 
|avatar switching/events 
|edit defines for your weapons 

#define AVATARWEAPON "Primal Velium Spear" 
#define NORMALWEAPON "Ancient Burrower Spine" 
| primary  or  secondary 
#define WEAPONSLOT   primary 
#turbo 30

sub Main 
  :Mainloop
   /if n $char(buff,"Avatar")==0 {
       /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" /call equipavatar        
   }
   /if n $char(buff,$char(buff,"Avatar"),duration)<=10 {
       /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" /call equipavatar
   }
   /if n $char(buff,"Avatar")!=0 /if n $char(buff,$char(buff,"Avatar"),duration)>10 /if "$equip(WEAPONSLOT,name)"!="NORMALWEAPON" /call equipnormal
  /doevents 
  /delay 1s 
  /goto :Mainloop
/return

sub equipavatar 
  /echo Swapping to get Avatar Proc!
  /autoinv 
  /press i
  /delay 2
  /finditem "AVATARWEAPON" 
  /delay 2 
  /click left WEAPONSLOT 
  /autoinv 
  /press i
  /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" {
     /declare CurrMobID local
     /varset CurrMobID $target(id)
     /cleanup
     /if n @CurrMobID!=0 /target id @CurrMobID
  }
/return 

sub equipnormal 
  /echo Switching back to normal weapon.
  /autoinv 
  /press i
  /delay 2
  /finditem "NORMALWEAPON" 
  /delay 2 
  /click left WEAPONSLOT 
  /autoinv 
  /press i
  /if "$equip(WEAPONSLOT,name)"!="NORMALWEAPON" {
     /declare CurrMobID local
     /varset CurrMobID $target(id)
     /cleanup
     /if n @CurrMobID!=0 /target id @CurrMobID
  }
/return

zerocool2024
decaying skeleton
decaying skeleton
Posts: 1
Joined: Thu Dec 25, 2003 11:15 pm

Question

Post by zerocool2024 » Thu Dec 25, 2003 11:18 pm

How come everytime I go to use the macro it says
Ending macro: Subroutine main wasn't found
Cleared the following: timers Vars Arrays
The current macro has ended

This is my script

|kavatar.mac -- koad
|avatar switching/events
|edit defines for your weapons

#define AVATARWEAPON "Ancient Prismatic Warsword"
#define NORMALWEAPON "Ragebringer"

#define WEAPONSLOT "secondary"

#event avatarfade "The Avatar departs."
#event avatarproc "Your body screams with the power of an Avatar."

sub Event_avatarfade
/if n $char(buff,"Avatar")==0 /call equipavatar
/return

sub Event_avatarproc
/if n $char(buff,"Avatar")>0 /call equipnormal
/return

sub equipavatar
/press i
/finditem "AVATARWEAPON"
/delay 2
/click left WEAPONSLOT
/autoinv
/press i
/return

sub equipnormal
/press i
/finditem "NORMALWEAPON"
/delay 2
/click left WEAPONSLOT
/autoinv
/press i
/return

Could you tell me whats wrong with it?

battaile
Contributing Member
Contributing Member
Posts: 40
Joined: Tue Dec 09, 2003 10:55 am

Post by battaile » Thu Dec 25, 2003 11:53 pm

To run it like you have it , it needs to be included in another mac (like in original post). Then, as long as the mac you're including from has /doevents somewhere, it'll call the proc and fade events.

If you want to run it standalone, which it sounds like youre trying to do, use ml's script in this thread, which includes a sub Main. :)