Need help with this macro conversion

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Need help with this macro conversion

Post by seph_yaro » Sun Sep 12, 2004 9:42 am

Ok, I posted this in the VIP help section, but it seems that only Dman was able to help - and neither of us got it to work right, anyways. First, is the original conversion attempt, by myself (It errored like mad, plus wasn't completely converted - I didn't know what should be changed to what :( ):

Code: Select all

|bstlrd-assist.mac 
|Beastlord Melee assist macro. 
|version 1.1 by SephYaro 
|Chaged from 1.0: Removed disarm coding form macro 
|Original code taken from rogue-assist.mac written by Grimjack 
#Turbo 72 
#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 

Sub Main 
   /declare RangeMin global 
   /declare RangeMax global 
   /declare FastRange global 
   /declare Combatstatus global 
   /declare CastTimer timer 
   /declare EnrageVar global 
   /declare DoHeal global 
   /declare HealThing global 
   /declare DoKick global  
|-------------------------------------- 
|Edit this to change autoheal 
   /varset DoHeal 0 
   /varset HealThing "Light Healing" 
|Edit this to change auto kick 
   /varset DoKick 0 
|--------------------------------------- 
   /varset RangeMin @Param0 
   /varset RangeMax @Param1 
   /varset FastRange @Param2 
   /varset Combatstatus 0 
   /varset EnrageVar 0 
   :Mainloop 
   /call Combatcheck 
   /if (@Combatstatus=="1") /call RangeSub 
   /if (@Combatstatus=="1") /call Kickit 
   /if (@Combatstatus=="0") /call Healthcheck 
   /doevents 
   /goto :Mainloop 
/return 


Sub Healthcheck 
   /if (@DoHeal==0) /return 
   /if (${Me.Casting}=="TRUE") /return 
   /if (${Me.Moving}=="TRUE") /return 
   /if (${Me.PctHPs}<=%90) { 
      /if (${Me.Combat}="TRUE") { 
         /if (${Target}=="FALSE") { 
            /delay 5s 
            /cast "@HealThing" 
         } 
      } 
   } 
/return 


Sub Kickit 
   /if (@DoKick==0) /return 
   /if ($char(ability,"Kick")!=-2) { 
   /doability "Kick" 
   } 
/return 

Sub Combatcheck 
   /if (@EnrageVar=="1") { 
      /if (${Target}=="TRUE") { 
         /return 
      } else { 
         /varset EnrageVar 0 
         /varset Combatstatus 0 
      } 
   } 
   /if (${Target}=="FALSE") { 
      /varset Combatstatus 0 
      /if (${Me.Combat}=="TRUE") { 
         /attack off 
      } 
      /return 

   } 
   /if (${Target}=="TRUE") { 
      /if (${Me.Combat}=="TRUE") { 
         /varset Combatstatus 1 
         /return 
      } 
   } 
/varset Combatstatus 0 
/return 



Sub Rangesub 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>=@FastRange) /call Fastmove 
   /if (${Target.Distance}>@RangeMax) { 
      /keypress up 
   } 
   /if (${Target.Distance}<@RangeMin) { 
      /keypress 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 (${Me.Combat}=="TRUE") { 
         /attack off 
         /return 
      } 
   } 
   /stand 
   /face nolook fast 
   /if (${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 
and second, here is what Dman came up with (It gives errors out the wazoo on the kick part, and jumps you back and forth around the target.):

Code: Select all

|bstlrd-assist.mac 
|Beastlord Melee assist macro. 
|version 1.1 by SephYaro 
|Chaged from 1.0: Removed disarm coding form macro 
|Original code taken from rogue-assist.mac written by Grimjack 
#Event Enraged "#*#has become ENRAGED#*#" 
#Event Offrage "#*#is no longer enraged#*#" 

Sub Main 
   /declare RangeMin int outer 
   /declare RangeMax int outer 
   /declare FastRange int outer 
   /declare Combatstatus bool outer 
   /declare CastTimer timer 
   /declare EnrageVar bool outer 
   /declare DoHeal bool outer 
   /declare HealThing string outer 
   /declare DoKick bool outer 
|-------------------------------------- 
|Edit this to change autoheal 
   /varset DoHeal FALSE 
   /varset HealThing "Light Healing" 
|Edit this to change auto kick 
   /varset DoKick FALSE 
|--------------------------------------- 
   /varset RangeMin ${Param0} 
   /varset RangeMax ${Param1} 
   /varset FastRange ${Param2} 
   /varset Combatstatus FALSE 
   /varset EnrageVar FALSE 
   :Mainloop 
   /call Combatcheck 
   /if (${Combatstatus}) /call RangeSub 
   /if (${Combatstatus}) /call Kickit 
   /if (!${Combatstatus}) /call Healthcheck 
   /doevents 
   /goto :Mainloop 
/return 


Sub Healthcheck 
   /if (!${DoHeal}) /return 
   /if (${Me.Casting.ID}) /return 
   /if (${Me.Moving}) /return 
   /if (${Me.PctHPs}<=90) { 
      /if (${Me.Combat}) { 
         /if (!${Target.ID}) { 
            /delay 5s 
            /cast "${HealThing}" 
         } 
      } 
   } 
/return 


Sub Kickit 
   /if (!${DoKick}) /return 
   /if (${Me.AbilityReady[Kick]}) /doability Kick 
/return 

Sub Combatcheck 
   /if (${EnrageVar}) { 
      /if (${Target.ID}) { 
         /return 
      } else { 
         /varset EnrageVar FALSE 
         /varset Combatstatus FALSE 
      } 
   } 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /if (${Me.Combat}) { 
         /attack off 
      } 
      /return 

   } 
   /if (${Target.ID}) { 
      /if (${Me.Combat}) { 
         /varset Combatstatus TRUE 
         /return 
      } 
   } 
/varset Combatstatus FALSE 
/return 



Sub Rangesub 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>=${FastRange}) /call Fastmove 
   /if (${Target.Distance}>${RangeMax}) { 
      /keypress forward 
   } 
   /if (${Target.Distance}<${RangeMin}) { 
      /keypress back 
   } 
