View Full Version : Add On Idea: Range to Melee auto-toggle
Hey Sarf, here's an idea for an AddOn, I dunno if the range detection thing works any longer, but I'd love to see an addon that automatically toggles me from auto shot to attack when a mob moves inside my mimimum range, maybe one that toggles it back to auto shot when it moves back out of range (or I move myself out of range)
so whatdoyathink?
nobody likes my idea? :shock:
It is possible to go from Auto-shoot to Melee, but not back.
Initiating attack mode is possible to do without being in a keybinding, casting a spell (which Autoshoot is) requires a key to be pressed.
Also, I have limited time right now (curse all professors and their reports!) which is why I didn't post anything. For some reason, if I say "Sounds reasonably simple to do" people seem to expect me to code it. :)
Sarf
---
BODY-SNATCHER, n. A robber of grave-worms. One who supplies the young physicians with that with which the old physicians have supplied the undertaker. The hyena.
hehe is auto shot a spell? it shows up in the book the same way as the attack thing and automatically triggers when you use an ability like arcane shot (a true spell) just like using a melee spell will auto trigger attack.
If I understood LUA coding well enough I'd do it myself, I can study up a bit, but it's still a little odd to me as the function declarations are different, there are some additional process available (~= ? wth is that? aproximately equal? hehe) and some things that I don't really understand like not needing to declair a type with a variable.
string LUA(bool learned)
{
if (learned == true) return 'w00t';
else
return 'sux0r';
}
Int Main()
{
while(LUA(learned) == 'sux0r' )
{
Study();
}
cout >> LUA(learned) >> endl >> LUA(learned) >> endl;
cout >> "ph3ar me!";
return 0;
}
hehe yes I know that was a complete waste of time, but I thought it was funny :) now to actually be productive and learn something.
If you can find me the script command to start auto-attacking, I could prolly whip up the addon.
Sarf
---
A printer consists of three main parts: the case, the jammed paper tray and the blinking red light.
Okay, the script functions I found relating to attack (of various sorts) were. Is that kind of what you were looking for?
AttackAction()
causes you to attack your target
IsAttackAction(indentifier);
returns boolean
PetAttack();
causes pet to attack target (this might be a good feature to be able to turn on or off, like have it attack with your pet when you tridder auto-shot)[/b]
Well, yes and no.
I want to have an AutoShoot(); function.
I think Auto Shoot is a spell, you see, and spells can ONLY be done from inside a key press.
Sarf
---
Make it so!
mshieh
12-14-2004, 01:56 AM
I'm fairly sure it's CastSpellByName("Auto Shot") but I don't have a hunter.
How do you check for range, by the way?
ah you see... you sid auto attack, I'l lsee what i can find out about uto shot.
You use the IsActionInRange and an action ID. So the autoshoot or the attack will have to be on an action bar (not necessarily visible though).
Sarf
---
Computers, like cats, can operate crossdimensionally; the trick is in getting them to do what you want.
Whisper
12-16-2004, 10:43 AM
Not sure if it help but it seem that you can put auto shoot and another spell in a macro
/cast Auto Shoot
/cast aspect of the monkey (rank x)
is working fine in a macro.
Hmmmmm... cool.
Sarf
---
If you try and don't succeed, cheat. Repeat until caught. Then lie.
Whisper
12-22-2004, 08:15 AM
Im trying to use IsActionInRange in a macro here what i have come up with so far:
/script if (IsActionInRange("73")) then CastSpellByName("auto shot"); else AttackTarget (); end
73= is the id of auto shot
At this point the macro wont work, no error message but it will always start Melee attack either if i am in range for auto shot or not.
What am i doing wrong?
"73" is a string, 73 is a number
use 73 instead.
Sarf
---
The shortest distance between two points is under construction.
Whisper
12-22-2004, 07:46 PM
i changed ("73") to (73) but it didnt do anything either just always start to melee attack.
Still testing it via trial and error (im not a programmer unfortunaty), if you see another mistake before i find it feel free to post.
Whisper
12-23-2004, 08:08 AM
Ok after a lot of trial i finally found how to do what i wanted
/script if (IsActionInRange(4)) == 1 then AttackTarget(); elseif (IsActionInRange(72)) == 1 then CastSpellByName ("Auto shot"); end
One thing i noticed and probly my biggest problem is that IsActionInRange wont check for button ID over 72. Since i was using ID 73 nothing was working until i decided to try on lower ID.
Could someone care to explain me why it wont check button ID over 72?
Anonymous
12-24-2004, 05:10 AM
/script CastSpellByName('Auto Shot()')
Works fine as a macro.
You could make it a one key macro.
Put this macro in slot # 1 on both pages 1 and 2.
Place your ranged abilities on page 2, slots 2 - + and melee abilities on page 1, slots 2 - +.
MACRO BELOW
-- Range check and change to range bar
if (IsActionInRange(73)) then;
/script CastSpellByName('Auto Shot()');
/script CURRENT_ACTIONBAR_PAGE = 2;
/script ChangeActionBarPage();
/script PetAttack();
else;
-- Melee if not ranged and change to melee bar.
/script CastSpellByName('Aspect of the Monkey()');
/script AttackAction();
/script CURRENT_ACTIONBAR_PAGE = 1;
/script ChangeActionBarPage();
end
-- Could add Aspect of the Hawk(Rank X) in here, but don't know
-- how to put a wait in for the spell cast delay.
:?:
Ghavon
12-24-2004, 05:15 AM
/script CastSpellByName('Auto Shot()')
Works fine as a macro.
You could make it a one key macro.
Put this macro in slot # 1 on both pages 1 and 2.
Place your ranged abilities on page 2, slots 2 - + and melee abilities on page 1, slots 2 - +.
MACRO BELOW
-- Range check and change to range bar
if (IsActionInRange(73)) then;
/script CastSpellByName('Auto Shot()');
/script CURRENT_ACTIONBAR_PAGE = 2;
/script ChangeActionBarPage();
/script PetAttack();
else;
-- Melee if not ranged and change to melee bar.
/script CastSpellByName('Aspect of the Monkey()');
/script AttackAction();
/script CURRENT_ACTIONBAR_PAGE = 1;
/script ChangeActionBarPage();
end
-- Could add Aspect of the Hawk(Rank X) in here, but don't know
-- how to put a wait in for the spell cast delay.
Ghavon
12-24-2004, 05:17 AM
/script CastSpellByName('Auto Shot()')
Works fine as a macro.
You could make it a one key macro.
Put this macro in slot # 1 on both pages 1 and 2.
Place your ranged abilities on page 2, slots 2 - + and melee abilities on page 1, slots 2 - +.
MACRO BELOW
-- Range check and change to range bar
if (IsActionInRange(73)) then;
/script CastSpellByName('Auto Shot()');
/script CURRENT_ACTIONBAR_PAGE = 2;
/script ChangeActionBarPage();
/script PetAttack();
else;
-- Melee if not ranged and change to melee bar.
/script CastSpellByName('Aspect of the Monkey()');
/script AttackAction();
/script CURRENT_ACTIONBAR_PAGE = 1;
/script ChangeActionBarPage();
end
-- Could add Aspect of the Hawk(Rank X) in here, but don't know
-- how to put a wait in for the spell cast delay.
Whisper
12-24-2004, 10:37 AM
-- Could add Aspect of the Hawk(Rank X) in here, but don't know
-- how to put a wait in for the spell cast delay.
Rewrote your macro and made some change to it (256 character woot!):
/script if (IsActionInRange(XX)) == 1 then CastSpellByName("Auto Shot"); CastSpellByName("Aspect of the Hawk(rank x)"); PetAttack(); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); PetAttack(); end
This should be typed as one line
XX = action id for auto shot (different from player to player)
X= Range page (different from player to player)
x= rank level (use highest level)
YY = action id for Scarebeast
This macro will switch to Aspect of the hawk, start auto shooting, send pet and change the action back if the target is between 8-35 yard.
If its not in range for auto shooting it will check if your target is in melee range or close to melee range (0-8 yard). If it is it will toggle Attack on/off.
Personally i would take out the part in italic since i dont want my pet to always attack the same thing as me.
well that works sure enough... there's got to be some way to clean it up though so it can automatically detect the level of the spells, action id, etc... but sarf would know more about that than I
Yes, you could do that by having OHW installed.
Would you mind if I used this in OneHitWonder?
Sarf
---
Money can't buy happiness, but it can buy enough guns to make sure nobody else can have any either.
Whisper
12-27-2004, 08:51 AM
Sure you can.
if (IsActionInRange(XX)) == 1 then if (IsCurrentAction(XX)) == 1 then SpellStopCasting("auto shot"); else CastSpellByName("Auto Shot"); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); CastSpellByName("Aspect of the Monkey"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end end
That is what the range to melee code should look like. I am not too sure if IsCurrentAction is the good function to use in this case or if the syntax is correct (did not test it yet). But you get the idea
if (IsActionInRange(XX)) == 1 then CastSpellByName("Auto Shot"); CastSpellByName("Aspect of the Hawk(rank x)"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); else CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end
Changed the code for melee to range. It will now toggle to range if the target is over 35 yard.
Suggestion: make a check to see wich aspect is on before casting it to not recast a buff you already have.
Also a little explaination on how some hunter spell work:
Auto shot: When casted it will not trigger the global cooldown and is instant cast. That mean that you can cast Auto shot followed by another spell in a macro or a in script. But not vice versa, since the global cooldown of the other spell will prevent auto shot from being cast. I am not sure if there is other way to turn Auto Shot off but SpellStopCasting work ie:
/cast Arcane Shot(Rank 1)
/script SpellStopCasting ("Auto Shot")
That will cancel the automatic Auto shot after using arcane shot.
Melee spell: When you mouse over you melee spell (Wing clip, disengage...) you see a range of 9 yard. However the true range of those abilitie is around 4 yard. That mean that you cannot use melee abilitie to efficiently check the range of the target since there will be an uncovered zone (4-8 yard range). Use Scare beast instead (10 yard range)
Whisper
12-27-2004, 08:52 AM
Sure you can.
if (IsActionInRange(XX)) == 1 then if (IsCurrentAction(XX)) == 1 then SpellStopCasting("auto shot"); else CastSpellByName("Auto Shot"); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); CastSpellByName("Aspect of the Monkey"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end end
That is what the range to melee code should look like. I am not too sure if IsCurrentAction is the good function to use in this case or if the syntax is correct (did not test it yet). But you get the idea
if (IsActionInRange(XX)) == 1 then CastSpellByName("Auto Shot"); CastSpellByName("Aspect of the Hawk(rank x)"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); else CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end
Changed the code for melee to range. It will now toggle to range if the target is over 35 yard.
Suggestion: make a check to see wich aspect is on before casting it to not recast a buff you already have.
Also a little explaination on how some hunter spell work:
Auto shot: When casted it will not trigger the global cooldown and is instant cast. That mean that you can cast Auto shot followed by another spell in a macro or a in script. But not vice versa, since the global cooldown of the other spell will prevent auto shot from being cast. I am not sure if there is other way to turn Auto Shot off but SpellStopCasting work ie:
/cast Arcane Shot(Rank 1)
/script SpellStopCasting ("Auto Shot")
That will cancel the automatic Auto shot after using arcane shot.
Melee spell: When you mouse over you melee spell (Wing clip, disengage...) you see a range of 9 yard. However the true range of those abilitie is around 4 yard. That mean that you cannot use melee abilitie to efficiently check the range of the target since there will be an uncovered zone (4-8 yard range). Use Scare beast instead (10 yard range)
Whisper
12-27-2004, 09:14 AM
Sure you can.
if (IsActionInRange(XX)) == 1 then if (IsCurrentAction(XX)) == 1 then SpellStopCasting("auto shot"); else CastSpellByName("Auto Shot"); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); CastSpellByName("Aspect of the Monkey"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end end
That is what the range to melee code should look like. I am not too sure if IsCurrentAction is the good function to use in this case or if the syntax is correct (did not test it yet). But you get the idea
if (IsActionInRange(XX)) == 1 then CastSpellByName("Auto Shot"); CastSpellByName("Aspect of the Hawk(rank x)"); CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); elseif (IsActionInRange(YY)) == 1 then AttackTarget(); else CURRENT_ACTIONBAR_PAGE = X; ChangeActionBarPage(); end
Changed the code for melee to range. It will now toggle to range if the target is over 35 yard.
Suggestion: make a check to see wich aspect is on before casting it to not recast a buff you already have.
Also a little explaination on how some hunter spell work:
Auto shot: When casted it will not trigger the global cooldown and is instant cast. That mean that you can cast Auto shot followed by another spell in a macro or a in script. But not vice versa, since the global cooldown of the other spell will prevent auto shot from being cast. I am not sure if there is other way to turn Auto Shot off but SpellStopCasting work ie:
/cast Arcane Shot(Rank 1)
/script SpellStopCasting ("Auto Shot")
That will cancel the automatic Auto shot after using arcane shot.
Melee spell: When you mouse over you melee spell (Wing clip, disengage...) you see a range of 9 yard. However the true range of those abilitie is around 4 yard. That mean that you cannot use melee abilitie to efficiently check the range of the target since there will be an uncovered zone (4-8 yard range). Use Scare beast instead (10 yard range)
Wewpt
01-11-2005, 09:42 PM
This might be a bit off topic, if so I apologize in advance.
I can see another use for this, but I do not like the idea of having to put specific items in specific spots, specific buttons here and there etc. Anyways if that's the only way to do it then I'll live with it.
One of my chars is a Rogue and I'd like to be able to switch weapons (i.e. two daggers for two 1-handed swords) back and forth with a single keypress. I take it this could be adapted to work with the macro you're all writing here?
I mean, even tackle box swaps like that right, only difference being I want to replace 2 specific weapons with 2 other specific weapons rather than 2 specific weapons with fishing pole.
Wewpt
01-11-2005, 09:42 PM
This might be a bit off topic, if so I apologize in advance.
I can see another use for this, but I do not like the idea of having to put specific items in specific spots, specific buttons here and there etc. Anyways if that's the only way to do it then I'll live with it.
One of my chars is a Rogue and I'd like to be able to switch weapons (i.e. two daggers for two 1-handed swords) back and forth with a single keypress. I take it this could be adapted to work with the macro you're all writing here?
I mean, even tackle box swaps like that right, only difference being I want to replace 2 specific weapons with 2 other specific weapons rather than 2 specific weapons with fishing pole.
Wewpt
01-11-2005, 09:43 PM
This might be a bit off topic, if so I apologize in advance.
I can see another use for this, but I do not like the idea of having to put specific items in specific spots, specific buttons here and there etc. Anyways if that's the only way to do it then I'll live with it.
One of my chars is a Rogue and I'd like to be able to switch weapons (i.e. two daggers for two 1-handed swords) back and forth with a single keypress. I take it this could be adapted to work with the macro you're all writing here?
I mean, even tackle box swaps like that right, only difference being I want to replace 2 specific weapons with 2 other specific weapons rather than 2 specific weapons with fishing pole.
Anonymous
01-31-2005, 05:28 AM
I'm consufed... which one of these is the one I should go with?
JacobsLight
01-31-2005, 06:06 PM
One of my chars is a Rogue and I'd like to be able to switch weapons (i.e. two daggers for two 1-handed swords) back and forth with a single keypress. I take it this could be adapted to work with the macro you're all writing here?
.
I do this now !! What I use is called .. weapon sets. I tried the quick swap, didn't like it.
With this one .. I have a hot key set up, it changes both weapons out, for 2 diffrent weapons .. and it uses the name of the weapons .. no bag slot assignments. You cna have 3 or 4 (or more) diffrent set-up's. Each time you hit the hot key, it switches to the next one down the list (for the sheild bearers out there).
I got it off the WOW forums. do a search for weapon set.
JacobsLight
Anonymous
02-01-2005, 03:03 AM
Hey Sarf, here's an idea for an AddOn, I dunno if the range detection thing works any longer, but I'd love to see an addon that automatically toggles me from auto shot to attack when a mob moves inside my mimimum range, maybe one that toggles it back to auto shot when it moves back out of range (or I move myself out of range)
so whatdoyathink?
The "DefendYourself" Addon will auto switch you from autoshot to attack when a mod comes in close, but you have to manually switch back to autoshot when you get far away again.
DefendYourself:
http://www.cosmosui.com/forums/viewtopic.php?t=4968
Anonymous
02-02-2005, 02:53 PM
So did you guys find out a way to go from range to melee and back again? If so, that would be useful in DefendYourself to complete that part.
My current issue is with detecting when you have moved out of melee range with a low level hunter. :(
Sarf
---
When Cthulhu calls, he calls collect.
Anonymous
02-05-2005, 05:39 PM
Why specifically a "low level" hunter?
Because there is no melee ability that has a range attached to it - autoattack does not get "red" when you are out of range, nor does the extra-damage melee attack.
Sarf
---
Vee off ze KGB are not ez slow ez you tink, komrade.
Anonymous
02-08-2005, 05:46 PM
I guess you could always just say that hunters without the Wing Clip ability cannot use that part of the mod. When you're that low of a level anyway, you don't go back to ranged from melee.
Whisper
02-09-2005, 04:48 PM
Unfortunatly wing clip isnt good enough.
Wing clip is 5 yard range (Tooltip says 9 but its lieing)
Auto shot is 8-35 yard range
That leave 3 uncovered yard.
Using those 2 spell the add on will not see the difference when your target is 5-8 yard from you or over 35 yard.
To get around that you need to use the spell Scare beast (10 yard range)
If in range for Auto shot = ranged mode (8-35)
If in range for scare beast and not in range for Auto shot = melee or close to melee mode (0-8 yard)
If not in range for Auto shot and not in range for scare beast = Too far (Over 35)
I guess you could always just say that hunters without the Wing Clip ability cannot use that part of the mod. When you're that low of a level anyway, you don't go back to ranged from melee.
I agree with barbarik on this, release it and make a note saying it wont work on hunter below lvl 14. That what? 6-7 hour of gameplay max? ;p
Done in my SVN. Will probably not be released until after I can verify it myself.
Sarf
---
Earn cash in your spare time, blackmail your friends.
Anonymous
03-02-2005, 06:01 PM
You can gain some functionality on this line using Flexbar, which can detect whether you are 'in range' for abilities and remap your bars appropriately...
i.e., When you're in autoshoot range, it will remap your 1-12 buttons to have your ranged attacks, and then when you're in melee range, it will remap your same 1-12 butons to have melee attacks. I find it saves tremendously on screen space and button mappings. Much configuration required, though.
morbid_o
07-20-2005, 04:01 PM
ah you see... you sid auto attack, I'l lsee what i can find out about uto shot.
is it not AttackTarget() ?
You may be trying to hard. I mean really, pressing one extra button isnt that hard.
If youre concerened about the amount of room you have on your bar, i suggest searching around for the 'ranged-melee' mod, it automatically switches bars (your preference) when you enter melee range, and back again when you exit melee range.
vBulletin® v3.8.0 Beta 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.