Page 1 of 1

Checking mana %

Posted: Fri Jan 17, 2014 10:27 pm
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.

Re: Checking mana %

Posted: Fri Jan 17, 2014 10:36 pm
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

Re: Checking mana %

Posted: Sat Jan 18, 2014 3:05 am
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

Re: Checking mana %

Posted: Sat Jan 18, 2014 4:31 am
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.

Re: Checking mana %

Posted: Sat Jan 18, 2014 5:19 am
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.

Re: Checking mana %

Posted: Sat Jan 18, 2014 5:58 am
by ZZZZZ
Ahhh ok, that explains a lot ^.^ Thanks all.