ComputerCraft Archive

furnace status

computer networking scorewinner github

Description

Scripts for Minecraft CC:Tweaked

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/scorewinner/computercraft-scripts/main/furnace-status.lua furnace_status
Archive:wget https://cc.shobie.xyz/cc/get/gh-scorewinner-computercraft-scripts-furnace-status furnace_status
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-scorewinner-computercraft-scripts-furnace-status furnace status

Usage

Run: furnace-status

Tags

networking

Source

View Original Source

Code Preview

local modem = peripheral.find("modem") or error("No modem attached", 0)
local monitor = peripheral.find("monitor")
local speaker = peripheral.find("speaker")

monitor.setTextScale(0.5)
monitor.clear()
monitor.setCursorPos(4,1)
monitor.write("Furnace 1")
monitor.setCursorPos(4,2)
monitor.write("Fill Lvl")
monitor.setCursorPos(6,3)
monitor.write("loading")

while true do
  if modem.isOpen(11) then
    sleep(5)
    local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
    
    monitor.clear()
    monitor.setCursorPos(4,1)
    monitor.write("Furnace 1")
    monitor.setCursorPos(4,2)
    monitor.write("Fill Lvl")
    
    if message == 15.0 then
      monitor.setBackgroundColor(colors.green)
    elseif message == 10.0 then
      monitor.setBackgroundColor(colors.yellow)
    elseif message == 5.0 then
      monitor.setBackgroundColor(colors.orange)
    elseif message == 0.0 then
      monitor.setBackgroundColor(colors.red)
      speaker.playNote("bell", 3, 6)
    end

    monitor.setCursorPos(6,3)
    monitor.write(message)
    
    
    
  else
    modem.open(11)
  end
end