PHP Code:
local ratio = 2.7 -- 100 mana potions = 270.00oz
local PotionID = Item.GetID("mana potion")
local PotionPrice = 50
local PotionName = "mana potion"
--Spells
prio1 = "exevo gran mas vis"
prio2 = "utana vid"
prio3 = "exura vita"
while(true) do
if (Self.ItemCount(PotionName) > 0) then --using all of the mana potions
while (Self.ItemCount(PotionName) > 0) do
if Self.CanCastSpell(prio1) then
Self.Cast(prio1)
elseif (not Self.CanCastSpell(prio1)) then
if Self.CanCastSpell(prio2) then
Self.Cast(prio2)
elseif (not Self.CanCastSpell(prio2)) then
if Self.CanCastSpell(prio3) then
Self.Cast(prio3)
end
end
end
end
else -- we must buy more potions
--firstly, sell flasks..
Self.SayToNpc({"hi", "trade"}, 100)
if (Self.Flasks() > 0) then
while (Self.Flasks() > 0) do
Self.ShopSellFlasks()
end
end
-- lets buy potions
if (Self.Money() > 0) then -- just to reduce amount of gold coins (wasting cap)
while (Self.ItemCount(3031) > PotionPrice) do
Self.ShopBuyItem(PotionID, 1)
sleep(math.random(300,900))
end
while ((Self.Cap() > (ratio * 100 + 10)) and (Self.Money() > PotionPrice * 100)) do
Self.ShopBuyItem(PotionID, 100)
sleep(math.random(300,900))
end
while ((Self.Cap() > (ratio * 10 + 10)) and (Self.Money() > PotionPrice * 10)) do
Self.ShopBuyItem(PotionID, 10)
sleep(math.random(300,900))
end
end
end
sleep(math.random(600,1400))
end
Made it abit different, more user friendly i guess.
Use the support tab for potions, or use another script to do it.
I can also add the Mana on follow if you need it:
PHP Code:
local ratio = 2.7 -- 100 mana potions = 270.00oz
local PotionID = Item.GetID("mana potion")
local PotionPrice = 50
while(true) do
if (Self.ItemCount(PotionID) > 0) then
Self.UseItemWithFollow(PotionID)
elseif (Self.Flasks() >= 0) then
while (Self.Flasks() > 0) do
Self.SayToNpc({"hi", "trade"}, 100)
Self.ShopSellFlasks()
end
-- lets buy potions
if (Self.Money() > 0) then -- just to reduce amount of gold coins (wasting cap)
while (Self.ItemCount(3031) > PotionPrice) do
Self.ShopBuyItem(PotionID, 1)
sleep(math.random(300,900))
end
while ((Self.Cap() > (ratio * 100 + 10)) and (Self.Money() > PotionPrice * 100)) do
Self.ShopBuyItem(PotionID, 100)
sleep(math.random(300,900))
end
while ((Self.Cap() > (ratio * 10 + 10)) and (Self.Money() > PotionPrice * 10)) do
Self.ShopBuyItem(PotionID, 10)
sleep(math.random(300,900))
end
end
end
sleep(math.random(600,1400))
end