Help with this macro please!

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

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Help with this macro please!

Post by blakbelt » Sun Oct 19, 2003 11:26 am

I have written this macro again (as all my work) a bastardised version of someone elses hard work, could you (the enlightened) look at the code and suggest why it still keeps hititng Flying Kick after the fight has finished, also could you look at the mob following and see if that could do with tweaking. Many thanks !!

Code: Select all

| | Usage:  /macro monkattack <aggressive/evasive> <tankname> 
| Updated with the modified code from grimjack have also played with the target 
| following.

#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 
#Event Haszoned "You have entered." 
#Event Beinghit "hits YOU for" 

Sub Main(FirstArg,SecondArg) 
    /echo monkattack has started in @FirstArg mode using @SecondArg as main assist 
    /declare Toggle local 
    /declare Toggle2 local 
    /declare EnrageVar global 
    /declare Combatstatus global 
    /declare epictimer timer 
    /declare targetarray array 

    /varset epictimer 0 
    /varset Toggle @FirstArg 
    /varset Toggle2 @SecondArg 

:mainloop 
    /if "$combat"=="TRUE" { 
      /if "@Toggle"=="aggressive" { 
        /call aggressive 
        } 
      /if "@Toggle"=="evasive" { 
        /call evasive 
        } 
      } 
    /delay 3 
    /doevents 
  /goto :mainloop 
/return 

Sub aggressive 
    
    /call epicclick 
    /varset targetarray(0) "$target(name,clean)" 
    /varset targetarray(1) $target(level) 
    /varset targetarray(2) $target(name) 
    /varset targetarray(3) $target(id) 

    /delay 3 
    /if n @targetarray(3)==0 /return 
    /if $combat!="TRUE" /return 
    
    /echo Fighting a level @targetarray(1) $target(class) 
    /face fast look nopredict 
    /varset Combatstatus 1 

:AttackMoveAgg 
    /if $target(id)!=@targetarray(3) { 
       /call EndCombat 
       /return 
    } 
    /doevents 
    /call CombatCheck 
    /if n $char(ability,"Flying Kick")>0 /doability "Flying Kick" 
    /if n $char(ability, "Disarm")>0 /doability "Disarm" 
    /if n $target(distance,nopredict)>25 /sendkey down up 
    /if n $target(distance,nopredict)>10 { 
      /if n $target(distance,nopredict)<25 { 
        /press Num_9 
        /delay 3 
        /sendkey down up 
        /press Num_9 
        } 
      /if n $target(distance,nopredict)<10 /sendkey up up 
      } 
    /delay 4 
   /goto :AttackMoveAgg 
/return 

Sub evasive 

    /call epicclick 

    /varset targetarray(0) "$target(name,clean)" 
    /varset targetarray(1) $target(level) 
    /varset targetarray(2) $target(name) 
    /varset targetarray(3) $target(id) 

    /delay 3 
    /if n @targetarray(3)==0 /return 
    /if "$combat"!="TRUE" /return 

    /echo Assisting @TankName on a Level @targetarray(1) $target(class) 
    /face fast look nopredict 
    /varset Combatstatus 1 

:AttackMoveEva 
    /if "$target(id)"!="@targetarray(3)" { 
       /call EndCombat 
       /return 
    } 
    /doevents 
    /call CombatCheck 
    /if n $char(ability,"Flying Kick")>0 /doability "Flying Kick" 
    /if n $target(distance,nopredict)>25 /sendkey down up 
    /if n $target(distance,nopredict)>10 { 
      /if n $target(distance,nopredict)<25 {
        /delay 3 
        /sendkey down up 
        }
      /if n $target(distance,nopredict)<10 /sendkey up up 
      } 
    /delay 4 
   /goto :AttackMoveEva 
/return 

Sub epicclick 

    /if $combat=="TRUE" { 
    /if n @epictimer<=10 { 
       /varset epictimer 100 
       /cast item "Celestial Fists" 
     } 
    } 
/return 

Sub EndFight 

    /doevents flush 
    /sendkey up up 
    /sendkey up down 
    /attack off 
    /varset Combatstatus 0 
    /varset targetarray(0) 0 
    /varset targetarray(1) 0 
    /varset targetarray(2) 0 
    /varset targetarray(3) 0 
    /press Num_5 
    /delay 4 
/return 

