WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Need help with WA2 script for mana percentage (https://www.wowinterface.com/forums/showthread.php?t=56410)

Kenjub 07-22-18 09:47 AM

Need help with WA2 script for mana percentage
 
Hi! This worked fine pre 8.0, but as of 8.0 it just doesn't display anything:

Code:

function()
    local percent = (UnitMana("player")/UnitManaMax("player"))*100
    return floor(percent+0.5).."%"
end

what's wrong? Thanks!

Ammako 07-22-18 10:58 AM

https://www.townlong-yak.com/framexm..._7_2_0.lua#172

Seerah 07-22-18 04:30 PM

What Ammako is saying is that those functions have been deprecated for some time and were finally removed. Now you have to use their replacements.

Kenjub 09-16-18 05:58 AM

Undestood it from his reply but thanks :) (forgot to reply originally)

However what I need is alternate power percentage (in this case, Shadowpriest mana bar that shows below insanity bar). Any suggestions?

Kanegasi 09-16-18 09:39 AM

The Enum.PowerType.Mana shown in the linked code is a number. Here’s the full table:

Lua Code:
  1. Enum = {
  2.     PowerType = {
  3.         Alternate = 10,
  4.         ArcaneCharges = 16,
  5.         Chi = 12,
  6.         ComboPoints = 4,
  7.         Energy = 3,
  8.         Focus = 2,
  9.         Fury = 17,
  10.         HealthCost = -2,
  11.         HolyPower = 9,
  12.         Insanity = 13,
  13.         LunarPower = 8,
  14.         Maelstrom = 11,
  15.         Mana = 0,
  16.         None = -1,
  17.         NumPowerTypes = 19,
  18.         Obsolete = 14,
  19.         Obsolete2 = 15,
  20.         Pain = 18,
  21.         Rage = 1,
  22.         Runes = 5,
  23.         RunicPower = 6,
  24.         SoulShards = 7,
  25.     },
  26. }

Kenjub 10-02-18 06:27 PM

Quote:

Originally Posted by Kanegasi (Post 330122)
The Enum.PowerType.Mana shown in the linked code is a number. Here’s the full table:

Lua Code:
  1. Enum = {
  2.     PowerType = {
  3.         Alternate = 10,
  4.         ArcaneCharges = 16,
  5.         Chi = 12,
  6.         ComboPoints = 4,
  7.         Energy = 3,
  8.         Focus = 2,
  9.         Fury = 17,
  10.         HealthCost = -2,
  11.         HolyPower = 9,
  12.         Insanity = 13,
  13.         LunarPower = 8,
  14.         Maelstrom = 11,
  15.         Mana = 0,
  16.         None = -1,
  17.         NumPowerTypes = 19,
  18.         Obsolete = 14,
  19.         Obsolete2 = 15,
  20.         Pain = 18,
  21.         Rage = 1,
  22.         Runes = 5,
  23.         RunicPower = 6,
  24.         SoulShards = 7,
  25.     },
  26. }

Thanks for the list but I'm a bit lost on how to incorporate it into my current code snippet.

The following shows the current main power amount, I need it to show alternate power percentage (in my case, mana) :
Code:

function()
    local percent = (UnitPower("player")/UnitPowerMax("player"))*100
    return floor(percent+0.5)..""
end


Kanegasi 10-02-18 08:10 PM

As the linked code above shows, UnitPower has two arguments: unit and type. Type is a number and is one of the numbers I posted above.

Usage: UnitPower(unit,type)

This returns player mana: UnitPower("player",0)

This returns player insanity: UnitPower("player",13)

This returns max player mana: UnitPowerMax("player",0)

This returns max player insanity: UnitPowerMax("player",13)

Kenjub 10-02-18 09:11 PM

I get it now, holy hell am I dense :|

Thanks for the help! :)

Fizzlemizz 10-02-18 09:55 PM

And if you don't want to remember what number is what power you can instead use:

Code:

Enum.PowerType.Mana
Enum.PowerType.Rage
Enum.PowerType.Focus
Enum.PowerType.Energy
Enum.PowerType.ComboPoints
Enum.PowerType.Runes
Enum.PowerType.RunicPower
Enum.PowerType.SoulShards
Enum.PowerType.LunarPower
Enum.PowerType.HolyPower
Enum.PowerType.Maelstrom
Enum.PowerType.Chi
Enum.PowerType.Insanity
Enum.PowerType.ArcaneCharges
Enum.PowerType.Fury
Enum.PowerType.Pain

Insanity = UnitPower("player", Enum.PowerType.Insanity)


All times are GMT -6. The time now is 07:51 AM.

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