Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-25-16, 02:09 PM   #1
NeXxUSA
A Murloc Raider
Join Date: Jan 2016
Posts: 8
SayHealth Addon -- Code Help

Hello, I need some help. This code doesn't work. As far as what it's supposed to do that is documented function by function below, as well as a general overview in the final comment. Please help me fix this. This is my first addon I'm going to see through to the end, as I scrapped my last one due to it being too advanced.
Code:
Lua Code:
  1. --Check if right alt key is down. If true returns 1.
  2. local function altDown()
  3.     local isDown = IsRightAltKeyDown()
  4.     return isDown
  5. end
  6. --Get current health
  7. local function getHealth()
  8.     local cHealth = UnitHealth("player")
  9.     return cHealth
  10. end
  11. --Get max health
  12. local function getMHealth()
  13.     local mHealth = UnitMaxHealth("player")
  14.     return mHealth
  15. end
  16. --All functions have bee declared
  17.  
  18. --If the function altDown returns 1, say current health over max health. Else, end.
  19. if altDown() == 1
  20.             then SendChatMessage(getHealth() .. "/" .. getMHealth())
  21.             else
  22. end
  23. --Purpose of the addon is to say "health/max" in /say chat when you press right alt.
Thanks!

Last edited by NeXxUSA : 01-25-16 at 02:18 PM. Reason: Name Change
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Say Health


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off