Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------
- -- MurderBot --
- -- by improvshark --
- -- --
- -------------------------------
- enableMonitor = peripheral.isPresent("bottom")
- local xp = peripheral.wrap("right")
- local monitor = peripheral.wrap("bottom")
- done = false
- autoEnchant = false
- if enableMonitor == true then
- print(monitor.getSize())
- end
- function full()
- for i=1, 16 do
- if turtle.getItemCount(i) < 1 then
- return false
- end
- end
- return true
- end
- function drop()
- for i=1, 15 do
- turtle.select(i)
- turtle.drop()
- end
- end
- function read()
- local timeout = os.startTimer(2)
- local sEvent, param = os.pullEvent()
- if sEvent == 'timer' and param == timeout then
- -- do nothing
- elseif sEvent == "key" then
- return param
- end
- end
- function printFarm()
- --terminal
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------------")
- print(" _ ")
- print(" |V| __ _| _ __ o __ (_| ")
- print(" | ||_| | (_|(/_ | | | |__| ")
- print(" ")
- print(" ")
- print(" lv: " .. xp.getLevels())
- print(" ")
- if autoEnchant == false then
- print(" ")
- else
- print(" Auto Enchant Enabled ")
- end
- print(" ")
- print("---------------------------------------")
- print(" Press M To Switch Modes or E for auto ")
- if enableMonitor == true then
- --monitor
- monitor.clear()
- monitor.setCursorPos(1,3)
- monitor.write("lv: "..xp.getLevels())
- if autoEnchant == true then
- --monitor
- monitor.setCursorPos(2,4)
- monitor.write("Auto")
- end
- end
- end
- function printEnchant()
- --terminal
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------------")
- print(" __ _ ")
- print(" |_ __ _ |_ _ __ _|_ o __ (_| ")
- print(" |__| |(_ | |(_|| | |_ | | |__| ")
- print(" ")
- print(" ")
- print(" lv:" .. limit)
- print(" Enchant item lv:" ..selection)
- print(" ")
- print("-------------key-Bindings--------------")
- print("change level: arrowkeys ")
- print("enchant: enter ")
- if enableMonitor == true then
- --monitor
- monitor.clear()
- monitor.setCursorPos(1,3)
- monitor.write("ENCHANT")
- end
- end
- function dropLoot()
- if full() then
- turtle.turnRight()
- drop()
- turtle.turnLeft()
- end
- end
- function enchant()
- done = false
- turtle.turnRight()
- drop()
- turtle.select(1)
- turtle.turnLeft()
- limit = xp.getLevels()
- selection = limit
- while done == false do
- printEnchant()
- button = read()
- --up arrow
- if button == 200 then
- if selection < limit then
- selection = selection + 1
- end
- end
- --down arrow
- if button == 208 then
- if selection > 1 then
- selection = selection - 1
- end
- end
- --enter
- if button == 28 then
- -- shell.run("enchant", selection)
- xp.enchant(selection)
- limit = xp.getLevels()
- print("lv: " .. xp.getLevels())
- turtle.drop()
- print("done")
- os.sleep(1)
- end
- --m
- if button == 50 then
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------------")
- print(" _ ")
- print(" |V| __ _| _ __ o __ (_| ")
- print(" | ||_| | (_|(/_ | | | |__| ")
- done = true
- end
- end
- end
- function farm()
- button = read()
- --e
- if button == 18 then
- if autoEnchant == false then
- autoEnchant = true
- printFarm()
- elseif autoEnchant == true then
- autoEnchant = false
- printFarm()
- end
- end
- if button == 50 then
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------------")
- print(" __ _ ")
- print(" |_ __ _ |_ _ __ _|_ o __ (_| ")
- print(" |__| |(_ | |(_|| | |_ | | |__| ")
- enchant()
- end
- if autoEnchant == false then
- turtle.attackUp()
- turtle.attack()
- -- os.sleep(1)
- xp.collect()
- printFarm()
- dropLoot()
- xp.collect()
- elseif autoEnchant == true then
- turtle.attackUp()
- turtle.attack()
- -- os.sleep(1)
- xp.collect()
- printFarm()
- dropLoot()
- xp.collect()
- if (xp.getLevels() >= 30) then
- turtle.turnRight()
- drop()
- turtle.select(16)
- turtle.transferTo(1, 1)
- turtle.select(1)
- --shell.run("enchant", 30)
- xp.enchant(30)
- turtle.drop()
- turtle.turnLeft()
- end
- end
- end
- function main()
- while true do
- farm()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement