ok so ive set up a computer, put in a pastebin get, run the program for the first time config
computer asks what side the modem is on, i am trying to run a check using this function:
local function sidevalid(str) local input = str local sidecount=6 for i2 = 1,6 do if input ~= sides[i2] then local sidecount = sidecount-1 if sidecount == 0 then local output=false else local output=true end end end return output end
this is where its used:
local function config ()--this bit works fine
mkfile(pcinfo)
print("insert name for this client pc")
id = read()
setstr(pcinfo,id)
shell.run("label set "..id)
print("input modem side, must be valid")
mside = read()
if not sidevalid(mside) then
repeat
sideerror()
mside = read()
until sidevalid(mside)
setstr(pcinfo,mside)
elseif sidevalid(mside) then
setstr(pcinfo,mside)
end
print("what side do you want as the redstone output?")
rside=read()
if not sidevalid(rside) then
repeat
sideerror()
rside = read()
until sidevalid(rside)
setstr(pcinfo,rside)
elseif sidevalid(rside) then
setstr(pcinfo,rside)
end
print("What server channel will this client be using?")
channel = tonumber(read())
channelfeed = tostring(channel)
print("channel entered:"..channelfeed)
print("querying matching server, please be patient")
modem=peripheral.wrap(mside)
local state = false
if not state then
modem.open(channel)
local timeout = os.startTimer(3)
modem.transmit(channel,channel,channelfeed)
local event = {os.pullEvent()}
print("transmitting info")
if event[1] == "modem_message" then --this section of code just wont fire
print("server query success!")
setstr(pcinfo,channel)
mkfile("config")
print("config complete, rebooting in...")
state = true
for i = 3,0,-1 do
if i == 0 and state then
shell.run("reboot")
end
print(tostring(i).."...")
sleep(1)
end
elseif event[1] == "timer" then
state=false
print("no response or wrong channel number entered, please reboot and try again...")
print("aborting config and rebooting!")
sleep(1)
shell.run("reboot")
end
end
end
when that code is triggered after the side is entered, my sideerror function fires, which means sidevalid is returning false, which means i am using a wrong method of a check
any suggestions get a thumbs up
heres the link to full code
http://pastebin.com/qufnLXtb
Edited by CreeperGoBoom, 29 May 2014 - 06:35 AM.











