Why oh why...

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Why oh why...

Post by chimaera » Sun Aug 03, 2003 10:53 pm

Does this relatively simple macro randomly decide to turn off attack mode in EQ ?

Code: Select all

#turbo

#Event Enrage "has become ENRAGED."
#Event UnEnrage "is no longer enraged."
#Event Invited "To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel"
#Event Stunned "You are stunned"
#Event NotStunned "You are unstunned"

Sub Main

:MainLoop

   /delay 0
   /doevents
   /if $combat==TRUE /call Attack
   /goto :MainLoop

/return

Sub Attack

:TrackLoop

/doevents
/delay 0

/if $combat==FALSE /goto :EndAttack

/face nopredict fast
/if n $target(distance)>20 /sendkey down up
/if n $target(distance)<18 {
   /sendkey up up
   /goto :AttackLoop
}

/goto :TrackLoop

:AttackLoop

/doevents
/delay 0

/if $combat==FALSE /goto :EndAttack
/if n $target(distance)>5 /face nopredict fast
/if n $target(distance)>17 /sendkey down up
/if n $target(distance)<10 /sendkey up up

/if n $vStunned==0 {
   /if n $char(ability,kick)>0 /doability kick
   /if n $char(ability,bash)>0 /doability bash
   /if n $char(ability,disarm)>0 /doability disarm
}

/if n $char(ability,taunt)>0 /doability taunt

/goto :AttackLoop

:EndAttack
/attack off

/return

Sub Event_Enrage
   /attack off
/return

Sub Event_UnEnrage
   /attack on
/return

Sub Event_Invited
   /delay 20
   /invite
/return

Sub Event_Stunned
   /varset vStunned 1
/return

Sub Event_NotStunned
   /varset vStunned 0
/return

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

Enrage

Post by grimjack » Mon Aug 04, 2003 12:22 am

I would guess enrage.

The enrage event turns off attack untill it sees the message that the enrage is over.

It could be somthing else, however.

Thanks
GrimJack
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

renagade8
orc pawn
orc pawn
Posts: 28
Joined: Sat Oct 19, 2002 9:17 pm

Post by renagade8 » Mon Aug 04, 2003 3:07 am

most likely would be the enrage part, since most pets that are summoned by mages, shamans and others enrage that would set off the event enrage.

-ren

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Mon Aug 04, 2003 3:36 am

Well its not that simple..

My lvl 1 Wood Elf Warrior tester in Greater Faydark ran out last night, and turned on attack against "a sylvan bat". After about 3 seconds the attack turned itself off, and the echo i had placed in :EndAttack triggered.

So i placed this little code in both the :AttackLoop and the :TrackLoop. Sometimes the echo fired before i even reached the mob.

Code: Select all

/if $combat==FALSE {
   /echo Attack turned off...
   /goto :EndAttack 
}
Just to be sure, since there is no other /attack off than in the Enrage event (well except for the one in :EndAttack, that should only fire if attack already IS off..) i placed an echo there as well. The Enrage echo did not trigger once..

Edit: Is it possible that $combat is bugged at the moment ? I did not have these problems when i used /varset to set a variable to initiate the attack call...

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

debug

Post by grimjack » Tue Aug 05, 2003 2:06 am

Add /echo $combat in a few places.
See if it's coming back FALSE. I don't play at the moment or I would test.

Thanks
GrimJack
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

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Tue Aug 05, 2003 3:27 am

I believe the combat variable reflects the state of attack, but it doesn't seem to work correctly.

Why are you doing anything based on $combat? Use $target instead.

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

Post by grimjack » Tue Aug 05, 2003 4:24 am

dont_know_at_all wrote:I believe the combat variable reflects the state of attack, but it doesn't seem to work correctly.

Why are you doing anything based on $combat? Use $target instead.
I used $combat for my always on macros. It looks like this is the type he has here. Basicly the macro runs at all times and when you turn on attack it keeps you in range and does your abilities. Using $target is not good for triggering the attack subs since you don't want it to kick in every time you target something. On a side note, however, using $target to decide when combat is done would be fine(I believe this is how I did mine).

