This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dom123's profile picture

Help with Rednet

Started by dom123, 08 January 2014 - 04:00 PM
dom123 #1
Posted 08 January 2014 - 05:00 PM
I have a program of a turtle that builds a wither and then kills it. I want to incorporate some wireless rednet into the program both for some flavor and to start expanding my experience towards rednet. I want it to provide status messages, like "Wither construction commencing", "Wither deconstruction commencing"
– Do to space limits in the area i will be opting for manual feeding and reloading.
(* server has gamerule mobgriefing == false so the wither is defenseless to a turtle)

Current Melee Turtle Program (No rednet):
http://pastebin.com/ZJ8q8q2G

Melee Turtle (My Rednet Attempt):
http://pastebin.com/SJRVjAtX

Information Terminal:
<I cant get anything to work.>


I don't what the limitations are but I wanted to use an ADV-Computer linked to a monitor; (I would like the first 3 options fuel/soulsand/wither skull to have a green or Red background depending on the message received from the turtle)

FUEL
SOULSAND STOCK
WITHER SKULL STOCK

STATUS: <"Wither construction commencing", "Wither deconstruction commencing">

Any help would be great. This way I can learn and expand from this sample/ help with code.
CometWolf #2
Posted 08 January 2014 - 06:38 PM
Looks to me like you got everything in place, in a albeit weird way, but it should do the trick. What you need now is to receive these messages on the computer controlling your monitor, and reacting accordingly.

local mon = peirpheral.wrap(string side of monitor) --connect the monitor to the computer
local fuelColor,witherColor,soulSandColor = colors.green,colors.green,colors.grenn
while true do
  local id,message = rednet.receive() --receives messages
  mon.setBackgroundColor(colors.black) -- now that the monitor is wrapped to the variable mon, we can use it the same way we would term.
  mon.clear()
  mon.setCursorPos(1,1)
  if message == "FuelEmpty" then --just FYI, you can use spaces in rednet messages.
    fuelColor = colors.red
  elseif message == "FuelGood" then
    fuelColor = colors.green
  end
  mon.setBackgroundColor(fuelColor)
  mon.write"Fuel"
end
You get the idea, just expand on this code.
Edited on 08 January 2014 - 09:27 PM