You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Tuesday, August 28th 2012, 8:39am

Mana/Health Potion Macro

I am making macros so that when i click the button it uses one of 2 phirius pots depending on what % my hp/mp is at. I had no problems with the hp macro, but the mana one is giving me troubles. It does not seem to check my mana % before using a pot, so even if its at 100% it will still use the first pot listed in the macro. If anyone could please give me some assistance on the problem with my macro, or if this feature has been disabled it would be greatly appreciated. Thanks

This is the macro I have made, and described effects of above -
/script if (UnitMana("player")/UnitMaxMana("player")<=.7) then UseItemByName("Phirius Elixir - Type B"); elseif (UnitMana("player")/UnitMaxMana("player")<=.8) then UseItemByName("Phirius Elixir - Type A"); end

Posts: 70

Location: Austin, Texas

Occupation: Quality Assurance Manager

  • Send private message

2

Tuesday, August 28th 2012, 1:18pm

The last time I tried something like this, I could get my macro/add-on to properly select which of the Phirius Potions, Elixirs or Special Water to use, and tell me so in the chat window, but it wouldn't actually use the item. Seemed like they had disabled the use of food and potions via the UseItemByName() function at one point. It may work again now, so I'll test it when I have the chance. Here is the code I was using in my add-on to use them.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
-- Begin Auto Potion macros

function AutoPot(pottype)
   local selpotname = "None"
   if pottype == "HP" then
      if PctHP("player") < 80 and GetCountInBagByName("Phirius Potion - Type A") > 0 then
         selpotname = "Phirius Potion - Type A"
      end
      if PctHP("player") < 70 and GetCountInBagByName("Phirius Potion - Type B") > 0 then
         selpotname = "Phirius Potion - Type B"
      end
      if PctHP("player") < 60 and GetCountInBagByName("Phirius Potion - Type C") > 0 then
         selpotname = "Phirius Potion - Type C"
      end
      if PctHP("player") < 50 and GetCountInBagByName("Phirius Potion - Type D") > 0 then
         selpotname = "Phirius Potion - Type D"
      end
      if PctHP("player") < 40 and GetCountInBagByName("Phirius Potion - Type E") > 0 then
         selpotname = "Phirius Potion - Type E"
      end
   end
   if pottype == "MP" then
      if PctMP("player") < 80 and GetCountInBagByName("Phirius Elixir - Type A") > 0 then
         selpotname = "Phirius Elixir - Type A"
      end
      if PctMP("player") < 70 and GetCountInBagByName("Phirius Elixir - Type B") > 0 then
         selpotname = "Phirius Elixir - Type B"
      end
      if PctMP("player") < 60 and GetCountInBagByName("Phirius Elixir - Type C") > 0 then
         selpotname = "Phirius Elixir - Type C"
      end
      if PctMP("player") < 50 and GetCountInBagByName("Phirius Elixir - Type D") > 0 then
         selpotname = "Phirius Elixir - Type D"
      end
      if PctMP("player") < 40 and GetCountInBagByName("Phirius Elixir - Type E") > 0 then
         selpotname = "Phirius Elixir - Type E"
      end
   end
   if pottype == "Both" then
      if ((PctHP("player") < 80) or (PctMP("player") < 80)) and GetCountInBagByName("Phirius Special Water - Type A") > 0 then
         selpotname = "Phirius Special Water - Type A"
      end
      if ((PctHP("player") < 70) or (PctMP("player") < 70)) and GetCountInBagByName("Phirius Special Water - Type B") > 0 then
         selpotname = "Phirius Special Water - Type B"
      end
      if ((PctHP("player") < 60) or (PctMP("player") < 60)) and GetCountInBagByName("Phirius Special Water - Type C") > 0 then
         selpotname = "Phirius Special Water - Type C"
      end
      if ((PctHP("player") < 50) or (PctMP("player") < 50)) and GetCountInBagByName("Phirius Special Water - Type D") > 0 then
         selpotname = "Phirius Special Water - Type D"
      end
      if ((PctHP("player") < 40) or (PctMP("player") < 40)) and GetCountInBagByName("Phirius Special Water - Type E") > 0 then
         selpotname = "Phirius Special Water - Type E"
      end
   end
   UseItemByName(selpotname)