Code: Select all

 /if $target()=="FALSE" {
   /goto :EndAttack 
}
And here is what I used on my rogue, modded for a warrior. Feal free to use anything you like out of it. I added the stun check from your code. I'm not sure if the event triggers are correct.

Code: Select all

| warrior.mac
| Grimjack's melee helper script.

#Turbo 72
#define RangeMin v50
#define RangeMax v51
#define FastRange v52
#define Combatstatus v60
#define EnrageVar v61
#define IMStunned v62
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event Stunned "You are stunned"
#Event NotStunned "You are unstunned" 

Sub Main
   /varset RangeMin $p0
   /varset RangeMax $p1
   /varset FastRange $p2
   /varset Combatstatus 0

   /varset EnrageVar 0
   :Mainloop
   /call Combatcheck
   /if $Combatstatus=="1" /call RangeSub
   /if $Combatstatus=="1" /call AbilSub
   /doevents
   /goto :Mainloop
/return

Sub AbilSub
    /if n $IMStunned==0 {
      /if n $char(ability,kick)>0 /doability kick
      /if n $char(ability,bash)>0 /doability bash
      /if n $char(ability,disarm)>0 /doability disarm
   } 
/return

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



Sub Rangesub
   /face fast nopredict
   /if n $target(distance)>=$FastRange /call Fastmove
   /if n $target(distance)>$RangeMax {
      /press up
   }
   /if n $target(distance)<$RangeMin {
      /press down
   }
/return


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

Sub Fastmove
   :fastmoveloop
   /if $target()=="FALSE" {
      /varset Combatstatus 0
      /sendkey up up
      /if $combat=="TRUE" {
         /attack off
         /return
      }
   }
   /face fast nopredict
   /if n $target(distance)>$FastRange {
      /sendkey down up
      /attack off
   }
   /if n $target(distance)<=$FastRange {
         /if $Combatstatus=="1" {
            /if $EnrageVar=="0" {
               /attack on
            }
         }
      /sendkey up up
      /return
   }
   /goto :fastmoveloop
/return


Sub Event_Offrage
   /if $target()=="TRUE" {
         /varset EnrageVar 0
         /attack
      }
   }
/return

Sub Event_Stunned
   /varset IMStunned 1
/return

Sub Event_NotStunned
   /varset IMStunned 0
/return
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

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Tue Aug 05, 2003 7:06 am

Code: Select all

#Event Attackon "Auto attack is on."
#Event Attackoff "Auto attack is off."

Sub Event_Attackon
   /varset v2 1
/return

Sub Event_Attackoff
   /varset v2 0
/return
Basically i changed the $combat code into events, and used the variable v2 to check combat states instead. Now it runs flawlessly. Thanks for the input all :)

Doodman
a ghoul
a ghoul
Posts: 124
Joined: Thu Jan 02, 2003 12:07 pm

Post by Doodman » Tue Aug 05, 2003 12:39 pm

One comment. When your targeted mob dies, your autoattack turns off automatically with no "Autoattack is now off" message.

So, you might want to combine what you have with the $target()==FALSE logic, posted above, to make sure your macro marks attack as off when the mobs dies.

Just a thought.

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Tue Aug 05, 2003 6:27 pm

Yes i have already done that. The attackoff event only triggers if i turn autoattack of manually, so i use $target to determine if the mob is dead or not.

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Tue Aug 05, 2003 6:31 pm

As a sidenote, how can i turn the "Your target is too far away" and "You cant see your target" messages back on ? They dissapear magically when i start MQ :D

I'd like to use those for events, since $target(distance) does not take the mobs "hitbox" into consideration at all. Most of the time, i want to be as far away from the mob as possible, while still attacking it.

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

Post by grimjack » Wed Aug 06, 2003 3:57 am

chimaera wrote:As a sidenote, how can i turn the "Your target is too far away" and "You cant see your target" messages back on ? They dissapear magically when i start MQ :D

I'd like to use those for events, since $target(distance) does not take the mobs "hitbox" into consideration at all. Most of the time, i want to be as far away from the mob as possible, while still attacking it.
Check your macroquest.ini for filters and remove them.

Thanks
GrimJack
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