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

Need help on server-side computer

Started by account_unused, 21 November 2014 - 09:28 PM
account_unused #1
Posted 21 November 2014 - 10:28 PM
When I try to execute this code it presents me with ''rednet:87: Number Expected''. Can someone please help?



term.clear()
rednet.open("front")
function refreshScreen()
  term.scroll(3)
  term.setCursorPos(1,1)
  term.setTextColor(1)
  print("Obscure Frameworks		   ")
  print("Mainframe V_0.1			  ")
  computerID = os.getComputerID()
  computerVersion = os.version()
  computerLabel = os.getComputerLabel()
  print("System Details:			  ")
  print("System Version: "..computerVersion)
  print("		 Label: "..computerLabel)
  print("		    ID: "..computerID)
  print("+--------System Log---------+")
  end
 
  refreshScreen()
 
while true do
  event, senderId, message, protocol = os.pullEvent("rednet_message")
  term.setCursorPos(1,23)
 
  if senderId == null then
    term.setTextColor(16384)
    print("Network Error!")
    print("  SID is null!")
    print("  Packet Blocked.")
    elseif message == null then
    term.setTextColor(16384)
    print("Network Error!")
    print("  Message is null!")
    print("  Packet Blocked.")
    elseif protocol == null then
    term.setTextColor(16384)
    print("Network Error!")
    print("  Protocol is null!")
    print("  Packet Blocked.")
    else
    term.setTextColor(8)
    print("Network Event!")
    print("  SID: "..senderId)
    print("  Message: "..message)
    print("  Protocol: "..protocol)
    if protocol ~= 4 then
   rednet.send(protocol,message,senderId)
   end
    end
  refreshScreen()
end
valithor #2
Posted 21 November 2014 - 11:42 PM
Where you use rednet.send you do protocol, message, senderId you need to do senderId, message, protocol in that order. Id first message second protocol last.
account_unused #3
Posted 22 November 2014 - 09:26 AM
Where you use rednet.send you do protocol, message, senderId you need to do senderId, message, protocol in that order. Id first message second protocol last.

All right, that works. Thanks!