bios:338: [string "rednet"]:6: '<name>' expected
Here's my code. There are some additional things I would like to add but I'll ask about those after the errors are resolved.
function receive() --receives rednet messages, timeout is set by user
term.clear()
term.setCursorPos(1,1)
print("Duration:")
local var = tonumber(read())
local senderId, message, distance = rednet.receive(var) --resolved issue in line 6 (extra comma)
print("")
write("From:")
print("senderId")
print("message")
end
function send() --sends custom message to specified computer
term.clear()
term.setCursorPos(1,1)
print("TargetID:")
local var = tonumber(read())
print("Message:")
local var1 = read()
rednet.send(var,var1)
end
function broadcast() --broadcasts custom message
term.clear()
term.setCursorPos(1,1)
print("Message:")
local var = read()
rednet.broadcast(var)
end
function configure() --allows user to either open or close a connection on a specified side
while true do --resolved issue in line 32 (capital W)
term.clear()
term.setCursorPos(1,1)
print("Do you want to open or close a connection?")
local var = read()
if var == "open" then
print("Which side would you like to connect?")
local var1 = read()
rednet.open(var1)
elseif var == "close" then
print("Which side would you like to disconnect?")
local var2 = read()
rednet.close(var2)
else
print("Invalid Response")
sleep(2)
end
end
end
function announce() --just announces
term.clear
term.setCursorPos(1,1)
rednet.announce()
end
while true do --this is the menu part
term.clear() --sets up the terminal and prints all the menu text
term.setCursorPos(1,1)
print("Welcome to RedNet!")
print("v1.0.0")
print("")
print("Actions:")
print("1. Receive")
print("2. Send Message")
print("3. Broadcast Message")
print("4. Configure Modem")
print("5. Announce")
print("")
write("Perform action ")
local var = read() --reads the input and then there's a long conditional statement
if var == "1" then -- corresponds to the printed menu
receive() --this is suppose to call the corresponding function
elseif var == "2" then
send()
elseif var == "3" then
broadcast()
elseif var == "4" then
configure()
elseif var == "5" then
announce()
else --if I enter something stupid like "axolotl" this is supposed to print the next line and restart the loop
print("This action does not exist.")
end
end












