Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("left")
- rednet.open("right")
- p.clear()
- local counter = 0
- local xcounter = 0
- local tableID = {}
- local tableFuel = {}
- local tableColor = {}
- function tablelength(T)
- local count = 0
- for _ in pairs(T) do count = count + 1 end
- return count
- end
- function inTable(tbl, item)
- xcounter = 1
- for key, value in pairs(tbl) do
- if value == item then xcounter = xcounter + 1 return key,xcounter end
- end
- return false
- end
- while true do
- local senderId, message, distance = rednet.receive()
- counter = counter + 1
- if inTable(tableID, senderId) == false then
- tableID[tablelength(tableID)+1] = senderId
- tableFuel[tablelength(tableFuel)+1] = message
- else
- boo, xcounter = inTable(tableID, senderId)
- tableFuel[xcounter] = message
- end
- p.clear()
- p.addBox(3,3,100,10,0x000000,0.4)
- for i=1,tablelength(tableID) do
- if tableFuel[i] > 500 then
- p.addText(5,10 * i, "Computer "..tostring(tableID[i])..": "..tostring(tableFuel[i]), 0x21610B)
- elseif tableFuel[i] > 300 and tableFuel[i] <= 500 then
- p.addText(5,10 * i, "Computer "..tostring(tableID[i])..": "..tostring(tableFuel[i]), 0xDF7401)
- elseif tableFuel[i] < 300 then
- p.addText(5,10 * i, "Computer "..tostring(tableID[i])..": "..tostring(tableFuel[i]), 0xFF0000)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment