advchant.mac - Advanced Chant REV7

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

Moderator: MacroQuest Developers

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

WOW

Post by Mutter » Sat Feb 21, 2004 9:10 pm

Amazing code, Have made 3 levels from the time it started.
Only 2 problems.
1: No intelligence in pulling! IE: It charged into a pack of like 8 shadowed men with my poor lil level 30(somethin) bard and tried to smack one. Needless to say his friends were pissed!
2. Getting stuck! OMG this is a pain, I already have this fixed, will post ASAP!!

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

OK OK here it is

Post by Mutter » Sat Feb 21, 2004 9:53 pm

Ok guys PLEASE don't flame me for the unused variables, I KNOW, and I AM working on cleaning up the code.

Ok what's changed:
1. No longer gets stuck (unless we kite inside a building..havent figured solution to that yet.

2. CHECKS for friends!! IE wont grab an orc that has 4 or more friends next to him.. ie no trains, no dead bard.

Have been running this awhile, works great, HUGE credit to Raebis for doing such AMAZING code!!!!

Code: Select all

| advchant.mac - By Raebis
| Version: REV7 Released Feb 18 2004 23:15
|
| This mac is used mostly for big open zones with not a lot of
| big hills (cause hills cause pain - unless you have levitate)
|
| Features:------------------------------------------------------------------------
|
| * Automatically selects high light blue, dark blue, or white mob
| * Runs to mob before targeting it (Stealth! No cross-zone targeting!)
| * Aggro/Add Detection: Automatically targets and kites aggroed mobs (adds)
| * Ignores greens and low light blues unless they are aggroed (adds)
| * Caster Detection: Automatically will switch target to aggroed casting mobs
| * Compatible with level 49 and level 5 selos
| * Auto Healing: If health gets low, it will automatically heal
| * Fleeing Mob Catcher: If mob runs away, macro keeps you in range!
| * Detects WMS (Warping Mob Syndrom) and gets a new target if a mob warps away!
| * Rubber Anchor: kites mobs closest to macro starting point - no wandering!
| * NEW: Exclude List: Won't attack mobs that you have /add'ed to this list!
|
| ---------------------------------------------------------------------------------
|
|/echo usage: /mac advchant.mac <DOTs> <Selos> <heal song> <radius>
|
| usage examples:
|
| If you are using...
|  ...Level 5 selos in slot 8
|  ...DD Songs in slots 1 and 3
|  ...Levitate in slot 2
|  ...Hymn of Restoration in slot 4
|  ...Radius of 50
| Then use the syntax:
|  /mac advchant 132 8 4 50
|
| If you are using...
|  ...Level 49 selos in slot 1
|  ...DOT Songs in slots 3,4,5, and 6
|  ...Hymn of Restoration in slot 7
|  ...Radius of 100
| Then use the syntax:
|  /mac advchant 3456 1 7 100
|
| ---------------------------------------------------------------------------------
|
| Notes on Exclude List:
|     The exclude list is a ini-driven list of mobs that this macro will not
|     target for kiting. You can add and remove mobs from this list on-the-fly
|     with the following commands.
|
|     /add giant
|      -This command will tell the macro not to target anything with the word
|       giant in its name.
|
|     /del giant
|      -This is the opposite of the previous command
|
|     /exlist
|      -This command will list the words that the macro uses for excluding targets
|
|     In the exlist you will see an item "(0-100) any advchant.mac" and this is
|     normal. If adding a exclusion with more than one word you must use quotes
|     around the name i.e. /add "a large trout"
|
| Notes on HealSong:
|     The healsong will play when your heath goes below @HealthMin (default 75)
|     and will continue twisting the healsong in until your health is at or above
|     @HealthMax (default 85). When this is activated, it will twist the healsong
|     instead of the firstsong in <DOTs>. Do not put any important song as the
|     first number in this argument (i.e. levitate).
|
| Warning:
|     You may wander from your starting point but after killing a mob, the next mob
|     that the macro targets will be closest to your starting point (Rubber Anchor)
|
| ---------------------------------------------------------------------------------
|
| advchant.mac REV6 was tested in EW with both level 49 and level 5 selos for about
| an hour without problems. Exclusion list worked fine.
|


#event Exp        "You gain "
#event Died       "You have entered"
#event Caster     " begins to cast a spell."

#turbo

Sub Main(DOTs,Selos,Health,CRadius)
   /echo usage: /mac advchant.mac <DOTs> <Selos> <heal song> <radius>
   /zapvars

   /if $defined(CRadius)==false {
      /echo usage: chant.mac <DOTs> <Selos> <heal song> <radius>
      /return
   }

   /declare CirR global

   /declare Songs array
   /declare nSongs global
   /declare CurSong global
   /declare PrevSong global
   /declare MyXLOC global
   /declare MyYLOC global
   /declare Exper global
   /declare AAExp global
   /declare RunTime global

   /declare SongTimer timer
   /declare SeloSong global
   /declare SeloTicks global
   /declare NoRewind global
   /declare ObstCount global
   /declare HealSong global
   /declare OrigSong global

   /declare HealthMin global
   /declare HealthMax global

   /declare DBLevel global
   /declare MinLevel global
   /declare MaxLevel global
   /declare GettingTarget global

   /declare TargetUpNext global

   /declare RubberX global
   /declare RubberY global

   /declare EachSong local
   /declare AlertList global

   /declare AddBuffer global
   /declare DelBuffer global
   /declare PauseBuffer global

   /declare startlevel global
   /declare endlevel global

   /varset AddBuffer waiting
   /varset DelBuffer waiting

   /varset AlertList 10

   /varset Exper $char(exp)
   /varset AAExp $char(aa,exp)
   /varset RunTime 1

   /varset MinLevel $calc($char(level)-5)
   /varset MaxLevel $calc($char(level)+2)

   /varset HealthMin 70
   /varset HealthMax 85

   /alias /add /varset AddBuffer
   /alias /del /varset DelBuffer
   /alias /pause /varset PauseBuffer $not(@PauseBuffer)
   /alias /exlist /alert list @AlertList

   /call LoadExcludes

   /varset nSongs $strlen(@DOTs)
   /for EachSong 1 to @nSongs
      /varset Songs(@EachSong) $mid($calc(@EachSong-1),1,@DOTs)
      /echo Song @EachSong: $char(gem,@Songs(@EachSong))
   /next EachSong

   /if n @Selos!=0 {
      /varset SeloSong @Selos
      /echo Selo's: $char(gem,@SeloSong)
   } else {
      /varset SeloSong 0
      /echo Not using Selos.
   }

   /varset SeloTicks 0
   /if $char(level)>=49 /varset SeloTicks 2
   /varset HealSong @Health
   /echo Healsong: $char(gem,@HealSong)

   /varset CirR @CRadius
   /echo Radius: @CRadius

   /varset PauseBuffer 0

   /varset OrigSong @Songs(1)
   /varset CurSong 1

   /varset TargetUpNext 0

   /varset RubberX $char(x)
   /varset RubberY $char(y)

   /echo Rubber Anchor dropped at @RubberX,@RubberY

   /call Event_Timer SongTimer

   :Loop

   /if "@AddBuffer"!="waiting" {
      /call AddExclude "@AddBuffer"
      /varset AddBuffer waiting
   }

   /if "@DelBuffer"!="waiting" {
      /call DelExclude "@DelBuffer"
      /varset DelBuffer waiting
   }

   /if n @PauseBuffer==-1 {
      /echo Paused...
      :PauseLoop
      /if n @PauseBuffer==0 /goto :DonePause
      /if "@AddBuffer"!="waiting" {
         /call AddExclude "@AddBuffer"
         /varset AddBuffer waiting
      }

      /if "@DelBuffer"!="waiting" {
         /call DelExclude "@DelBuffer"
         /varset DelBuffer waiting
      }
      /varset SongTimer 30
      /doevents
      /goto :PauseLoop
      :DonePause
      /echo Continuing...
      /varset TargetUpNext 0
   }

   /if n $char(hp,pct)>HealthMax {
        /if n @TargetUpNext==0 /if n $target(id)==0 {
                /doevents Event_Exp
                /call gettarget
        }
        /if n @TargetUpNext!=0 /if n $target(id)!=0 {
                /echo User Selected Target or Aggroed while running
                /varset TargetUpNext 0
        }

        /if n @TargetUpNext==0 /if $target(type)!=NPC /call gettarget
           /if n $target(distance)>1000 /if n $target(hp,pct)<=50 {
                /cleanup
                /echo Target Warped... Getting a new target
                /call GetTarget
        }
   }
   /if n @HealSong!=0 /if n $char(hp,pct)<@HealthMin {
      /if n @Songs(1)!=@HealSong {
         /echo Healing On - Health: $char(hp,pct)% to @HealthMax%
         /varset Songs(1) @HealSong
         /call Event_Timer SongTimer
      }
   }

   /if n @HealSong!=0 /if n $char(hp,pct)>=@HealthMax {
      /if n @Songs(1)!=@OrigSong {
         /echo Healing Off
         /varset Songs(1) @OrigSong
      }
   }

   /if $char(casting)==FALSE /if n @SongTimer>0 /if n @SongTimer<28 {
      /if n @NoRewind==0 /varset CurSong @PrevSong
      /varset NoRewind 0
      /call Event_Timer SongTimer
   }

   /if @SeloSong!=0 /if $char(buff,"$char(gem,@SeloSong)")==0 /if n @NoRewind==0 /call Event_Timer SongTimer

   /call Circ
   /doevents
   /delay 0
   /goto :Loop
/return

Sub Event_Timer(TimerName)
   /if @TimerName==SongTimer {
      /stopsong
      /call Circ
      /delay 1
      /call Circ
      /delay 1
      /if n @SeloSong!=0 {
         /if $char(buff,"$char(gem,@SeloSong)")==0 {
            /cast @SeloSong
            /varset NoRewind -1
            /varset SongTimer 31
            /return
         }

         /if $char(buff,$char(buff,"$char(gem,@SeloSong)"),duration)<=@SeloTicks {
            /cast @SeloSong
            /varset NoRewind -1
            /varset SongTimer 31
            /return
         }

      }
      /if $target()==FALSE /if $spell("$char(gem,@CurSong)",spelltype)==Detrimental /varset NoRewind -1
      /if n @NoRewind==0 /if $char(state)==STAND /cast @Songs(@CurSong)
      /varset PrevSong @CurSong
      /varset SongTimer 31
      /varadd CurSong 1
      /if n @CurSong>@nSongs /varset CurSong 1
      /call Circ
      /if n @HealSong!=0 /if n $char(hp,pct)<=@HealthMax /cast @HealSong
   }
   /call CheckObst
/return

Sub Circ
   /declare CirX local
   /declare CirY local

   /if n @TargetUpNext!=0 {

      /varset CirX $spawn(@TargetUpNext,y)
      /varset CirY $spawn(@TargetUpNext,x)

      /if n $spawn(@TargetUpNext,distance)<=$calc(@CirR*2) {
         /varset TargetUpNext 0
         /target id @TargetUpNext
      }
   }

   /if n $target(id)!=0  {
      /varset CirX $target(y)
      /varset CirY $target(x)
   }

   /if n $distance(@CirX,@CirY)<$calc(@CirR/2) {
      /face heading $calc($heading(@CirX,@CirY)+180)
   } else {
      /face heading $calc($heading(@CirX,@CirY)+$calc(90*$calc(@CirR/$distance(@CirX,@CirY))))
   }
/return

Sub Event_Died
   /delay 10
   /sit
   /delay 10
   /camp desktop
/return

Sub Event_Exp

   /varset AAExp $calc($char(aa,exp)-@AAExp)
   /varset Exper $calc($char(exp)-@Exper)

   /if n @Exper>0 {
      /declare EXKills local
      /varset EXKills $calc($calc(100-$char(exp))/@Exper)
      /echo Exp Gain: @Exper Total: $char(exp) Kills: @EXKills
   }

   /if n @AAExp>0 {
      /declare AAKills local
      /varset AAKills $calc($calc(100-$char(aa,exp))/@AAExp)
      /echo AA  Gain: @AAExp Total: $char(aa,exp) Kills: @AAKills
   }

   /varset RunTime $running
   /varset Exper $char(exp)
   /varset AAExp $char(aa,exp)

   /varset MinLevel $calc($char(level)-5)
   /varset MaxLevel $calc($char(level)+2)
/return

Sub GetTarget
   /call getstart
   :Acquire
   /if n @GettingTarget==-1 /return
   /if n $char(hp,pct)<@HealthMax /return
   /varset GettingTarget -1
   /declare MobID local
   /declare SRadius local
   /varset MobID $searchspawn(npc,radius:$calc(@CirR*2))
        /call SpawnHasFriends $spawn(@MobID)
        |check if there is a group of them, if so lets avoid!!!        
        /if n $return=>4 {
        	/echo $spawn(name,clean) has $int($return) friends, avoid em!
                |/echo AVOID $return
                /alert add @AlertList NPC "$spawn(name,clean)"
                /press esc
                /varset MobID 0
        }
   /if n @MobID!=0 /if n $spawn(@MobID,speed)>100 {
      /target id @MobID
      /varset TargetUpNext 0
      /echo Kiting aggro'd mob: $target(name,clean)
      /varset GettingTarget 0
      /return
   }

   /varset MobID 0
   /for SRadius 0 to 10000 step 100
      /varset MobID $searchspawn(npc,loc:@RubberX:@RubberY,radius:@SRadius,noalert:@AlertList,range:@startlevel:@endlevel)
      /if n @MobID!=0 {
        /call SpawnHasFriends $spawn(@MobID)
        /if n $return=>4 {
                /echo $spawn(name,clean) has $int($return) friends, avoid em!
                /alert add @AlertList NPC "$spawn(name,clean)"
                /press esc
                /varset MobID 0
        }
         /if n @MobID!=0 /goto :Done
      }
   /next SRadius
   /echo No mobs found, action required!
   /beep
   |/echo Ending Macro
   /beep
   |/endmac
   :Done
   /varset TargetUpNext @MobID
   /echo Next: $spawn(@MobID,level) $spawn(@MobID,name,clean) - Distance: $spawn(@MobID,distance)
   /varset GettingTarget 0
/return

Sub Event_Caster(CastText)
   /return
/declare CasterID local
   /varset CasterID $searchspawn(name,"$left($calc($strlen("@CastText")-24),"@CastText")")
   /if $spawn(@CasterID,type)!=NPC /return
   /if n $target(id)==@CasterID /return
   /if n $spawn(@CasterID,distance)<=$calc(@CirR*2) {
      /target id @CasterID
      /echo Targeting Caster: $spawn(@CasterID,name,clean)
   }
/return

Sub AddExclude(ExcludeName)
   /declare Category local
   /declare IniFile local
   /declare EachExclude local
   /declare Exclude local
   /declare BlankExclude local

   /varset BlankExclude 0
   /varset Category "$zone"
   /varset IniFile advchant_$char(name)_$servername

   /varset EachExclude 0
:NextExclude
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
   /if "@Exclude"~~"NOTFOUND" {
      /goto :IniParsed
   }

   /if "@Exclude"~~"NONE" {
      /varset BlankExclude @EachExclude
      |/echo Blank Exclude found at @EachExclude
   }

   /if "@Exclude"~~"@ExcludeName" {
      /echo @ExcludeName already on Exclude List
      /return
   }

   /varadd EachExclude 1
   /goto :NextExclude
:IniParsed
   /if n @BlankExclude==0 {
      /ini @IniFile "@Category" exclude_$int(@EachExclude) "@ExcludeName"
      |/echo Wrote to new exclude_@EachExclude=@ExcludeName
   } else {
      /ini @IniFile "@Category" exclude_$int(@BlankExclude) "@ExcludeName"
      |/echo Wrote to blank exclude_@BlankExclude=@ExcludeName

   }
   /alert add @AlertList NPC "@ExcludeName"
/return

Sub LoadExcludes()
   /declare Category local
   /declare IniFile local
   /declare EachExclude local
   /declare Exclude local
   /varset Category "$zone"
   /varset IniFile advchant_$char(name)_$servername

   /alert clear @AlertList
   /alert add @AlertList AdvChant.mac

   /if "$ini(@IniFile,"@Category")"~~"NOTFOUND" {
      /echo No Exclude list for $zone
      /return
   }

   /varset EachExclude 0
:NextExclude
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
   /if "@Exclude"~~"NOTFOUND" {
      |/echo done loading
      /return
   }
   /if "@Exclude"!~"NONE" {
     /alert add @AlertList NPC "@Exclude"
     |/echo added alert NPC @Exclude
   }
   /varadd EachExclude 1
   /goto :NextExclude
/return

Sub DelExclude(ExcludeName)
   /declare Category local
   /declare IniFile local
   /declare EachExclude local
   /declare Exclude local
   /varset Category "$zone"
   /varset IniFile advchant_$char(name)_$servername
   /if "$ini(@IniFile,"@Category")"~~"NOTFOUND" {
      /echo No Exclude list for $zone
      /return
   }

   /varset EachExclude 0
:NextExclude
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
   /if "@Exclude"~~"NOTFOUND" {
      |/echo @EachExclude item(s) removed from INI
      /call LoadExcludes
      /return
   }

   /if "@Exclude"~~"@ExcludeName" {
      /ini @IniFile "@Category" exclude_$int(@EachExclude) NONE
      |/echo writing exclude_@EachExclude as NONE - previosly was @Exclude
   }
   /varadd EachExclude 1
   /goto :NextExclude
/return
sub getstart
        /varset startlevel $calc($char(level)-6)
        /if n @startlevel<=0 /varset startlevel 1
        /varset endlevel $calc($char(level)-1)
        /if n @endlevel<=0 /varset endlevel $char(level)
/return
sub CheckObst
   /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) /call HitObst 5
   /varset MyXLOC $char(x)
   /varset MyYLOC $char(y)
   /varset ObstCount 0
/return
sub HitObst
   /sendkey up up
   /sendkey down down
   /if n $rand(99)>50 {
      /delay 3s
      /sendkey up down
      /sendkey down Right
      /delay @Param0
      /sendkey up Right
      /sendkey down up
      /delay 3s
      /sendkey up up
   } else {
      /delay 3s
      /sendkey up down
      /sendkey down left
      /delay @Param0
      /sendkey up left
      /sendkey down up
      /delay 3s
      /sendkey up up
   }
   /sendkey up down
   /sendkey up Right
   /sendkey up Left
   /sendkey down up
/return

Sub SpawnHasFriends(SpawnID)
   /if $defined(@SpawnID)==false /return 0
   /declare CloseSpawn local
   /declare SpawnCount local
   /echo checking  @SpawnID
   /alert clear 56
   /alert add 56 id @SpawnID radius 60
   /varset CloseSpawn $searchspawn(npc,nearalert:56)
   /varset SpawnCount 0
   :Loop
      /doevents
      /if n @CloseSpawn==0 /goto :Return
      /varadd SpawnCount 1
      |/echo @SpawnCount) $spawn(@CloseSpawn,name)
      /varset CloseSpawn $searchspawn(npc,nearalert:56,next,id:@CloseSpawn)
   /goto :Loop
   :Return
   /echo @SpawnCount
/return @SpawnCount

utrero
orc pawn
orc pawn
Posts: 28
Joined: Tue Apr 20, 2004 11:30 am

stucked in nothing :P

Post by utrero » Tue Apr 20, 2004 11:37 am

i dowloaded you pretty macro 2 days ago and i have been trying to work.
im actually at maidens eye to test but when i put on macro :
/mac advchant 3456 1 7 100
(3 single dots no ae) the only thing that happens its a comand line like this:
$ini(advchant_$char(name)_$servername,$zone,exclude$int(0.00))) and the 0.00 goes up to infinite...o,1,2,3,4 etc etc i endmacro at 14580 bored..
any idea what im doing wrong ???
thx all help very apreciated :)
and awesome macro :)

Drunkensloth
a lesser mummy
a lesser mummy
Posts: 67
Joined: Sat Oct 18, 2003 2:54 am

Post by Drunkensloth » Fri Apr 23, 2004 5:18 pm

updated for mq2data... cant check since i quit playing
removed all the ini stuff
removed caster awareness

fixed a possible movement bug too :P

Code: Select all

| advchant.mac - By Raebis
| Version: REV7 Released Feb 18 2004 23:15
|Updated for MQ2Data by: DrunkenSloth
| This mac is used mostly for big open zones with not a lot of
| big hills (cause hills cause pain - unless you have levitate)
|
| Features:------------------------------------------------------------------------
|
| * Automatically selects high light blue, dark blue, or white mob
| * Runs to mob before targeting it (Stealth! No cross-zone targeting!)
| * Aggro/Add Detection: Automatically targets and kites aggroed mobs (adds)
| * Ignores greens and low light blues unless they are aggroed (adds)
| * Caster Detection: Automatically will switch target to aggroed casting mobs
| * Compatible with level 49 and level 5 selos
| * Auto Healing: If health gets low, it will automatically heal
| * Fleeing Mob Catcher: If mob runs away, macro keeps you in range!
| * Detects WMS (Warping Mob Syndrom) and gets a new target if a mob warps away!
| * Rubber Anchor: kites mobs closest to macro starting point - no wandering!
| * NEW: Exclude List: Won't attack mobs that you have /add'ed to this list!
|
| ---------------------------------------------------------------------------------
|
| usage: /mac advchant.mac <DOTs> <Selos> <heal song> <radius>
|
| usage examples:
|
| If you are using...
|  ...Level 5 selos in slot 8
|  ...DD Songs in slots 1 and 3
|  ...Levitate in slot 2
|  ...Hymn of Restoration in slot 4
|  ...Radius of 50
| Then use the syntax:
|  /mac advchant 132 8 4 50
|
| If you are using...
|  ...Level 49 selos in slot 1
|  ...DOT Songs in slots 3,4,5, and 6
|  ...Hymn of Restoration in slot 7
|  ...Radius of 100
| Then use the syntax:
|  /mac advchant 3456 1 7 100
|
| ---------------------------------------------------------------------------------
|
| Notes on Exclude List:
|     The exclude list is a ini-driven list of mobs that this macro will not
|     target for kiting. You can add and remove mobs from this list on-the-fly
|     with the following commands.
|
|     /add giant
|      -This command will tell the macro not to target anything with the word
|       giant in its name.
|
|     /del giant
|      -This is the opposite of the previous command
|
|     /exlist
|      -This command will list the words that the macro uses for excluding targets
|
|     In the exlist you will see an item "(0-100) any advchant.mac" and this is
|     normal. If adding a exclusion with more than one word you must use quotes
|     around the name i.e. /add "a large trout"
|
| Notes on HealSong:
|     The healsong will play when your heath goes below @HealthMin (default 75)
|     and will continue twisting the healsong in until your health is at or above
|     @HealthMax (default 85). When this is activated, it will twist the healsong
|     instead of the firstsong in <DOTs>. Do not put any important song as the
|     first number in this argument (i.e. levitate).
|
| Warning:
|     You may wander from your starting point but after killing a mob, the next mob
|     that the macro targets will be closest to your starting point (Rubber Anchor)
|
| ---------------------------------------------------------------------------------
|
| advchant.mac REV6 was tested in EW with both level 49 and level 5 selos for about
| an hour without problems. Exclusion list worked fine.
|


#event Exp        "You gain "
#event Died       "You have entered"

#turbo

Sub Main(DOTs,Selos,Health,CRadius)
   /zapvars

   /if $defined(CRadius)==false {
      /echo usage: chant.mac <DOTs> <Selos> <heal song> <radius>
      /return
   }

   /declare CirR global

   /declare Songs array
   /declare nSongs global
   /declare CurSong global
   /declare PrevSong global

   /declare Exper global
   /declare AAExp global
   /declare RunTime global

   /declare SongTimer timer
   /declare SeloSong global
   /declare SeloTicks global
   /declare NoRewind global

   /declare HealSong global
   /declare OrigSong global

   /declare HealthMin global
   /declare HealthMax global

   /declare DBLevel global
   /declare MinLevel global
   /declare MaxLevel global
   /declare GettingTarget global

   /declare TargetUpNext global

   /declare RubberX global
   /declare RubberY global

   /declare EachSong local
   /declare AlertList global

   /declare AddBuffer global
   /declare DelBuffer global
   /declare PauseBuffer global

   /varset AddBuffer waiting
   /varset DelBuffer waiting

   /varset Exper ${Me.Exp}
   /varset AAExp ${Me.AAExp}
   /varset RunTime 1

   /varset MinLevel ${Calc[${Me.Level}-5]}
   /varset MaxLevel ${Calc[${Me.Level}+2]}

   /varset HealthMin 70
   /varset HealthMax 85

   /alias /add /varset AddBuffer
   /alias /del /varset DelBuffer
   /alias /pause /varset PauseBuffer ${Not[@PauseBuffer]}

   /varset nSongs ${Strlen[@DOTs]}
   /for EachSong 1 to @nSongs
      /varset Songs(@EachSong) ${Mid[${Calc[@EachSong-1]},1,@DOTs]}
      /echo Song @EachSong: ${Me.Gem[@Songs(@EachSong)]}
   /next EachSong

   /if n @Selos!=0 {
      /varset SeloSong @Selos
      /echo Selo's: ${Me.Gem[@SeloSong]}
   } else {
      /varset SeloSong 0
      /echo Not using Selos.
   }

   /varset SeloTicks 0
   /if ${Me.Level}>=49 /varset SeloTicks 2
   /varset HealSong @Health
   /echo Healsong: ${Me.Gem[@HealSong]}

   /varset CirR @CRadius
   /echo Radius: @CRadius

   /varset PauseBuffer 0

   /varset OrigSong @Songs(1)
   /varset CurSong 1

   /varset TargetUpNext 0   
 
   /varset RubberX ${Me.X}
   /varset RubberY ${Me.Y}

   /echo Rubber Anchor dropped at @RubberX,@RubberY

   /call Event_Timer SongTimer

   :Loop

   /if "@AddBuffer"!="waiting" {
      /call AddExclude "@AddBuffer"
      /varset AddBuffer waiting
   }

   /if "@DelBuffer"!="waiting" {
      /call DelExclude "@DelBuffer"
      /varset DelBuffer waiting
   }

   /if n @PauseBuffer==-1 {
      /echo Paused...
      :PauseLoop
      /if n @PauseBuffer==0 /goto :DonePause
      /if "@AddBuffer"!="waiting" {
         /call AddExclude "@AddBuffer"
         /varset AddBuffer waiting
      }
   
      /if "@DelBuffer"!="waiting" {
         /call DelExclude "@DelBuffer"
         /varset DelBuffer waiting
      }
      /varset SongTimer 30
      /doevents
      /goto :PauseLoop
      :DonePause
      /echo Continuing...
      /varset TargetUpNext 0
   }


   /if n @TargetUpNext==0 /if n ${Target.Id}==0 {
      /doevents Event_Exp
      /call gettarget
   }

   /if n @TargetUpNext!=0 /if n ${Target.Id}!=0 {
      /echo User Selected Target or Aggroed while running
      /varset TargetUpNext 0
   }

   /if n @TargetUpNext==0 /if ${Target.Type}!=NPC /call gettarget

   /if n ${Target.Distance}>1000 /if n ${Target.PctHPs}<=50 {
      /cleanup
      /echo Target Warped... Getting a new target
      /call GetTarget
   }

   /if n @HealSong!=0 /if n ${Me.PctHPs}<@HealthMin {
      /if n @Songs(1)!=@HealSong {
         /echo Healing On - Health: ${Me.PctHPs}% to @HealthMax%
         /varset Songs(1) @HealSong
      }
   }

   /if n @HealSong!=0 /if n ${Me.PctHPs}>=@HealthMax {
      /if n @Songs(1)!=@OrigSong {
         /echo Healing Off
         /varset Songs(1) @OrigSong
      }
   }

   /if ${Me.Casting}==FALSE /if n @SongTimer>0 /if n @SongTimer<28 {
      /if n @NoRewind==0 /varset CurSong @PrevSong
      /varset NoRewind 0
      /call Event_Timer SongTimer
   }

   /if @SeloSong!=0 /if ${Me.Buff["${Me.Gem[@SeloSong]}"]}==0 /if n @NoRewind==0 /call Event_Timer SongTimer

   /call Circ
   /doevents
   /delay 0
   /goto :Loop
/return

Sub Event_Timer(TimerName)
   /if @TimerName==SongTimer {

      /stopsong
      /call Circ
      /delay 1
      /call Circ
      /delay 1
      /if n @SeloSong!=0 {
         /if ${Me.Buff["${Me.Gem[@SeloSong]}"]}==0 {
            /cast @SeloSong
            /varset NoRewind -1
            /varset SongTimer 31
            /return
         }

         /if ${Me.Buff[${Me.Buff[${Me.Gem[@SeloSong]}]}].Duration}<=@SeloTicks {
            /cast @SeloSong
            /varset NoRewind -1
            /varset SongTimer 31
            /return
         }
         
      }
      /if ${Target}==FALSE /if ${Spell["${Me.Gem[@CurSong]}"].SpellType}==Detrimental /varset NoRewind -1
      /if n @NoRewind==0 /if ${Me.State}==STAND /cast @Songs(@CurSong)
      /varset PrevSong @CurSong
      /varset SongTimer 31
      /varadd CurSong 1
      /if n @CurSong>@nSongs /varset CurSong 1
      /call Circ
   }
/return

Sub Circ
   /declare CirX local
   /declare CirY local

   /if n @TargetUpNext!=0 {

      /varset CirX ${Spawn[@TargetUpNext].Y}
      /varset CirY ${Spawn[@TargetUpNext].X}

      /if n ${Spawn[@TargetUpNext].Distance}<=${Calc[@CirR*2]} {
         /varset TargetUpNext 0
         /target id @TargetUpNext
      }
   }

   /if n ${Target.Id}!=0  {
      /varset CirX ${Target.X}
      /varset CirY ${Target.Y}      
   }

   /if n ${Distance[@CirX:@CirY]}<${Calc[@CirR/2]} {
      /face heading ${Calc[${Heading[@CirX:@CirY]}+180]}
   } else {
      /face heading ${Calc[${Heading[@CirX:@CirY]}+${Calc[90*${Calc[@CirR/${Distance[@CirX:@CirY]}]}]}]}
   }
/return

Sub Event_Died
   /delay 10
   /sit
   /delay 10
   /camp desktop
/return

Sub Event_Exp

   /varset AAExp ${Calc[${Me.AAExp}-@AAExp]}
   /varset Exper ${Calc[${Me.Exp}-@Exper]}

   /if n @Exper>0 {
      /declare EXKills local
      /varset EXKills ${Calc[${Calc[100-${Me.Exp}]}/@Exper]}
      /echo Exp Gain: @Exper Total: ${Me.Exp} Kills: @EXKills
   }

   /if n @AAExp>0 {
      /declare AAKills local
      /varset AAKills ${Calc[${Calc[100-${Me.AAExp}]}/@AAExp]}
      /echo AA  Gain: @AAExp Total: ${Me.AAExp} Kills: @AAKills
   }

   /varset RunTime ${Macro.RunTime}
   /varset Exper ${Me.Exp}
   /varset AAExp ${Me.AAExp}

   /varset MinLevel ${Calc[${Me.Level}-5]}
   /varset MaxLevel ${Calc[${Me.Level}+2]}
/return

Sub GetTarget
   /if n @GettingTarget==-1 /return
   /varset GettingTarget -1
   /declare MobID local
   /declare SRadius local
   /varset MobID ${Spawn[npc radius ${Calc[@CirR*2]}]}
   /if n @MobID!=0 /if n ${Spawn[@MobID].Speed}>100 {
      /target id @MobID
      /varset TargetUpNext 0
      /echo Kiting aggro'd mob: ${Target.Name}
      /varset GettingTarget 0
      /return
   }

   /varset MobID 0
   /for SRadius 0 to 10000 step 100
      /varset MobID ${Spawn[npc loc @RubberX:@RubberY radius @SRadius]}
      /if n @MobID!=0 {
         /goto :Done
      }
   /next SRadius
   /echo No mobs found, action required!
   /beep
   /echo Ending Macro
   /beep
   /endmac
   :Done
   /varset TargetUpNext @MobID
   /echo Next: ${Spawn[@MobID].Level} ${Spawn[@MobID].Name} - Distance: ${Spawn[@MobID].Distance}
   /varset GettingTarget 0
/return 
And here I was clicking like a sucker!

nald
orc pawn
orc pawn
Posts: 15
Joined: Sat Dec 20, 2003 9:30 am

Post by nald » Fri Apr 23, 2004 5:43 pm

When I try to use this macro I get the following error I am useing zip 21b.

CCommandHook::Detour(/mac advchant 123 6 8 28)

Macro - Loading macro: D:\games\MQ2-Latest\Release\Macros\advchant.mac

Macro - Starting macro with '/call Main 123 6 8 28'

WriteChatColor(Cleared the following: Timers Vars Arrays)

WriteChatColor(Ending macro: Failed to parse /if command)

WriteChatColor(advchant.mac@91 (Main(DOTs,Selos,Health,CRadius)): /if $defined(CRadius)==false {)

WriteChatColor(Cleared the following: Timers Arrays)

WriteChatColor(The current macro has ended.)

WriteChatColor(Usage: /if (<conditions>) <command>)

s0meth1ng
orc pawn
orc pawn
Posts: 28
Joined: Sun Feb 22, 2004 7:00 am

Post by s0meth1ng » Sun Apr 25, 2004 2:34 am

bump

Bardmad
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon Apr 05, 2004 4:55 am

After last patch

Post by Bardmad » Sun Apr 25, 2004 11:09 am

This is a great macro, but cant work after the last patch... can someone help... i'm bad at programming

Bardmad
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon Apr 05, 2004 4:55 am

After last patch

Post by Bardmad » Mon Apr 26, 2004 2:23 pm

It seems like it's not working :(, anyone out there facing the same problem? Is the problem due to the lastest MQ2 patch on 24 April? this is a great program... hopefully someone out there can help.

GuardianX99
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Dec 31, 2002 6:31 pm
Contact:

Post by GuardianX99 » Tue Apr 27, 2004 12:25 am

Yes its broken in its current form.

Yes some one will likely post a working one in time.

No stop asking for it to be updated.

Bardlover
a lesser mummy
a lesser mummy
Posts: 52
Joined: Sun Oct 10, 2004 5:32 pm

Using just part of this

Post by Bardlover » Sun Oct 10, 2004 5:34 pm

I am using some other solutions ATM that I am really happy with, but would like to incorperate the targeting function of this. Can someone help me strip this down to a /starttargeting function?