Posted 16 November 2012 - 04:21 AM
My OS.pullEvent script is acting up again, could someone correct it for me?
ver = "1.0"
function ftphost(fpath,finputid)
rednet.send(finputid,"SKS-UPLOAD")
sleep(0.5)
file = fs.open(path,"r")
content = file.readAll()
rednet.send(inputid,(content))
file.close()
end
function ftpclient(fpath,finputid)
rednet.send(finputid,"SKS-DOWNLOAD")
sleep(0.5)
file = fs.open(path,"w")
id, msg = rednet.receive()
if id == inputid then
file.write((msg))
file.close()
end
end
term.clear()
term.setCursorPos(1,1)
print(" ** SKS-OS v"..ver.." ** ")
while true do
write "$> "
local command = read()
if command == "LOAD" then
print "LOAD FROM:"
local loadname = read()
print "LOADING"
if fs.exists("/sksRAM") then fs.delete("/sksRAM") end
if fs.exists("disk/"..loadname) then
fs.copy("disk/"..loadname,"/sksRAM")
print "LOADED"
else
print "404 - FELINE NOT FOUND"
end
elseif command == "SAVE" then
print "FILENAME:"
local savename = read()
if fs.exists("disk/"..savename) then fs.delete("disk/"..savename) end
if fs.exists("/sksRAM") then fs.copy("/sksRAM","disk/"..savename) end
elseif command == "RUN" then
if fs.exists("/sksRAM") then shell.run("/sksRAM") end
elseif command == "EDIT" then
shell.run("edit","sksRAM")
elseif command == "REDSET" then
print "ID:"
id = tonumber(read())
print "VALUE:"
value = read()
rednet.send(id,textutils.serialize({"SKS-REDSET",value}))
elseif command == "FTP" then
print "SEND OR RECEIVE? S/R"
event, char = os.pullEvent()
if char == "s" then
print "ID TO SEND TO:"
id = read()
ftphost("sksRAM",id)
elseif char == "r" then
print "ID TO RECEIVE FROM:"
id = read()
ftpclient("sksRAM",id)
end
end
end
it is this peice of code here:
event, char = os.pullEvent()