[ create a new paste ] login | about

Link: http://codepad.org/QPt7VtDb    [ raw code | output | fork ]

Lua, pasted on Nov 29:
-- Wrap the modem and monitor
local mon = peripheral.wrap("right")
local wmod = peripheral.wrap("back")

-- Open different channels for different liquids
wmod.open(11) --For steam liquid tank
wmod.open(12) --For fruit juice tank
wmod.open(13) --For biomass tank
wmod.open(14) --For ethanol tank

mon.clear()
mon.setCursorPos(1,1)
mon.write("Liquid status:")

-- Main loop, never stop
while true

  -- Check for incoming data on any open channel
  local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")

  -- Add one case for every liquid
  -- Change channel and text for each

  if senderChannel == 11 then
    mon.setCursorPos(1,2)
    mon.write(message .."        ")
    print(message .." from Steam Liquid tank,")
  elseif senderChannel == 12 then
    mon.setCursorPos(1,3)
    mon.write(message .."        ")
    print(message .." from Fruit Juice tank.")
  elseif senderChannel == 13 then
    mon.setCursorPos(1,4)
    mon.write(message .."        ")
    print(message .."from Biomass Tank.")
  elseif senderChannel == 14 then
    mon.setCursorPos(1,5)
    mon.write(message .."        ")
    print(message .."from Ethanol Tank.")  
  end
  
end


Output:
1
line 19: 'do' expected near 'local'


Create a new paste based on this one


Comments: