Hello.
About the script
This script will do the following:
How to setup:
Bed location should be the exactly sqm where it should use the bed to sleep.
Blanks location should be the exactly sqm where the bps with bps of blanks are. Warning: It should be a backpack with more 20 bps inside with blank runes.
Made runes will be moved back to same bp than blank rune was, obviously.
Food location should be the exactly sqm where foods are. You can leave it on floor or inside a backpack, you can setup it on script.
Bed time is the time that character should sleep, that depends on you, food (because each food heals for a specific time!) and server, because heal time may change from server to server.
NoRunes are options on what to do when no more blank runes available for that specific character.
[spoiler]Old code...
[/spoiler]
keywords: bedmage, bed mage, rune bed, rune house, bed making
About the script
This script will do the following:
- Connect on characters from time to time.
- Check if it has mana to make runes. If it has mana to make runes then reach blanks bps (a backpack with 20 bps with blank runes), search for a blank rune, move to your hand and cast spell. It will keep making runes until you don't have enough mana.
- Reach food sqm, eat food.
- Reach bed sqm, sleep.
- It will play alerts when no more blanks.
How to setup:
Bed location should be the exactly sqm where it should use the bed to sleep.
Blanks location should be the exactly sqm where the bps with bps of blanks are. Warning: It should be a backpack with more 20 bps inside with blank runes.
Made runes will be moved back to same bp than blank rune was, obviously.
Food location should be the exactly sqm where foods are. You can leave it on floor or inside a backpack, you can setup it on script.
Bed time is the time that character should sleep, that depends on you, food (because each food heals for a specific time!) and server, because heal time may change from server to server.
NoRunes are options on what to do when no more blank runes available for that specific character.
local Characters = {{
Account = "123456", -- Character's account
Password = "mypass321", -- Character's password
Name = "Maker 1", -- Character's name.
Bed = {
X = 12345,
Y = 12345,
Z = 5
}, -- Bed's location where you gonna use to go sleep.
Blanks = {
X = 12345,
Y = 12345,
Z = 5
}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {
Hand = "lhand",
Mana = 300,
Spell = "adori vita vis"
}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {
X = 12345,
Y = 12345,
Z = 5,
InsideContainer = true
}, -- Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {
Min = 300,
Max = 400
}, -- Time to wait between each 'sleep', in SECONDS.
OnFail = {
PLAY_ALERT = true,
IGNORE_CHARACTER = true
}, -- This option does not works for food when directly on floor.
TalkIfBpNotFound = {
Enabled = true,
Messages = {'?', 'wtf', 'hello?'}
}
}, {
Account = "123456", -- Character's account
Password = "mypass321", -- Character's password
Name = "Makers'name 2", -- Character's name.
Bed = {
X = 12345,
Y = 12345,
Z = 5
}, -- Bed's location where you gonna use to go sleep.
Blanks = {
X = 12345,
Y = 12345,
Z = 5
}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {
Hand = "lhand",
Mana = 300,
Spell = "adori vita vis"
}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {
X = 12345,
Y = 12345,
Z = 5,
InsideContainer = true
}, -- Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {
Min = 300,
Max = 400
}, -- Time to wait between each 'sleep', in SECONDS.
OnFail = {
PLAY_ALERT = true,
IGNORE_CHARACTER = true
}, -- This option does not works for food when directly on floor.
TalkIfBpNotFound = {
Enabled = true,
Messages = {'?', 'wtf', 'hello?'}
}
}, {
Account = "123456", -- Character's account
Password = "mypass321", -- Character's password
Name = "Makers'name 3", -- Character's name.
Bed = {
X = 12345,
Y = 12345,
Z = 5
}, -- Bed's location where you gonna use to go sleep.
Blanks = {
X = 12345,
Y = 12345,
Z = 5
}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {
Hand = "lhand",
Mana = 300,
Spell = "adori vita vis"
}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {
X = 12345,
Y = 12345,
Z = 5,
InsideContainer = true
}, -- Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {
Min = 300,
Max = 400
}, -- Time to wait between each 'sleep', in SECONDS.
OnFail = {
PLAY_ALERT = true,
IGNORE_CHARACTER = true
}, -- This option does not works for food when directly on floor.
TalkIfBpNotFound = {
Enabled = true,
Messages = {'?', 'wtf', 'hello?'}
}
}}
local LOG_CONSOLE = true -- Print the character's next check time on console? It will print: "CHARACTER's next check in X seconds.".
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ Bed mage script 0.1 by Arkilys --]]
--[[ />
--[[ DON'T EDIT BELOW THIS LINE --]]
LAST_BP = LAST_BP or {}
NEXT_CHECK = NEXT_CHECK or {}
CHARACTERS_IGNORED = CHARACTERS_IGNORED or {}
if findopenedcontainer == nil then
function findopenedcontainer(lastContainers, currentContainers, openedContainerId)
if currentContainers == nil then
currentContainers = getcontainers()
end
if openedContainerId == nil then
openedContainerId = -1
end
for _, current in ipairs(currentContainers) do
local found = false
for __, last in ipairs(lastContainers) do
if last.index == current.index then
found = true
break
end
end
if found == false and (openedContainerId <= 0 or openedContainerId == current.id) then
return current
end
end
return nil
end
end
if opencontainer == nil then
function opencontainer(id, from, newWindow, tries)
if newWindow == nil then
newWindow = false
end
if tries == nil then
tries = 3
end
local containersBefore = getcontainers()
local openedContainer = nil
for j = 1, tries do
openitem(id, from, newWindow)
wait(800, 1200)
local containersCurrent = getcontainers()
openedContainer = findopenedcontainer(containersBefore, containersCurrent, id)
if openedContainer ~= nil and openedContainer.index >= 0 then
break
end
containersBefore = containersCurrent
end
return openedContainer
end
end
for i = 1, #Characters do
local maker = Characters[i]
local checkCharacter = false
if NEXT_CHECK[maker.Name] == nil then
checkCharacter = true
else
if runningtime() >= NEXT_CHECK[maker.Name] then
checkCharacter = true
end
end
if CHARACTERS_IGNORED[maker.Name] ~= nil then
checkCharacter = false
end
if checkCharacter then
if connected() then
if name():lower() ~= maker.Name:lower() then
logout()
wait(1000)
else
closewindows()
wait(1000)
end
end
if not connected() then
connect(maker.Account, maker.Password, maker.Name)
wait(800)
end
if connected() then
if mp() >= maker.Rune.Mana then
for j = 1, 3 do
reachlocation(maker.Blanks.X, maker.Blanks.Y, maker.Blanks.Z, false)
wait(1000)
mainBP = opencontainer(0, ground(maker.Blanks.X, maker.Blanks.Y, maker.Blanks.Z), true, 3)
if mainBP ~= nil and mainBP.index >= 0 then
break
end
end
if mainBP ~= nil and mainBP.index >= 0 then
if LAST_BP[maker.Name] == nil then
LAST_BP[maker.Name] = 0
end
local lastBP = LAST_BP[maker.Name]
local bpsSlots = {}
for j = 1, mainBP.usedslots do
local bpItem = mainBP.items[j]
if itemhasflags(bpItem.id, 4) then
table.insert(bpsSlots, bpItem.index)
end
end
for j = 1, #bpsSlots do
local bpSlot = bpsSlots[j]
if bpSlot >= lastBP then
local containersBefore = getcontainers()
local blanksContainer = nil
for k = 1, 3 do
openitemslot(bpSlot, mainBP.index, true)
wait(800, 1200)
local containersCurrent = getcontainers()
blanksContainer = findopenedcontainer(containersBefore, containersCurrent,
mainBP.items[j].id)
if blanksContainer ~= nil and blanksContainer.index >= 0 then
break
end
containersBefore = containersCurrent
end
if blanksContainer ~= nil then
local manaBreak = false
local blank_rune_id = itemid("blank rune")
while itemcount(blank_rune_id, blanksContainer.index) > 0 do
moveitems(blank_rune_id, maker.Rune.Hand, blanksContainer.index, 0)
wait(800)
local handRune = {
id = 0,
count = 0
}
local isLefthand = false
if maker.Rune.Hand:lower() == "lhand" then
isLefthand = true
handRune = lhand()
else
handRune = rhand()
end
while handRune.id == blank_rune_id do
cast(maker.Rune.Spell)
wait(1000)
if isLefthand then
handRune = lhand()
else
handRune = rhand()
end
end
moveitems(handRune.id, blanksContainer.index, maker.Rune.Hand, 0)
wait(800)
LAST_BP[maker.Name] = bpSlot
if mp() < maker.Rune.Mana then
manaBreak = true
break
end
end
if manaBreak == false then
closewindow(blanksContainer.index)
wait(500)
if bpSlot == #bpsSlots then
if maker.OnFail.PLAY_ALERT then
playsound("default")
end
if maker.OnFail.IGNORE_CHARACTER then
CHARACTERS_IGNORED[maker.Name] = true
end
LAST_BP[maker.Name] = 0
end
else
break
end
end
end
end
else
if maker.OnFail.PLAY_ALERT then
playsound("default")
end
if maker.OnFail.IGNORE_CHARACTER then
CHARACTERS_IGNORED[maker.Name] = true
end
if maker.TalkIfBpNotFound.Enabled then
local message = maker.TalkIfBpNotFound.Messages[random(1, #maker.TalkIfBpNotFound.Messages)]
if message ~= nil and message ~= '' then
say(message)
end
end
end
end
if posz() == maker.Food.Z then
local foodBpFound = false
for j = 1, 3 do
if reachlocation(maker.Food.X, maker.Food.Y, maker.Food.Z, false) then
wait(1000)
if maker.Food.InsideContainer then
local foodContainer = opencontainer(0, ground(maker.Food.X, maker.Food.Y, maker.Food.Z),
true)
if foodContainer ~= nil then
eatfood(random(20, 30))
foodBpFound = true
break
end
else
foodBpFound = true
for k = 1, random(20, 30) do
useitem(0, maker.Food.X, maker.Food.Y, maker.Food.Z)
wait(400)
local status_msg = statusmessage()
if status_msg ~= nil and status_msg == "You are full." then
break
end
end
break
end
end
end
if foodBpFound == false then
if maker.OnFail.PLAY_ALERT then
playsound("default")
end
if maker.OnFail.IGNORE_CHARACTER then
CHARACTERS_IGNORED[maker.Name] = true
end
if maker.TalkIfBpNotFound.Enabled then
local message = maker.TalkIfBpNotFound.Messages[random(1, #maker.TalkIfBpNotFound.Messages)]
if message ~= nil and message ~= '' then
say(message)
end
end
end
end
if posz() == maker.Bed.Z then
for j = 1, 3 do
reachlocation(maker.Bed.X, maker.Bed.Y, maker.Bed.Z, false)
wait(1000)
useitem(0, maker.Bed.X, maker.Bed.Y, maker.Bed.Z)
wait(400)
if not connected() then
break
end
end
else
print(maker.Name .. " is on a different Z position than bed, so just logouted.")
playsound("default")
flashclient()
logout()
end
local nextTime = random(maker.BedTime.Min, maker.BedTime.Max)
NEXT_CHECK[maker.Name] = runningtime() + nextTime
if LOG_CONSOLE then
print(maker.Name .. "'s next check in", nextTime, "seconds.")
end
end
end
end
local Characters = {
{
Account = "123456", --Character's account
Password = "mypass321", --Character's password
Name = "Maker 1", --Character's name.
Bed = {X = 12345, Y = 12345, Z = 5}, -- Bed's location where you gonna use to go sleep.
Blanks = {X = 12345, Y = 12345, Z = 5}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {Hand = "lhand", Mana = 300, Spell = "adori vita vis"}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {X = 12345, Y = 12345, Z = 5, InsideContainer = true}, --Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {Min = 300, Max = 400}, -- Time to wait between each 'sleep', in SECONDS.
NoRunes = {PLAY_ALERT = true, IGNORE_CHARACTER = true}
},
{
Account = "123456", --Character's account
Password = "mypass321", --Character's password
Name = "Makers'name 2", --Character's name.
Bed = {X = 12345, Y = 12345, Z = 5}, -- Bed's location where you gonna use to go sleep.
Blanks = {X = 12345, Y = 12345, Z = 5}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {Hand = "lhand", Mana = 300, Spell = "adori vita vis"}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {X = 12345, Y = 12345, Z = 5, InsideContainer = true}, --Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {Min = 300, Max = 400}, -- Time to wait between each 'sleep', in SECONDS.
NoRunes = {PLAY_ALERT = true, IGNORE_CHARACTER = true}
},
{
Account = "123456", --Character's account
Password = "mypass321", --Character's password
Name = "Makers'name 3", --Character's name.
Bed = {X = 12345, Y = 12345, Z = 5}, -- Bed's location where you gonna use to go sleep.
Blanks = {X = 12345, Y = 12345, Z = 5}, -- Blank's backpack location. It must be 01 backpack with 20 blank runes backpacks inside.
Rune = {Hand = "lhand", Mana = 300, Spell = "adori vita vis"}, -- Rune to make and hand. ALWAYS LEAVE THE HAND EMPTY!
Food = {X = 12345, Y = 12345, Z = 5, InsideContainer = true}, --Food's backpack location. You can leave a backpack with food inside or leave food on floor and set 'InsideContainer' as false.
BedTime = {Min = 300, Max = 400}, -- Time to wait between each 'sleep', in SECONDS.
NoRunes = {PLAY_ALERT = true, IGNORE_CHARACTER = true}
}
}
local LOG_CONSOLE = true -- Print the character's next check time on console? It will print: "CHARACTER's next check in X seconds.".
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ Bed mage script 0.1 by Arkilys --]]
--[[ --]]
--[[ __________ .___ _____ --]]
--[[ \______ \ ____ __| _/ / \ _____ ____ ____ --]]
--[[ | | _// __ \ / __ | / \ / \\__ \ / ___\_/ __ \ --]]
--[[ | | \ ___// /_/ | / Y \/ __ \_/ /_/ > ___/ --]]
--[[ |______ /\___ >____ | \____|__ (____ /\___ / \___ > --]]
--[[ \/ \/ \/ \/ \//_____/ \/ --]]
--[[ ___. _____ __ .__ .__ --]]
--[[ \_ |__ ___.__. / _ \_______| | _____.__.| | |__| ______ --]]
--[[ | __ < | | / /_\ \_ __ \ |/ < | || | | |/ ___/ --]]
--[[ | \_\ \___ | / | \ | \/ < \___ || |_| |\___ \ --]]
--[[ |___ / ____| \____|__ /__| |__|_ \/ ____||____/__/____ > --]]
--[[ \/\/ \/ \/\/ \/ --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
LAST_BP = LAST_BP or {}
NEXT_CHECK = NEXT_CHECK or {}
CHARACTERS_IGNORED = CHARACTERS_IGNORED or {}
for i = 1, #Characters do
local maker = Characters[i]
local checkCharacter = false
if NEXT_CHECK[maker.Name] == nil then
checkCharacter = true
else
if runningtime() >= NEXT_CHECK[maker.Name] then
checkCharacter = true
end
end
if CHARACTERS_IGNORED[maker.Name] ~= nil then
checkCharacter = false
end
if checkCharacter then
if connected() then
if name():lower() ~= maker.Name:lower() then
logout()
wait(1000)
else
closewindows()
wait(1000)
end
end
if not connected() then
connect(maker.Account, maker.Password, maker.Name)
wait(800)
end
if connected() then
if mp() >= maker.Rune.Mana then
local winCount = windowcount()
for j = 1, 3 do
reachlocation(maker.Blanks.X, maker.Blanks.Y, maker.Blanks.Z, false)
wait(1000)
openitem(0, ground(maker.Blanks.X, maker.Blanks.Y, maker.Blanks.Z), true)
wait(1000)
if windowcount() ~= winCount then
break
end
end
local mainBP = getcontainer(winCount)
if mainBP.index >= 0 then
if LAST_BP[maker.Name] == nil then
LAST_BP[maker.Name] = 0
end
local lastBP = LAST_BP[maker.Name]
local bpsSlots = {}
for j = 1, mainBP.usedslots do
local bpItem = mainBP.items[j]
if itemhasflags(bpItem.id, 4) then
table.insert(bpsSlots, bpItem.index)
end
end
for j = 1, #bpsSlots do
local bpSlot = bpsSlots[j]
if bpSlot >= lastBP then
local winCount = windowcount()
for x = 1, 3 do
openitemslot(bpSlot, mainBP.index, true)
wait(1000)
if windowcount() ~= winCount then
break
end
end
local manaBreak = false
local blank_rune_id = itemid("blank rune")
while itemcount(blank_rune_id, (mainBP.index + 1)) > 0 do
moveitems(blank_rune_id, maker.Rune.Hand, (mainBP.index + 1), 0)
wait(800)
local handRune = {id = 0, count = 0}
local isLefthand = false
if maker.Rune.Hand:lower() == "lhand" then
isLefthand = true
handRune = lhand()
else
handRune = rhand()
end
while handRune.id == blank_rune_id do
cast(maker.Rune.Spell)
wait(1000)
if isLefthand then
handRune = lhand()
else
handRune = rhand()
end
end
moveitems(handRune.id, (mainBP.index + 1), maker.Rune.Hand, 0)
wait(800)
LAST_BP[maker.Name] = bpSlot
if mp() < maker.Rune.Mana then
manaBreak = true
break
end
end
if manaBreak == false then
closewindow((mainBP.index + 1))
wait(500)
if bpSlot == #bpsSlots then
if maker.NoRunes.PLAY_ALERT then
playsound("default")
end
if maker.NoRunes.IGNORE_CHARACTER then
CHARACTERS_IGNORED[maker.Name] = true
end
LAST_BP[maker.Name] = 0
end
else
break
end
end
end
end
end
if posz() == maker.Food.Z then
for j = 1, 3 do
if reachlocation(maker.Food.X, maker.Food.Y, maker.Food.Z, false) then
wait(1000)
if maker.Food.InsideContainer then
local winCount = windowcount()
for k = 1, 3 do
openitem(0, ground(maker.Food.X, maker.Food.Y, maker.Food.Z), true)
wait(1000)
if windowcount() ~= winCount then
break
end
end
eatfood(random(20, 30))
else
for k = 1, random(20, 30) do
useitem(0, maker.Food.X, maker.Food.Y, maker.Food.Z)
wait(400)
local status_msg = statusmessage()
if status_msg ~= nil and status_msg == "You are full." then
break
end
end
end
end
end
end
if posz() == maker.Bed.Z then
for j = 1, 3 do
reachlocation(maker.Bed.X, maker.Bed.Y, maker.Bed.Z, false)
wait(1000)
useitem(0, maker.Bed.X, maker.Bed.Y, maker.Bed.Z)
wait(400)
if not connected() then
break
end
end
else
print(maker.Name .. " is on a different Z position than bed, so just logouted.")
playsound("default")
flashclient()
logout()
end
local nextTime = random(maker.BedTime.Min, maker.BedTime.Max)
NEXT_CHECK[maker.Name] = runningtime() + nextTime
if LOG_CONSOLE then
print(maker.Name .. "'s next check in", nextTime, "seconds.")
end
end
end
end
keywords: bedmage, bed mage, rune bed, rune house, bed making