WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   How to say the target health? (https://www.wowinterface.com/forums/showthread.php?t=59694)

Yukka 10-21-23 01:20 PM

How to say the target health?
 
Hello there :) I would like a macro that says "Target Name health: X%" so in the macro I write things like this: "%t health: " but I dont know what to write for the health %... can anyone please help? Thanks.

Fizzlemizz 10-21-23 02:09 PM

Something like:
Lua Code:
  1. /run if UnitExists("target") then local h,m = UnitHealth("target"),UnitHealthMax("target") print(format("%s's Health: %3.1f%%", UnitName("target"),(h/m)*100)) else print("No Target") end

Yukka 10-21-23 02:44 PM

Quote:

Originally Posted by Fizzlemizz (Post 342871)
Something like:
Lua Code:
  1. /run if UnitExists("target") then local h,m = UnitHealth("target"),UnitHealthMax("target") print(format("%s's Health: %3.1f%%", UnitName("target"),(h/m)*100)) else print("No Target") end

Nice, but how can I say that in the chat? /s for example.

Fizzlemizz 10-21-23 03:17 PM

Replace the print with SendChatMessage:
Lua Code:
  1. /run if UnitExists("target") then local h,m = UnitHealth("target"),UnitHealthMax("target") SendChatMessage(format("%s's Health: %3.1f%%", UnitName("target"),(h/m)*100), "SAY") else print("No Target") end

See the docs for restrictions on using SendChatMessage.

Yukka 10-21-23 04:31 PM

Thanks a lot :)


All times are GMT -6. The time now is 01:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI