This script will check for mfs, if there's no more mana fluids and there are vials then it will go back to previous windows. If it finds containers (bps, etc.) it will try to open it and check for mfs, if there are no mfs then it will go back to previous window and try next.
local BP_MF = 'red backpack' -- Name, id or index of the container that contains bps of mfs or mfs itself, depending on which will be open when you start the script.
if WINDOW_INDEX == nil then
WINDOW_INDEX = BP_MF
end
if LAST_BP_INDEX == nil then
LAST_BP_INDEX = -1
end
if itemcount('mana fluid', WINDOW_INDEX) == 0 and windowcount(WINDOW_INDEX) > 0 then
if itemcount('vial', WINDOW_INDEX) > 0 then
higherwindow(WINDOW_INDEX)
wait(800, 1200)
end
local container = getcontainer(WINDOW_INDEX)
if container ~= nil and container.usedslots > 0 then
local flag = false
for _, item in ipairs(container.items) do
if item.index > LAST_BP_INDEX and itemhasflags(item.id, 4)then
openitemslot(item.index, container.index)
wait(800, 1200)
if itemcount('mana fluid', container.index) == 0 then
higherwindow(container.index)
wait(800, 1200)
else
LAST_BP_INDEX = item.index
flag = true
break
end
end
end
if not flag then
playsound('default')
flashclient()
printerror('Could not find any bps to open. Maybe already tried to open all bps.')
LAST_BP_INDEX = -1
end
end
end
This script will do the same, but it will try to guess what's the container that has the mfs/bps.
if LAST_BP_INDEX == nil then
LAST_BP_INDEX = -1
end
if WINDOW_INDEX == nil then
local containers = getcontainers()
for _, cont in ipairs(containers) do
if cont.usedslots > 0 then
local countBp = 0
local countVialMf = 0
for __, item in ipairs(cont.items) do
if item.id == 2874 then
countVialMf = countVialMf + 1
elseif itemhasflags(item.id, 4) then
countBp = countBp + 1
end
end
if countVialMf >= 10 or countBp >= 5 then
WINDOW_INDEX = cont.index
break
end
end
end
end
if itemcount('mana fluid', WINDOW_INDEX) == 0 and windowcount(WINDOW_INDEX) > 0 then
if itemcount('vial', WINDOW_INDEX) > 0 then
higherwindow(WINDOW_INDEX)
wait(800, 1200)
end
local container = getcontainer(WINDOW_INDEX)
if container ~= nil and container.usedslots > 0 then
local flag = false
for _, item in ipairs(container.items) do
if item.index > LAST_BP_INDEX and itemhasflags(item.id, 4) then
openitemslot(item.index, container.index)
wait(800, 1200)
if itemcount('mana fluid', container.index) == 0 then
higherwindow(container.index)
wait(800, 1200)
else
LAST_BP_INDEX = item.index
flag = true
break
end
end
end
if not flag then
playsound('default')
flashclient()
printerror('Could not find any bps to open. Maybe already tried to open all bps.')
LAST_BP_INDEX = -1
end
end
end
If the server you play don't have empty vials then use script below!
local BP_MF = 'red backpack' -- Name, id or index of the container that contains bps of mfs or mfs itself, depending on which will be open when you start the script.
if WINDOW_INDEX == nil then
WINDOW_INDEX = BP_MF
end
if LAST_BP_INDEX == nil then
LAST_BP_INDEX = -1
end
if itemcount('mana fluid', WINDOW_INDEX) == 0 and windowcount(WINDOW_INDEX) > 0 then
local container = getcontainer(WINDOW_INDEX)
if container ~= nil then
if container.usedslots == 0 then
higherwindow(WINDOW_INDEX)
wait(800, 1200)
else
local flag = false
for _, item in ipairs(container.items) do
if item.index > LAST_BP_INDEX and itemhasflags(item.id, 4) then
openitemslot(item.index, container.index)
wait(800, 1200)
if itemcount('mana fluid', container.index) == 0 then
higherwindow(container.index)
wait(800, 1200)
else
LAST_BP_INDEX = item.index
flag = true
break
end
end
end
if not flag then
playsound('default')
flashclient()
printerror('Could not find any bps to open. Maybe already tried to open all bps.')
LAST_BP_INDEX = -1
end
end
end
end
This script will do the same, but it will try to guess what's the container that has the mfs/bps.
if LAST_BP_INDEX == nil then
LAST_BP_INDEX = -1
end
if WINDOW_INDEX == nil then
local containers = getcontainers()
for _, cont in ipairs(containers) do
if cont.usedslots > 0 then
local countBp = 0
local countVialMf = 0
for __, item in ipairs(cont.items) do
if item.id == 2874 then
countVialMf = countVialMf + 1
elseif itemhasflags(item.id, 4) then
countBp = countBp + 1
end
end
if countVialMf >= 10 or countBp >= 5 then
WINDOW_INDEX = cont.index
break
end
end
end
end
if itemcount('mana fluid', WINDOW_INDEX) == 0 and windowcount(WINDOW_INDEX) > 0 then
local container = getcontainer(WINDOW_INDEX)
if container ~= nil then
if container.usedslots == 0 then
higherwindow(WINDOW_INDEX)
wait(800, 1200)
else
local flag = false
for _, item in ipairs(container.items) do
if item.index > LAST_BP_INDEX and itemhasflags(item.id, 4) then
openitemslot(item.index, container.index)
wait(800, 1200)
if itemcount('mana fluid', container.index) == 0 then
higherwindow(container.index)
wait(800, 1200)
else
LAST_BP_INDEX = item.index
flag = true
break
end
end
end
if not flag then
playsound('default')
flashclient()
printerror('Could not find any bps to open. Maybe already tried to open all bps.')
LAST_BP_INDEX = -1
end
end
end
end