end

function PctHP(tgt)
   return math.floor((UnitHealth(tgt)/UnitMaxHealth(tgt))*100) or -1
end

function PctMP(tgt)
   return math.floor((UnitMana(tgt)/UnitMaxMana(tgt))*100) or -1
end

function PctSkill(tgt)
   return math.floor((UnitSkill(tgt)/UnitMaxSkill(tgt))*100) or -1
end

 

DWibbie

Trainee

Posts: 157

Location: Sacramento, CA

  • Send private message

3

Tuesday, August 28th 2012, 9:11pm

Quoted from "frogman650;566879"

I am making macros so that when i click the button it uses one of 2 phirius pots depending on what % my hp/mp is at. I had no problems with the hp macro, but the mana one is giving me troubles. It does not seem to check my mana % before using a pot, so even if its at 100% it will still use the first pot listed in the macro. If anyone could please give me some assistance on the problem with my macro, or if this feature has been disabled it would be greatly appreciated. Thanks

This is the macro I have made, and described effects of above -
/script if (UnitMana("player")/UnitMaxMana("player")<=.7) then UseItemByName("Phirius Elixir - Type B"); elseif (UnitMana("player")/UnitMaxMana("player")<=.8) then UseItemByName("Phirius Elixir - Type A"); end


I am not very good with macro's but I use an addon called "NTBuff" and love it! I can basically set not only spell buffs (Keeps checking them to be sure they are active). I can also setup potions/heal spell macros... If I am under a certian % health it uses X. If I am under a certian % mana is uses X. If my health falls below 10% it uses "Candy"! So at least I get to live for 5 more seconds. Anyways not sure if you are against macros but I love it.
[img][/img]
Velacia
75 Mage / 75 Priest / 75 Knight
US - Reni (Heretic Guild)

RoMage

rustyx is lame rogue

Posts: 2,694

Location: web

Occupation: DB Admin

Mood: Unsure

  • Send private message

4

Tuesday, August 28th 2012, 9:25pm

Another thing you can do with ntbuff is to set up to switch gear if under designated %.

ntBuff is very helpful to keep my buffs running all the time, for example to use Cursed Fangs I have to have Fang Ritual running all the time (15 min buff) and ntBuff does much better job then I. :)

Same for housekeeper pots, on all the time. :)

I am having issue with ntBuff not giving me numbers of action bars since last update. I might have to reinstall it.

5

Tuesday, August 28th 2012, 9:31pm

Ok I managed to figure out the problem, I play a K/W and it's 72/72, so i like to play on the w/k for more dps, the macro works fine for me on k/w, but on w/k, under my portrait the mana comes under the rage bar, and it seems that it looks to see what percent my rage is at instead of my mana. I continued further to test more macro parts I found on romwiki, and I came up with UnitSkill, and UnitMaxSkill. From what I understand the "Mana" is the first bar under your health, and the "Skill" is the second bar, even if the second bar is the mana O.o

HP macro(replace the potions with Type C,D, etc. and change the .7 or .8 to the appropriate decimal percentage)-
/script if (UnitHealth("player")/UnitMaxHealth("player")<=.7) then UseItemByName("Phirius Potion - Type B"); elseif (UnitHealth("player")/UnitMaxHealth("player")<=.8) then UseItemByName("Phirius Potion - Type A"); end

MP macro(mana bar right under health ex.Health/Mana/Rage, change things like the health potion macro)-
/script if (UnitMana("player")/UnitMaxMana("player")<=.7) then UseItemByName("Phirius Elixir - Type B"); elseif (UnitMana("player")/UnitMaxMana("player")<=.8) then UseItemByName("Phirius Elixir - Type A"); end

MP macro(second bar is the mana ex.Health/Rage/Mana, again change things like the health potion macro)-
/script if (UnitSkill("player")/UnitMaxSkill("player")<=.7) then UseItemByName("Phirius Elixir - Type B"); elseif (UnitSkill("player")/UnitMaxSkill("player")<=.8) then UseItemByName("Phirius Elikir - Type A"); end

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

6

Tuesday, August 28th 2012, 9:54pm

Quoted from "RoMage;567062"

Another thing you can do with ntbuff is to set up to switch gear if under designated %.

ntBuff is very helpful to keep my buffs running all the time, for example to use Cursed Fangs I have to have Fang Ritual running all the time (15 min buff) and ntBuff does much better job then I. :)

Same for housekeeper pots, on all the time. :)

I am having issue with ntBuff not giving me numbers of action bars since last update. I might have to reinstall it.


ntBuff is an old add-on and encouraging people to use it is not always a good thing.

If you want to ensure you use the right phirius potion at the right time. It is best you keep those buttons on your bar or use DIYCE 2.0 to do it.

DIYCE 2.0 can easily make a potion button. If you look at my R/S DIYCE, you will see ... how to implement potions and adding fake-cooldowns to them to ensure you do not spam the wrong button.

Posts: 70

Location: Austin, Texas

Occupation: Quality Assurance Manager

  • Send private message

7

Saturday, September 15th 2012, 8:25pm

Quoted from "frogman650;567065"

Ok I managed to figure out the problem, I play a K/W and it's 72/72, so i like to play on the w/k for more dps, the macro works fine for me on k/w, but on w/k, under my portrait the mana comes under the rage bar, and it seems that it looks to see what percent my rage is at instead of my mana. I continued further to test more macro parts I found on romwiki, and I came up with UnitSkill, and UnitMaxSkill. From what I understand the "Mana" is the first bar under your health, and the "Skill" is the second bar, even if the second bar is the mana O.o


A very good point. I've modified my existing macro script/add-on to look specifically by primary and secondary class to see which bar it needs to look at for energy, rage, focus or mana levels. Useful if you are playing two classes that share the same pool, like Warrior/Champion, Mage/Priest, etc.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function PctMana()
  if CheckClass("Priest",1) or CheckClass("Mage",1) or CheckClass("Druid",1) or CheckClass("Warden",1) or CheckClass("Knight",1) then
    return math.floor((UnitMana("player")/UnitMaxMana("player"))*100) or -1
  elseif CheckClass("Priest",2) or CheckClass("Mage",2) or CheckClass("Druid",2) or CheckClass("Warden",2) or CheckClass("Knight",2) then
    return math.floor((UnitSkill("player")/UnitMaxSkill("player"))*100) or -1
  end
end

function PctRage()
  if CheckClass("Warrior",1) or CheckClass("Champion",1) then
    return math.floor((UnitMana("player")/UnitMaxMana("player"))*100) or -1
  elseif CheckClass("Warrior",2) or CheckClass("Champion",2) then
    return math.floor((UnitSkill("player")/UnitMaxSkill("player"))*100) or -1
  end
end

function PctFocus()
  if CheckClass("Scout",1) or CheckClass("Warlock",1) then
    return math.floor((UnitMana("player")/UnitMaxMana("player"))*100) or -1
  elseif CheckClass("Scout",2) or CheckClass("Warlock",2) then
    return math.floor((UnitSkill("player")/UnitMaxSkill("player"))*100) or -1
  end
end

function PctEnergy()
  if CheckClass("Rogue",1) then
    return math.floor((UnitMana("player")/UnitMaxMana("player"))*100) or -1
  elseif CheckClass("Rogue",2) then
    return math.floor((UnitSkill("player")/UnitMaxSkill("player"))*100) or -1
  end
end

function CheckClass(str, num)
  local mainClass, subClass = UnitClass("player")
  if (str == mainClass) and (num == 1) then
    return true
  elseif (str == subClass) and (num == 2) then
    return true
  else
    return false
  end
end