/return 


Sub Event_Enraged 
   /if (${Target.ID}) { 
      /varset EnrageVar TRUE 
      /attack off 
   } 
/return 

Sub Fastmove 
   :fastmoveloop 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /keypress forward 
      /if (${Me.Combat}) { 
         /attack off 
         /return 
      } 
   } 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>${FastRange}) { 
      /keypress forward hold 
      /attack off 
   } 
   /if  (${Target.Distance}<=${FastRange}) { 
         /if (${Combatstatus}) { 
            /if (!${EnrageVar}) { 
               /attack on 
            } 
         } 
      /keypress forward 
      /return 
   } 
   /goto :fastmoveloop 
/return 


Sub Event_Offrage 
   /if (${Target.ID}) { 
         /varset EnrageVar FALSE 
         /attack 
      } 
   } 
/return
Any help would be greatly appreciated, and if it ever gets to working right, any help will be credited in teh comments section.

Thanks in advance :)

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sun Sep 12, 2004 10:35 am

I did a little more and fixed the only thing I figured might be erroring in the kick sub codewise. I also tried to make the movement a little better than my 5 minute conversion from before. Totally untested but should work better than my last post.

Code: Select all

|bstlrd-assist.mac 
|Beastlord Melee assist macro. 
|version 1.1 by SephYaro 
|Chaged from 1.0: Removed disarm coding form macro 
|Original code taken from rogue-assist.mac written by Grimjack 
#Event Enraged "#*#has become ENRAGED#*#" 
#Event Offrage "#*#is no longer enraged#*#" 

Sub Main 
   /declare RangeMin int outer 
   /declare RangeMax int outer 
   /declare FastRange int outer 
   /declare Combatstatus bool outer 
   /declare CastTimer timer 
   /declare EnrageVar bool outer 
   /declare DoHeal bool outer 
   /declare HealThing string outer 
   /declare DoKick bool outer 
|-------------------------------------- 
|Edit this to change autoheal 
   /varset DoHeal FALSE 
   /varset HealThing "Light Healing" 
|Edit this to change auto kick 
   /varset DoKick FALSE 
|--------------------------------------- 
   /varset RangeMin ${Param0} 
   /varset RangeMax ${Param1} 
   /varset FastRange ${Param2} 
   /varset Combatstatus FALSE 
   /varset EnrageVar FALSE 
   :Mainloop 
   /call Combatcheck 
   /if (${Combatstatus}) /call RangeSub 
   /if (${Combatstatus}) /call Kickit 
   /if (!${Combatstatus}) /call Healthcheck 
   /doevents 
   /goto :Mainloop 
/return 


Sub Healthcheck 
   /if (!${DoHeal}) /return 
   /if (${Me.Casting.ID}) /return 
   /if (${Me.Moving}) /return 
   /if (${Me.PctHPs}<=90) { 
      /if (${Me.Combat}) { 
         /if (!${Target.ID}) { 
            /delay 5s 
            /cast "${HealThing}" 
         } 
      } 
   } 
/return 


Sub Kickit 
   /if (!${DoKick}) /return 
   /if (${Target.Distance}<=${RangeMax} && ${Me.AbilityReady[Kick]}) /doability Kick 
/return 

