Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local me = peripheral.wrap("back")
- local g = me.canvas() --canvas/graphics
- local modem = peripheral.wrap("right")
- modem.open(6)
- show = true
- stanStat = "Watching for growth..."
- ssCol = {255, 0, 0}
- carlStat = "Chillin' out"
- carlCol = {0, 255, 255}
- waits = 0
- rf = 1
- cap = 1
- out = 0
- function hello()
- b1 = g.addRectangle(440, 98, 64, 2)
- b2 = g.addRectangle(440, 100, 2, 62)
- b3 = g.addRectangle(440, 160, 64, 2)
- b4 = g.addRectangle(502, 100, 2, 62)
- b1.setColour(0, 0, 0)
- b2.setColour(0, 0, 0)
- b3.setColour(0, 0, 0)
- b4.setColour(0, 0, 0)
- background = g.addRectangle(442, 100, 100, 100)
- background.setSize(60, 60)
- background.setColour(128, 128, 128)
- local title = g.addText({ x = 455, y = 101}, "")
- title.setScale(0.5)
- title.setColour(255, 255, 255)
- title.setText("Slave Status")
- local stan = g.addText({ x = 443, y = 110}, "")
- stan.setScale(0.3)
- stan.setColour(0, 0, 0)
- stan.setText("Stan the man:")
- stanStatus = g.addText({ x = 465, y = 110}, stanStat)
- stanStatus.setScale(0.3)
- stanStatus.setColour(ssCol[1], ssCol[2], ssCol[3])
- stanStatus.setText(stanStat)
- pow = setCol((rf / cap) * 100)
- power = g.addText({x = 445, y = 114}, "")
- power.setScale(0.25)
- power.setColour(0, 225, 0)
- power.setText("Power:")
- powbar = g.addRectangle(455, 113, 45, 3)
- powbar.setColour(0, 0, 0)
- len = 43 * (rf / cap)
- len = tonumber(len)
- if len > 43 then
- len = 43
- elseif len < 0 then
- len = 0
- end
- powb = g.addRectangle(456, 114, 43, 1)
- powb.setColour(60, 60, 60)
- powl = g.addRectangle(456, 114, len, 1)
- powl.setColour(pow[1], pow[2], pow[3])
- carlT = g.addText({x = 443, y = 119}, "")
- carlT.setScale(0.3)
- carlT.setColour(0, 0, 0)
- carlT.setText("Carl's steel:")
- carlLen = (waits / 100) * 50
- carlLen = tonumber(carlLen)
- carlB = g.addRectangle(463, 119.05, carlLen, 2.55)
- carlB.setColour(30, 30, 30)
- carlStatus = g.addText({x = 463, y = 119.25}, "")
- carlStatus.setScale(0.28)
- carlStatus.setColour(carlCol[1], carlCol[2], carlCol[3])
- carlStatus.setText(carlStat)
- end
- function setCol(val)
- if val < 33 then
- return {255, 0, 0}
- elseif val < 85 then
- return {255, 255, 0}
- else
- return {0, 255, 0}
- end
- end
- function setColRev(val)
- if val < 33 then
- return {0, 255, 0}
- elseif val < 85 then
- return {255, 255, 0}
- else
- return {255, 0, 0}
- end
- end
- hello()
- while true do
- local event, key, chan, replyChan, message, dist = os.pullEvent()
- if event == "key" then
- if key == keys.f then
- show = not show
- g.clear()
- if show then
- hello()
- end
- end
- elseif event == "modem_message" then
- if replyChan == 69 then
- rf = message
- elseif replyChan == 70 then
- cap = message
- elseif replyChan == 71 then
- out = message
- end
- if message == 0 then
- stanStat = "Escaping Tower..."
- ssCol = {255, 85, 0}
- elseif message == 1 then
- stanStat = "Watching for growth..."
- ssCol = {255, 0, 0}
- elseif message == 3 then
- stanStat = "Farming... 12.5%"
- ssCol = {255, 230, 0}
- elseif message == 2 then
- stanStat = "Farming... 25%"
- ssCol = {255, 230, 0}
- elseif message == 4 then
- stanStat = "Farming... 37.5%"
- ssCol = {255, 230, 0}
- elseif message == 5 then
- stanStat = "Farming... 50%"
- ssCol = {255, 230, 0}
- elseif message == 6 then
- stanStat = "Farming... 62.5%"
- ssCol = {255, 230, 0}
- elseif message == 7 then
- stanStat = "Farming... 75%"
- ssCol = {255, 230, 0}
- elseif message == 8 then
- stanStat = "Farming... 87.5%"
- ssCol = {255, 230, 0}
- elseif message == 9 then
- stanStat = "Farming... 99%"
- ssCol = {255, 230, 0}
- elseif message == 10 then
- stanStat = "Done, returning..."
- ssCol = {0, 255, 0}
- elseif message == "grab coal" then
- carlStat = "Grabbing a stack of coal..."
- carlCol = {50, 50, 50}
- elseif message == "grab iron" then
- carlStat = "Grabbing a stack of iron..."
- carlCol = {255, 255, 255}
- elseif message == "use coal" then
- carlStat = "Inserting a stack of coal..."
- carlCol = {50, 50, 50}
- elseif message == "use iron" then
- carlStat = "Inserting a stack of iron..."
- carlCol = {255, 255, 255}
- elseif message == "wait" then
- carlStat = "Waiting for enriched..."
- carlCol = {235, 235, 0}
- waits = replyChan
- elseif message == "wait dust" then
- carlStat = "Waiting for steel dust..."
- carlCol = {235, 235, 0}
- waits = replyChan
- elseif message == "grab enriched" then
- carlStat = "Grabbing enriched iron..."
- carlCol = {128, 0, 0}
- waits = 0
- elseif message == "use enriched" then
- carlStat = "Inserting enriched iron..."
- carlCol = {128, 0, 0}
- elseif message == "grab steel" then
- carlStat = "Grabbing steel dust..."
- carlCol = {70, 70, 70}
- waits = 0
- elseif message == "use steel" then
- carlStat = "Inserting steel dust..."
- carlCol = {70, 70, 70}
- elseif message == "done" then
- carlStat = "Chillin' out"
- carlCol = {0, 255, 255}
- end
- if show then
- g.clear()
- hello()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment