Ability used check?

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

cal_zero
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Mar 14, 2004 12:23 pm

Ability used check?

Post by cal_zero » Sat Apr 03, 2004 12:26 am

Having trouble finding the correct syntax to use to get back if an ability is ready to be used or is down. Readme examples

$char(ability,mend)

This according to the Readme would return if the ability Mend was ready to use again or if you even had that skill but all I get back is what combatability it is set to.

Has there been a change in a way to check if an ability is ready to use or is still in reset state. I checked through different macros and seems all current macros dont use anykind of time and dont have a check for it. So wondering if its just overlooked or was phased out.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

RTFM

Post by Imperfect » Sat Apr 03, 2004 12:56 am

Code: Select all

$char(option [,"param")
ability,"ability name" Returns what /doability # you have a skill set to
ability,# Returns the ability name in a specific /doability slot
Can also return:
 0: Skill not on an ability button
-1: You do not have that skill
-2: The ability is on a button but unusable right now
feeling nice today.

Code: Select all

/if n $char(ability,"Flying Kick")>0 /echo this ability is set to doability # $char(ability,"Flying Kick")

/if n $char(ability,"Flying Kick")>-1 /doability "Flying Kick"
/if n $char(ability,"Flying Kick")==0 /echo I have this skill however it is not assigned to a /doability button
/if n $char(ability,"Flying Kick")==-1 /echo You don't have this skill.
/if n $char(ability,"Flying Kick")==-2 /echo This is not ready to be used just yet.
Last edited by Imperfect on Sat Apr 03, 2004 10:39 pm, edited 1 time in total.

cal_zero
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Mar 14, 2004 12:23 pm

Post by cal_zero » Sat Apr 03, 2004 1:10 am

Thanks for the quick reply, however this is the code I have been using and it does not give the 0, -1, -2 response it only relays what combatability key the ability is currently bound to.

Currently Mend (the skill I am playing with is in combatability 7 slot, so when I /echo $char(ability,"mend") I get a response of 7 even if the skill is currently down.

If I use a skill I dont have or one I dont have bound to a combatability key I can force a response for 0 and -1 but its the -2 that I am looking for.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Sat Apr 03, 2004 2:38 am

Well thats not good.

cal_zero
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Mar 14, 2004 12:23 pm

Post by cal_zero » Sat Apr 03, 2004 7:55 am

I ended up just setting a timer for it but would be cool to see this working again. Like I said I went thru several current macros and could not fine where the true -2 variable response was used as a check. Everyone seemed to just go with /doability and I guess hope it was there and ready. I also was trying to use this writting a macro for a guild friend that always tends to die to Enrage mobs as a rogue and was looking for the ability check to setup backstab, hide, and escape options with out having to set timers for them. As it is now I am just running a count down timer and if its 0 then the char will try to use the ability. This runs into huge problems when trying to sync it with the char current haste %. The one I am working on I am just setting input values for if the char is at 41% haste up to bard exceed cap haste. And then doing an Evade action if the backstab sub acually goes off. Will post it when I get it finished its really my first macro from scratch so want to work the kinks out before I post it here for everyone to nit pick it.

Thanks for the help btw thought maybe I was going nuts, hell maybe I am.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Sat Apr 03, 2004 8:13 am

cal_zero wrote:I ended up just setting a timer for it but would be cool to see this working again. Like I said I went thru several current macros and could not fine where the true -2 variable response was used as a check. Everyone seemed to just go with /doability and I guess hope it was there and ready. I also was trying to use this writting a macro for a guild friend that always tends to die to Enrage mobs as a rogue and was looking for the ability check to setup backstab, hide, and escape options with out having to set timers for them. As it is now I am just running a count down timer and if its 0 then the char will try to use the ability. This runs into huge problems when trying to sync it with the char current haste %. The one I am working on I am just setting input values for if the char is at 41% haste up to bard exceed cap haste. And then doing an Evade action if the backstab sub acually goes off. Will post it when I get it finished its really my first macro from scratch so want to work the kinks out before I post it here for everyone to nit pick it.

Thanks for the help btw thought maybe I was going nuts, hell maybe I am.
You are and you're not ;)

There are certain combat abilities which are hosed, Backstab, Frenzy, Flying Kick, Bash, etc when it comes to $char(ability,xxx). Been posted on the bug forum though as a dev pointed out to me at one point, it's not that big of a deal.

Options like sneak, hide, work great.

You'll normally see the check as something like:

Code: Select all

/if n $char(ability,hide)>0 /doability hide
over in the depot. Seen >=1 too, either works.

As for evade, mash it every time it comes up, it's on a different cycle time than backstab and why waste the deagro chance?

The timer for various haste values would be nifty, something I've been meaning to do and never have... I'd love to see it if you get it working.

G

cal_zero
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Mar 14, 2004 12:23 pm

Post by cal_zero » Sat Apr 03, 2004 8:59 am

Why waste the deaggro, well if I can sync player haste with backstab refresh in the macro I can get the maximum amount of backstabs possible, if my loop is in the middle of say an evade sub when my backstab becomes active I just missed out on a couple sec of refresh time for another backstab. Only time evade really needs to be used is if 1 the char has aggro or 2 a large backstab. I settled for just after the backstab cycle completes.

As far as using

Code: Select all

/if n $char(ability,"hide")>0 /doability "hide"
your still going to get incorrect information with the way the current output is. The only thing this code is checking is if you have hte skill on an combat ability key. So at a key time when I need the evade its may not be avalible.

I know I am nit picking at something that really doesnt matter but if I am going to write it might as well do it to the best of my ability. But if you look at it this way

Code: Select all

/if n $char(ability,"hide")==1 /doability "hide"
if you had hide assisgned to combatability key 2 you would get a NULL from this expression.

Anyway this is what I ended up with have fun picking over it and let me know what you think. I stil would like to add $char(hp) checks and escape call if health drops below x% or x% of your guild/raid is dead.

Code: Select all




|------------------------------------------------
|Cal_zero Backstab.mac                                                                                               
|	BackStab/Evade Macro usage /macro backstab.mac <Haste> <EvadeTime>
|	 0 = No Haste
|	 1 = 41%
|	 2 = 70%
|	 3 = Max Haste
|	 4 = Unlimited BS does not check time sparatic.
|	 EvadeTime = How long you want to hide after an Evade attempt Default 10 = 1 second 
|	 You must have an NPC targeted, attack on, be in melee range, and behind the mob for BackStab to go off.
|	 Macro will try to Evade after Backstab if Hide is avalible.
|	 Macro will also check for ENRAGED while facing you and try to save you.
|	 Macro will re-engage mob if mob is no longer enraged or if he just turns away from you.
|	 Manually turning auto attack off will pause the Macro until you turn attack on again.
|	 
|-------------------------------------------------


#turbo 300
#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 
#Event AutoattackON "Auto attack is on."
#Event AutoattackOFF "Auto attack is off."




Sub Main
/zapvars
/declare checktarget global
/declare attacktarget global
/declare backstabtimer timer
/declare hidetimer timer
/declare roguehaste global
/declare hasteinput global
/declare mobenrage global
/declare hidedelay global
/declare ragecatch global

/varset checktarget 0
/varset attacktarget 0
/varset backstabtimer 0
/varset hidetimer 0
/varset hasteinput @Param0
/varset mobenrage 0
/varset hidedelay @Param1
/varset ragecatch 0

	
/call backstabspeed
	/echo /Macro Backstab.mac /help for usage and info about this macro.
	/echo Backstab Macro running at speed @hasteinput/4
	/if n @hasteinput==4 /echo For Evade control when Backstab goes off please set it to your current Haste.
	/if n @hidedelay>=10 /echo You will Pause for $left(1,"@hidedelay").$right(1,"@hidedelay") second(s) after every Evade attempt.
	/if n @hidedelay<10 /echo You will Pause for 0.@hidedelay tenth's of a second after every Evade attempt.
	



:meleeloop
	
	/doevents
	/if n @attacktarget==0 /goto :meleeloop	
	
	/call targetcheck	
	/if n @checktarget==0 /goto :meleeloop
	
	
                /if @mobenrage==1 /call mobenrage
		
	/doevents
	/call pokeit
	/goto :meleeloop	

/return





Sub targetcheck
		/if $target()==FALSE {
                                /varset checktarget 0
		/attack off
		/varset attacktarget 0
		/return
                                }
		/if $target(type)==NPC /varset checktarget 1
/return

Sub mobenrage
		/if @attacktarget==0 /return
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))<100 /attack on
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))<100 /varset ragecatch 0
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))<=100 /return
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))>100 /attack off
		/if n @ragecatch==1 /return
		/if n @hidetimer==0 /doability hide
		/echo Attack was turned off for your protection!
		/varset ragecatch 1