Sub CombatCheck 

    /if n @EnrageVar==1 { 
      /if $target()=="TRUE" { 
        /return 
        } 
      /varset EnrageVar 0 
      /varset Combatstatus 0 
      } 
    /if $target()=="FALSE" { 
      /varset Combatstatus 0 
      } 
    /if $combat=="TRUE" { 
      /attack off 
      } 
/return 

Sub Event_Enraged 
    
    /if $target()=="TRUE" { 
      /if n @Combatstatus==1 { 
        /varset EnrageVar 1 
        /attack off 
        } 
      /varset EnrageVar 0 
      } 
/return 

Sub Event_Beinghit 
    
    /if "@Mode"=="evasive" { 
      /if n @Combatstatus==1 { 
        /attack off 
        /doability "Feign Death" 
        /delay 2 
        /stand 
        /attack on 
        } else { 
        /return 
      } 
    } 
/return 

Sub Event_Haszoned 

    /echo This zone has a $zone(Zem) exp multiplier 
/return

  
:D top job
Last edited by blakbelt on Thu Oct 23, 2003 2:56 am, edited 4 times in total.
Blakbelt

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sun Oct 19, 2003 11:47 am

Didn't go over it too deep, but try these changes:

Code: Select all

:AttackMoveAgg 
    /if $target(id)!=@targetarray(3) [color=cyan]/call EndFight[/color]
    /doevents 
    /call CombatCheck 
    /if n $char(ability,"Flying Kick")>0 /doability "Flying Kick" 
    /if n $char(ability, "Disarm")>0 /doability "Disarm" 
    /if n $target(distance,nopredict)>25 /sendkey down up 
    /if n $target(distance,nopredict)>10 { 
      /if n $target(distance,nopredict)<25 { 
        /press Num_9 
        /delay 3 
        /sendkey down up 
        /press Num_9 
        } 
      /if n $target(distance,nopredict)<10 /sendkey up up 
      } 
    /delay 4 
   /goto :AttackMoveAgg 
/return 


[color=cyan]Sub EndFight[/color]
    /doevents flush 
    /sendkey up up 
    /sendkey up down 
    /attack off 
    /varset Combatstatus 0 
    /varset targetarray(0) 0 
    /varset targetarray(1) 0 
    /varset targetarray(2) 0 
    /varset targetarray(3) 0 
    /press Num_5 
    /delay 4 
   /goto :mainloop 
/return 
I *think* it will fix the problem with the flying kick

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Mon Oct 20, 2003 7:38 am

Will give it a go and thanks for the advice ;)
Blakbelt

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Mon Oct 20, 2003 8:18 am

For the most part it looks good. Here is what I would change to fix your problem and a small change to how you click your epic.

Code: Select all

| Usage:  /macro monkattack <aggressive/evasive> <tankname>

#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event Haszoned "You have entered."
#Event Beinghit "hits YOU for"

Sub Main(FirstArg,SecondArg)
    /echo monkattack has started in @FirstArg mode using @SecondArg as main assist
    /declare Toggle local
    /declare Toggle2 local
    /declare EnrageVar global
    /declare Combatstatus global
    /declare epictimer timer
    /declare targetarray array

    /varset epictimer 0
    /varset Toggle @FirstArg
    /varset Toggle2 @SecondArg

:mainloop
    /if "$combat"=="TRUE" {
      /if "@Toggle"=="aggressive" {
        /call aggressive
        }
      /if "@Toggle"=="evasive" {
        /call evasive
        }
      }
    /delay 3
    /doevents
  /goto :mainloop
/return

Sub aggressive
   
    /call epicclick
    /varset targetarray(0) "$target(name,clean)"
    /varset targetarray(1) $target(level)
    /varset targetarray(2) $target(name)
    /varset targetarray(3) $target(id)

    /delay 3
    /if n @targetarray(3)==0 /return
    /if $combat!="TRUE" /return
   
    /echo Fighting a level @targetarray(1) $target(class)
    /face fast look nopredict
    /varset Combatstatus 1

:AttackMoveAgg
    [color=red]/if $target(id)!=@targetarray(3) {
       /call EndCombat
       /return
    }[/color]
    /doevents
    /call CombatCheck
    /if n $char(ability,"Flying Kick")>0 /doability "Flying Kick"
    /if n $char(ability, "Disarm")>0 /doability "Disarm"
    /if n $target(distance,nopredict)>25 /sendkey down up
    /if n $target(distance,nopredict)>10 {
      /if n $target(distance,nopredict)<25 {
        /press Num_9
        /delay 3
        /sendkey down up
        /press Num_9
        }
      /if n $target(distance,nopredict)<10 /sendkey up up
      }
    /delay 4
   /goto :AttackMoveAgg
/return

Sub evasive
 
    /call epicclick

    /varset targetarray(0) "$target(name,clean)"
    /varset targetarray(1) $target(level)
    /varset targetarray(2) $target(name)
    /varset targetarray(3) $target(id)

    /delay 3
    /if n @targetarray(3)==0 /return
    /if "$combat"!="TRUE" /return

    /echo Assisting @TankName on a Level @targetarray(1) $target(class)
    /face fast look nopredict
    /varset Combatstatus 1

:AttackMoveEva
    [color=red]/if "$target(id)"!="@targetarray(3)" {
       /call EndCombat
       /return
    }[/color]
    /doevents
    /call CombatCheck
    /if n $char(ability,"Flying Kick")>0 /doability "Flying Kick"
    /if n $target(distance,nopredict)>25 /sendkey down up
    /if n $target(distance,nopredict)>10 {
      /if n $target(distance,nopredict)<25 {
        /press Num_9
        /delay 3
        /sendkey down up
        /press Num_9
        }
      /if n $target(distance,nopredict)<10 /sendkey up up
      }
    /delay 4
   /goto :AttackMoveEva
/return

Sub epicclick

    /if $combat=="TRUE" {
    /if n @epictimer<=10 {
       /varset epictimer 100
       [color=blue]/cast item [/color]"[color=red]name of epic[/color]"
     }
    }
/return

[color=red]Sub EndFight

    /doevents flush
    /sendkey up up
    /sendkey up down
    /attack off
    /varset Combatstatus 0
    /varset targetarray(0) 0
    /varset targetarray(1) 0
    /varset targetarray(2) 0
    /varset targetarray(3) 0
    /press Num_5
    /delay 4
/return[/color]

Sub CombatCheck

    /if n @EnrageVar==1 {
      /if $target()=="TRUE" {
        /return
        }
      /varset EnrageVar 0
      /varset Combatstatus 0
      }
    /if $target()=="FALSE" {
      /varset Combatstatus 0
      }
    /if $combat=="TRUE" {
      /attack off
      }
/return

Sub Event_Enraged
   
    /if $target()=="TRUE" {
      /if n @Combatstatus==1 {
        /varset EnrageVar 1
        /attack off
        }
      /varset EnrageVar 0
      }
/return

Sub Event_Beinghit
   
    /if "@Mode"=="evasive" {
      /if n @Combatstatus==1 {
        /attack off
        /doability "Feign Death"
        /delay 2
        /stand
        /attack on
        } else {
        /return
      }
    }
/return

Sub Event_Haszoned

    /echo This zone has a $zone(Zem) exp multiplier
/return
Thanks
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Mon Oct 20, 2003 5:57 pm

Cheers :)
Blakbelt

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Post by Losingteam » Tue Oct 21, 2003 11:58 pm

Don't cheer yet. For some reason I set it up as /macro monk.mac aggressive tankname Then I execute that and I first have to target the mob I want on my own. Then I had to turn attack on myself. Then it presumed to run at the mob full force and stand on the mobs head. At which time attack is turned off.

I would like to include that I had to remove the /doabilities part because it was spamming me like crazy saying there was no ability. (Even though I have disarm and flying kick both on keys)

Finally, whats with the parts that refer to /press num_9 ?? What is supposed to be associated with this key? Because I remapped my keyboard to suit my needs.

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Wed Oct 22, 2003 3:29 am

Sorry i should have explained further, aggressive is when you are the tank, you should only set it to aggressive when you are not assisting. Evasive has a routine that when hit it FDs to drop aggro, aggressive doesnt. If you have a suggestion post it here and i will see if i can incorporate it into the macro. No coding genius but will try...
Blakbelt

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Wed Oct 22, 2003 3:32 am

Will look at the code again...
Blakbelt

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Post by Losingteam » Wed Oct 22, 2003 5:24 pm

I suggest deleting half the stuff in this one and saving the new one as a non bot one. I would like it to work like this. I want to hit my assist key to select the mob and turn attack on. Then I hit the macro button and it does the following:

- Face the mob, and keep me withing melee range throughout the entire fight
- Auto flying kick (and maybe disarm)
- End the macro when the mob dies
- Report the ammount of exp I got from the kill


Thanks. I think what I am asking for is much simpler than the bot, and in my situation, it will be alot easier for me.