Sub Combatcheck 
   /if (${EnrageVar}) { 
      /if (${Target.ID}) { 
         /return 
      } else { 
         /varset EnrageVar FALSE 
         /varset Combatstatus FALSE 
      } 
   } 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /if (${Me.Combat}) { 
         /attack off 
      } 
      /return 

   } 
   /if (${Target.ID}) { 
      /if (${Me.Combat}) { 
         /varset Combatstatus TRUE 
         /return 
      } 
   } 
/varset Combatstatus FALSE 
/return 



Sub Rangesub 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>=${FastRange}) /call Fastmove 
   /if (${Target.Distance}>${RangeMax}) { 
      /keypress forward hold
      /delay 5 (${Target.Distance}<=${RangeMax})
      /keypress forward
   } 
   /if (${Target.Distance}<${RangeMin}) { 
      /keypress back hold
      /delay 5 (${Target.Distance}>=${RangeMin})
      /keypress back
   } 
/return 


Sub Event_Enraged 
   /if (${Target.ID}) { 
      /varset EnrageVar TRUE 
      /attack off 
   } 
/return 

Sub Fastmove 
   :fastmoveloop 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /keypress forward 
      /if (${Me.Combat}) { 
         /attack off 
         /return 
      } 
   } 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>${FastRange}) { 
      /keypress forward hold 
      /delay 3
      /attack off 
   } 
   /if  (${Target.Distance}<=${FastRange}) { 
         /if (${Combatstatus}) { 
            /if (!${EnrageVar}) { 
               /attack on 
            } 
         } 
      /keypress forward 
      /return 
   } 
   /goto :fastmoveloop 
/return 


Sub Event_Offrage 
   /if (${Target.ID}) { 
         /varset EnrageVar FALSE 
         /attack 
      } 
   } 
/return 

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sun Sep 12, 2004 10:39 am

Since you posted here instead of VIP, can I ask you what your reasoning was when posting the original unmodified macro that you KNOW was broken along with your fixed version, and yet just waving your hand when it came to "errors out the wazoo"? Such things boggle me.

For starters, put a /delay 1 in your loop (after /doevents looks good). Right now whenever you're out of range this has the effect of repeatedly tapping the cursor key as fast as possible, which is probably what's making you "jump". There are dozens and dozens of macros out there with a "stay in range" type logic you can steal.

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Sun Sep 12, 2004 11:10 am

Cr4zyb4rd wrote:Since you posted here instead of VIP, can I ask you what your reasoning was when posting the original unmodified macro that you KNOW was broken along with your fixed version, and yet just waving your hand when it came to "errors out the wazoo"? Such things boggle me.

For starters, put a /delay 1 in your loop (after /doevents looks good). Right now whenever you're out of range this has the effect of repeatedly tapping the cursor key as fast as possible, which is probably what's making you "jump". There are dozens and dozens of macros out there with a "stay in range" type logic you can steal.
My reasoning was, if somehow Dman's fix contained an error, then the original might be needed to pinpoint that. Seemed fairly logical to me, ne?

I am not sure what you mean by "just waving my hand when it comes to 'errors out the wazoo' ", though, so I can't clarify my reasoning much more than this. After all, I wasn't being negative towards anyone, so my comment on errors out the wazoo couldn't have been offensive /shrug

I don't have an error log, and I can't take screenshots, so I couldn't say what the errors were, specifically. I got what looked like 20 errors, and they all refernced the DoKick chunk.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sun Sep 12, 2004 11:18 am

If you look, I added in a few delays in the movement routines this morning to avoid the complete jumpiness I knew my first conversion would have. As to the "It gives errors out the wazoo on the kick part", I believe I know what error he is talking about, and it is answered about five times daily on the boards, but it could be the macro itself being stubborn.

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Sun Sep 12, 2004 11:42 am

ok, just tested it out on my rogue, renaming kick to backstab for the doabilities part (My beast is sorta, um, camped in a dumb spot.).


It caused no errors, but it doesn't do the ability, and it runs you and circles and over the target, and turns off autoattack. No matter how many times you turn it back on... it shuts it right back off.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sun Sep 12, 2004 11:53 am

What values are you passing to the macro on the command line? The only time it should be turning attack off is on enrage, when you have no target, and when the macro is outside of your 'fastrange'.

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Sun Sep 12, 2004 12:08 pm

5 15 12 is what I've always used, unless botting the rogue on a raid

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sun Sep 12, 2004 12:13 pm

edited didn't seem to matter when I tested it
Last edited by dman on Sun Sep 12, 2004 12:36 pm, edited 1 time in total.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sun Sep 12, 2004 12:30 pm

Hmm, just logged for the first time in a few weeks and the macro as I posted worked without a problem on my lvl 14 beastlord using the 5 15 12 parameters you gave. At the moment I can't figure out anything further without being able to reproduce it myself to help you :(

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Sun Sep 12, 2004 12:35 pm