/return

Sub pokeit
		/if n @backstabtimer>0 /return
		/if $target(distance,predict)>$target(maxrange) /return
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))>80 /return
		/if n $abs($calc($calc(360-$target(heading))-$calc(360-$char(heading))))<80 /doability backstab
		/varadd backstabtimer @roguehaste
		/if n @hidetimer==0 /call evade
		/doevents		
/return


Sub evade
	/attack off
	/doability hide
	/doevents
	/delay @hidedelay
	/attack on
	/if n @hidetimer==0 /varadd hidetimer 75
/return

Sub backstabspeed
	/if @hasteinput==/help /call help
	/if @hasteinput>=4 /varset roguehaste 0
	/if @hasteinput==3 /varset roguehaste 50	
	/if @hasteinput==2 /varset roguehaste 60
	/if @hasteinput==1 /varset roguehaste 70
	/if @hasteinput==0 /varset roguehaste 90
	/if @hasteinput==*Param0 /varset roguehaste 90
	/if @hidedelay==*Param1 /varset hidedelay 50
	/if @roguehaste==90 /varset hasteinput 0
/return


	
Sub help
	/echo Cal_zero BackStab/Evade Macro usage /macro backstab.mac <Haste> <EvadeTime>
	/echo 0 = No Haste
	/echo 1 = 41%
	/echo 2 = 70%
	/echo 3 = Max Haste
	/echo 4 = Unlimited BS does not check time sparatic.
	/echo EvadeTime = How long you want to hide after an Evade attempt Default 10 = 1 second 
	/echo You must have an NPC targeted, attack on, be in melee range, and behind the mob for BackStab to go off.
	/echo Macro will try to Evade after Backstab if Hide is avalible.
	/echo Macro will also check for ENRAGED while facing you and try to save you.
	/echo Macro will re-engage mob if mob is no longer enraged or if he just turns away from you.
	/echo Manually turning auto attack off will pause the Macro until you turn attack on again.
	/endmacro
/return




Sub Event_Enraged 
	/varset mobenrage 1
/return 

Sub Event_Offrage 
	/varset mobenrage 0
	/if @attacktarget==1 /attack on
/return 

Sub Event_AutoattackON
	/varset attacktarget 1
/return

Sub Event_AutoattackOFF
	/varset attacktarget 0
/return


	
Last edited by cal_zero on Sat Apr 03, 2004 7:37 pm, edited 1 time in total.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Sat Apr 03, 2004 11:59 am

I play a rogue and AFAIK evade moves you a fixed amount down the hate list. Also, script execution speeds under any value of #turbo you're quibbling over 10ths of seconds if not less honestly.
cal_zero wrote:As far as using

Code: Select all

/if n $char(ability,"hide")>0 /doability "hide"
your still going to get incorrect information with the way the current output is. The only thing this code is checking is if you have hte skill on an combat ability key. So at a key time when I need the evade its may not be avalible.

I know I am nit picking at something that really doesnt matter but if I am going to write it might as well do it to the best of my ability. But if you look at it this way

Code: Select all

/if n $char(ability,"hide")==1 /doability "hide"
if you had hide assisgned to combatability key 2 you would get a NULL from this expression.
Heh, not to beat a dead horse but I've coded, and re-coded a rogue script for my own toon. The check I posted and you quoted *works*. As for your second snippet (==1), well yeah, which is why I stated earlier use either >0 or =>1 :). For giggles I checked it under the 3/31 zip code and it still functions as intended, -2 if used/notavailable, 0 if not setup, 1-6 if on a hotkey. Hence >0 or >=1 working regardless of what ability button the toon's UI has Hide on.

Your evade sub should simply be:

Code: Select all

Sub evade
   /attack off
   /doability hide
   /attack on
/return
The delay you have in there is throwing DPS on the floor. No need for /doevents there either, it's a get in and get out sub, processes so quickly that it's not needed especially with the number of /doevents in your main loop.

There's nitpicky stuff as you put it, in your melee loop you can do a

Code: Select all

/if n @mobenrage==1 /call mobenrage
and save yourself the extraneous subroutine call unless it's needed.

Checktarget nest the /attack off /varset etc into a single /if with {} rather than making the 3 comparisons.

If you use turbo, make certain to put a /delay x inbetween your /doevents and your loop... not doing so and ninja executing /doevents is a good way to tie up the system resources in my experience and hang your EQ client. Could free up some of those /doevents too, especially if you use $combat and dump the attacktarget variable but that's coding preference really ;).

Not much else I can offer in terms of advice at a glance without functional testing it.

G

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Sat Apr 03, 2004 2:15 pm

I just checked and mend returns the proper value of -2 when it is not ready to be used. Maybe you should try a recompile. I am pretty sure I don't have anything special that makes mine function and yours doesn't.

apollo5145
orc pawn
orc pawn
Posts: 26
Joined: Wed Feb 25, 2004 8:14 pm

Post by apollo5145 » Sat Apr 03, 2004 2:49 pm

Is there any way to check how long is left on combat abilities? Bers ones are on a 12sec reuse, would be nice to add them into mac's w/o spamming the chat window.

cal_zero
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Mar 14, 2004 12:23 pm

Post by cal_zero » Sat Apr 03, 2004 6:31 pm

Thanks for the input everyone. I have already revised in the changes you guys suggested in my own version. Will recompile and check what I get again. It may be the release I have as well, I checked the code on a second comp using the same release and was unable to get a -2 response.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Sun Apr 04, 2004 12:10 am

Something I didn't think of before but, if it is the ability is not on one of the traditional hotkeys but you will always get a value of 0.

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Sun Apr 04, 2004 11:09 am

apollo5145 wrote:Is there any way to check how long is left on combat abilities? Bers ones are on a 12sec reuse, would be nice to add them into mac's w/o spamming the chat window.
For discs you need to use a timer if you don't want you window to be spammed.