rdrmdr wrote:Hi, I have some code really close to work but I'm stuck with the if the target is a player or a npc.
What I want is something like this:
- Code: Select all
/run If(UnitIsPlayer("target")) then
SendChatMessage(UnitName("target").." is a level "..UnitLevel("target").." "..UnitRace("target").." "..UnitClass("target").." player.")
Else
SendChatMessage(UnitName("target").." is a level "..UnitLevel("target").." NPC.")
End
...but that doesn't work.
Thanks for the help.
it actually does work, just make sure you're paying attention to lower / upper case words
- Code: Select all
/run u=UnitName l=UnitLevel if(UnitIsPlayer("target")) then ChatFrame1:AddMessage(u("target")..l("target").." "..UnitRace("target").." "..UnitClass("target").." p.")else ChatFrame1:AddMessage(u("target").." is a level "..l("target").." NPC.")end
works (just had to shorten it down a bit, you'll figure it out now I guess)
if end else
all have to be lower case only
- Code: Select all
/run if(UnitIsPlayer("target")) then SendChatMessage(UnitName("target").." is a level "..UnitLevel("target").." "..UnitRace("target").." "..UnitClass("target").." player.")else SendChatMessage(UnitName("target").." is a level "..UnitLevel("target").." NPC.")end
the original (now working) version