I think it was just a glitch, can't get it to do it again. Going to do some more testing, but it looks like its fixed - thanks :)

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Sun Sep 12, 2004 1:04 pm

ok, i see why it wasn't doing the ability... it's /doability "Kick" not /doability Kick. Now, macro is working :)

EDIT:

changed

Code: Select all

/if (!${DoKick}) /return
to

Code: Select all

/if (${DoKick}== FALSE) /return
- now it will actually do the kick part.

Code: Select all

|bstlrd-assist.mac 
|Beastlord Melee assist macro. 
|version 1.1 by SephYaro 
|Chaged from 1.0: Removed disarm coding form macro 
|Original code taken from rogue-assist.mac written by Grimjack 
#Event Enraged "#*#has become ENRAGED#*#" 
#Event Offrage "#*#is no longer enraged#*#" 

Sub Main 
   /declare RangeMin int outer 
   /declare RangeMax int outer 
   /declare FastRange int outer 
   /declare Combatstatus bool outer 
   /declare CastTimer timer 
   /declare EnrageVar bool outer 
   /declare DoHeal bool outer 
   /declare HealThing string outer 
   /declare DoKick bool outer 
|-------------------------------------- 
|Edit this to change autoheal 
   /varset DoHeal FALSE 
   /varset HealThing "Light Healing" 
|Edit this to change auto kick 
   /varset DoKick TRUE 
|--------------------------------------- 
   /varset RangeMin ${Param0} 
   /varset RangeMax ${Param1} 
   /varset FastRange ${Param2} 
   /varset Combatstatus FALSE 
   /varset EnrageVar FALSE 
   :Mainloop 
   /call Combatcheck 
   /if (${Combatstatus}) /call RangeSub 
   /if (${Combatstatus}) /call Kickit 
   /if (!${Combatstatus}) /call Healthcheck 
   /doevents 
   /goto :Mainloop 
/return 


Sub Healthcheck 
   /if (!${DoHeal}) /return 
   /if (${Me.Casting.ID}) /return 
   /if (${Me.Moving}) /return 
   /if (${Me.PctHPs}<=90) { 
      /if (${Me.Combat}) { 
         /if (!${Target.ID}) { 
            /delay 5s 
            /cast "${HealThing}" 
         } 
      } 
   } 
/return 


Sub Kickit 
   /if (${DoKick}== FALSE) /return 
   /if (${Target.Distance}<=${RangeMax} && ${Me.AbilityReady[Kick]}) /doability "Kick" 
/return 

Sub Combatcheck 
   /if (${EnrageVar}) { 
      /if (${Target.ID}) { 
         /return 
      } else { 
         /varset EnrageVar FALSE 
         /varset Combatstatus FALSE 
      } 
   } 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /if (${Me.Combat}) { 
         /attack off 
      } 
      /return 

   } 
   /if (${Target.ID}) { 
      /if (${Me.Combat}) { 
         /varset Combatstatus TRUE 
         /return 
      } 
   } 
/varset Combatstatus FALSE 
/return 



Sub Rangesub 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>=${FastRange}) /call Fastmove 
   /if (${Target.Distance}>${RangeMax}) { 
      /keypress forward hold 
      /delay 5 (${Target.Distance}<=${RangeMax}) 
      /keypress forward 
   } 
   /if (${Target.Distance}<${RangeMin}) { 
      /keypress back hold 
      /delay 5 (${Target.Distance}>=${RangeMin}) 
      /keypress back 
   } 
/return 


Sub Event_Enraged 
   /if (${Target.ID}) { 
      /varset EnrageVar TRUE 
      /attack off 
   } 
/return 

Sub Fastmove 
   :fastmoveloop 
   /if (!${Target.ID}) { 
      /varset Combatstatus FALSE 
      /keypress forward 
      /if (${Me.Combat}) { 
         /attack off 
         /return 
      } 
   } 
   /stand 
   /face nolook fast 
   /if (${Target.Distance}>${FastRange}) { 
      /keypress forward hold 
      /delay 3 
      /attack off 
   } 
   /if  (${Target.Distance}<=${FastRange}) { 
         /if (${Combatstatus}) { 
            /if (!${EnrageVar}) { 
               /attack on 
            } 
         } 
      /keypress forward 
      /return 
   } 
   /goto :fastmoveloop 
/return 


Sub Event_Offrage 
   /if (${Target.ID}) { 
         /varset EnrageVar FALSE 
         /attack 
      } 
   } 
/return

hiipii
a ghoul
a ghoul
Posts: 93
Joined: Sat Jun 19, 2004 5:01 pm

Post by hiipii » Mon Sep 13, 2004 12:16 am

nevermind i'm a retard :(