Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- load the API
- os.loadAPI("ocs/apis/sensor")
- -- wrap the sensor
- prox = sensor.wrap("left")
- -- get the targets
- function getTarg()
- targets = prox.getTargets()
- end
- function nl()
- currX, currY = m.getCursorPos()
- m.setCursorPos(1, currY + 1)
- end
- m = peripheral.wrap("top")
- function monInit()
- m.clear()
- m.setCursorPos(1,1)
- m.setTextColor(colors.blue)
- end
- monInit()
- function derp1()
- -- loop through them
- for name, basicDetails in pairs(targets) do
- -- print their name
- m.write("Found entity: "..name)
- nl()
- -- get more details about them
- local moreDetails = prox.getTargetDetails(name)
- -- print their health
- m.write("Health: "..moreDetails.Health)
- nl()
- m.write("------")
- nl()
- end
- end
- x = 1
- function loop()
- if x > 0 then
- getTarg()
- derp1()
- sleep(2.9)
- monInit()
- loop()
- end
- end
- loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement