Checking mana %

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Checking mana %

#1 Post by ZZZZZ »

Im trying to use this in a function:

Code: Select all

			if 30 > player.MP/player.MaxMP*100 then
				cprintf(cli.yellow,"\nLow on Mana!!\n")
			end
I put the print in there rather than waste mana pots while I figure out what is wrong, but when using my function on Champion/Mage it keeps spaming Low on Mana!, even when mana is on 100%. I tried on a priest and it had no issue, only printing low on mana at < 30%. Any info as to why would be great.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Checking mana %

#2 Post by lisa »

add an update before the code

Code: Select all

         player:updateMP();
         if 30 > player.MP/player.MaxMP*100 then
            cprintf(cli.yellow,"\nLow on Mana!!\n")
         end
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Checking mana %

#3 Post by ZZZZZ »

This is the repeat loop it is inside:

Code: Select all

			repeat
			if not player:hasBuff(621218) and player.Class1 == 10 then
				RoMScript('CastSpellByName("Shield Form")')
				yrest(200);
			end
			if player:target() ~= Tobuff then
				player:target(Tobuff.Address)
			end
			if 30 > player.MP/player.MaxMP*100 then
				cprintf(cli.yellow,"\nLow on Mana!!\n")
			end
			if Followtank == true then
			RoMScript('FollowUnit("target")');
			end
			yrest(200);
			if Spamtank == true then
				RoMScript("CastSpellByName(\""..UseSkill.."\");");
			else
				if 100 > target.HP/target.MaxHP*100 then
					RoMScript("CastSpellByName(\""..UseSkill.."\");");
				end
			end
			target:update();
			player:update();
			until memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) ~= 0
Wouldn't the player:update() at the bottom have the same effect?
The issue im having though, isnt related to the update. Its somehow stuffing up in relation to the Champion/Mage class. As I said in the OP, when I run this function as is on a priest, it works as intended, using phirius mana pots when UNDER 30%. For some reason when I run this as a Champion/Mage it tries using a potion every loop, even when at 100% mana.

edit: Still not sure why it doesnt work, so just made it check class first...temp solution ^.^

Code: Select all

			if (player.Class1 == 5 or player.Class1 == 8) and 30 > player.MP/player.MaxMP*100 then
				GetMana()
			end
User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: Checking mana %

#4 Post by Bill D Cat »

Try using player.Mana and player.MaxMana instead.

This is what I get when using the command line with a low level Scout/Warden. Using player.MP and player.MaxMP doesn't return the expected values. I'm wondering if they behave like the in-game UnitMana() function and return the values for the first "energy" bar, where-as UnitSkill() will return the second bar values regardless of your classes. It would explain why as a Champion you get < 30% reported, because your Rage is likely 0 if out of combat.
Attachments
Scout_Warden.jpg
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Checking mana %

#5 Post by rock5 »

Correct. The way the bot is set up is it has 4 power types, player.Mana, player.Rage, player.Energy and player.Focus. player.MP is the power of the primary class regardless of what type it is. So for Champion/Mage player.MP = Rage.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Checking mana %

#6 Post by ZZZZZ »

Ahhh ok, that explains a lot ^.^ Thanks all.
Post Reply