Thursday, April 12, 2012

Macro problem

[:1]I try write macro :

must check :

if target in range then next step

in target in no range then stopmacro



Pls help|||Eh, what's the next step?

What are you trying to do with this macro?|||If target no in range then stopmacro .. range in yards|||You can't really check range in a macro. You certainly can't cast spells based on a range check.

The most you can do is check if you are in range to use a spell in a script, but scripts are very limited in what you can do. (For example, you can't cast a spell from a script, but you can use chat functions.)

I don't think there is any way to check for a specific number of yards at all. You'd have to base the distance on a spell.

So, while I can set up a macro to pain suppression someone, and I can add a script to whisper them that only whispers them if they are in range of the spell, I can't have it cast another spell instead if I'm out of range.

Perhaps if you were more specific with what you wanted to do, we could be a bit more helpful.|||I have macro(script) :

/script if (((UnitName("target") ~= nil) and (UnitIsPlayer("target")))) then SendChatMessage("bla bla - Innervate", "WHISPER", "ORCISH", UnitName("target") ); end

/cast Innervate

I want make, when i dont have target in innervate range then not whisper

And i want add here second message on /s or /raid|||This is the macro I use for Pain Suppression. It checks for range and cooldown before it sends the whisper:

/script local u,ps,c="mouseover","Pain Suppression",GetNumRaidMembers()>0 and "RAID" or "PARTY";if IsSpellInRange(ps,u)==1 and GetSpellCooldown(ps)==0 then SendChatMessage(ps.." on "..UnitName(u),c) end

/cast [@mouseover] Pain Suppression



The macro sends the message to party chat if in a party and raid chat if in a raid. (If I'm not in a group, I just get a "not in a party" error.) This is obviously set up as a mouseover macro, but the basics should be the same for casting on a target.

I'm a bit pressed for time at the moment, so I won't have time for probably a few days to mess around and get exactly what you are looking for, but I wanted to post that up since it might help give you some ideas to get what you need.

The main issue I can see you running in to is the character limit on macros. That pain suppression macro gets close to the limit, and it doesn't inlcude the whisper. (The reason it uses so many variable is to save on characters so that it will fit.) Other than that, though, what you want to do should be possible, and is allowed by the Blizzard API. It's just a matter of making it fit in 255 characters.

No comments:

Post a Comment