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

chat program error

Started by psycho_362, 14 April 2012 - 06:13 PM
psycho_362 #1
Posted 14 April 2012 - 08:13 PM
term.clear()
term.setCursorPos(1, 1)
print("Tomoyo Server I v1.0.1 - Config")

print("Where is your wireless modem located?")
local rednet_location
rednet_location = io.read()

if rednet_location == "left" then
print("Connected")
elseif rednet_location == "right" then
print("Connected")
elseif rendet_location == "back" then
print("Connected")
else
print("NOT VALID")
end

term.clear()
rednet.open(rednet_location) – Open Internet

local mode
local server_name
local user1id
local user2id
local user3id
local user4id
local user5id
local user1
local user2
local user3
local user4
local user5
local banned1id
local banned2id
local banned3id
local banned4id
local banned5id

print("Name server.")
server_name = io.read()

term.clear()

user1id = ""
user2id = ""
user3id = ""
user4id = ""
user5id = ""
user1 = ""
user2 = ""
user3 = ""
user4 = ""
user5 = ""

function select_mode ()

print("Please select your mode.")
mode = io.read()

if mode == "help" then
print("Mode List: ")
print("private")
print("public")
print("public ignore") – NEW
select_mode()
elseif mode == "private" then
print("Select User 1.")
user1id = io.read()
print("Select User 2.")
user2id = io.read()

user1id = tonumber(user1id)
user2id = tonumber(user2id)
timeline=0
server()
elseif mode == "public" then
print("Opening…")
timeline=0
auto_answer=0
users_wait=1
server_public()
elseif mode == "public ignore" then
print("Opening…")
print("How many users to wait for?")
users_wait = tonumber(io.read())
if users_wait >= 5 then
users_wait = 5
end
os.sleep(1)
print("Waiting for users to connect!")
os.sleep(2)
term.clear()
term.setCursorPos(1, 1)
print("Tomoyo Server I v1.0.1 - User-Finding Mode")
timeline=0
auto_answer = 1
server_public()
else
print("Invalid mode, type 'help' for a list of modes.")
os.sleep(1)
select_mode()
end

end


thats the code but when i put it in it tells me "bios:206: [string"chat"]:86: '=' expected". what am i doing wrong
Wolvan #2
Posted 14 April 2012 - 10:49 PM
try this instead of line 86

users_wait_read = read()
users_wait = tonumber(users_wait_read)
psycho_362 #3
Posted 14 April 2012 - 11:16 PM
sorry posted old version, removed the piblic ignore, that caused the server to crash, but still trying to do the rest
updated code:

local banned1id
local banned2id
local banned3id
local banned4id
local banned5id

print("Name server.")
server_name = io.read()

term.clear()

user1id = ""
user2id = ""
user3id = ""
user4id = ""
user5id = ""
user1 = ""
user2 = ""
user3 = ""
user4 = ""
user5 = ""

function select_mode ()

print("Please select your mode.")
mode = io.read()

if mode == "help" then
print("Mode List: ")
print("private")
print("public")
print("public ignore") – NEW

elseif mode == "private" then
print("Select User 1.")
user1id = io.read()
print("Select User 2.")
user2id = io.read()

user1id = tonumber(user1id)
user2id = tonumber(user2id)
timeline=0
server()
elseif mode == "public" then
print("Opening…")
timeline=0
auto_answer=0
users_wait=1
server_public()
os.sleep(1)
print("Waiting for users to connect!")
os.sleep(2)
term.clear()
term.setCursorPos(1, 1)
print("Tomoyo Server I v1.0.1 - User-Finding Mode")
timeline=0
auto_answer = 1
server_public()
else
print("Invalid mode, type 'help' for a list of modes.")
os.sleep(1)
select_mode()
end

end
psycho_362 #4
Posted 14 April 2012 - 11:31 PM
and now the error is bios:206: [string "chat"]:86: '=' expected
Luanub #5
Posted 15 April 2012 - 12:43 AM
I think you missed part of the code, there is only 66 lines and some of the functions are missing. What you posted works just fine, only thing is it only captures the server name since the only function listed is never called.