Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- screen = peripheral.wrap("left")
- analyzer = peripheral.wrap("top")
- extract = { [1]="type", [2]="speciesPrimary", [3]="speciesSecondary", [4]="speed", [5]="lifespan", [6]="fertility", [7]="flower", [8]="effect", [9]="temperature", [10]="toleranceTemperature", [11]="humidity", [12]="toleranceHumidity", [13]="tolerantFlyer", [14]="caveDwelling", [15]="nocturnal", [16]="territory" }
- w,h = screen.getSize()
- function swrite(str,x,y)
- screen.setCursorPos(x,y)
- screen.write(str)
- end
- function swritecenter(str,y)
- screen.setCursorPos(w/2+#str/2,y)
- screen.write(str)
- end
- function swriteBool(bool,x,y)
- screen.setCursorPos(x,y)
- if bool then
- screen.setTextColor(colors.green)
- screen.write("Yes")
- else
- screen.setTextColor(colors.red)
- screen.write("No")
- end
- screen.setTextColor(colors.white)
- end
- function showData()
- screen.clear()
- swrite("Fair's Bee Analyzer",2,1)
- if analyzer.isBee() then
- data = analyzer.analyze()
- swrite("Type: "..data[extract[1]],2,3)
- swrite("Species: ",2,4)
- swrite(string.sub(data[extract[2]],14,#data[extract[2]]).." - "..string.sub(data[extract[3]],14,#data[extract[3]]),2,5)
- swrite("Speed: "..data[extract[4]],2,7)
- swrite("Lifespan: "..data[extract[5]],2,8)
- swrite("Fertility: "..data[extract[6]],2,9)
- swrite("Flower: "..data[extract[7]],2,11)
- swrite("Effect: "..data[extract[8]],2,12)
- swrite("Temp.: "..data[extract[9]],2,14)
- swrite("Temp.Tol.: "..data[extract[10]],2,15)
- swrite("Humid.: "..data[extract[11]],2,16)
- swrite("Humid.Tol: "..data[extract[12]],2,17)
- swrite("Rainworker: ",2,19)
- swriteBool(data[extract[13]],15,19)
- swrite("Caveworker: ",2,20)
- swriteBool(data[extract[14]],15,20)
- swrite("Nightworker: ",2,21)
- swriteBool(data[extract[15]],15,21)
- else
- swrite("Insert bee in analyzer.",2,2)
- end
- end
- while true do
- showData()
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment