Posted 04 October 2013 - 06:04 PM
hey i got a problem with an update program i am making. it's supposed to run startup after 5 sec if no rednet signal has been received, but instead i just get an error after 5 sec and it doesn't start the startupprogram. the error is
Rednet:11: string expected
hope i can get some help with it :)/>
the error is Rednet:11: string expected
thanks in advance :)/>
startup program as requested by Lyqyd –not sure why it screws up the first lines in the spoiler
Rednet:11: string expected
hope i can get some help with it :)/>
rednet.open("top")
if fs.exists("startup") == false then
shell.run("pastebin get 9rHSjf3j startup")
shell.run("pastebin get URxGE5tL information")
end
os.startTimer(5)
while true do
local program = "builder"
e,s,msg,dis = os.pullEvent()
if e == "timer" then
shell.run("startup")
elseif e == "rednet_message" and string.sub(msg,1,string.find(msg," ")-1) == "update" then
if string.sub(msg,string.find(msg," ")+1,string.len(msg)) == program then
local pystebin = string.sub(msg,string.len("update "..program)+1,string.len(msg))
fs.delete("startup")
shell.run("pastebin","get",pystebin,"startup")
end
end
end
the error is Rednet:11: string expected
thanks in advance :)/>
startup program as requested by Lyqyd –not sure why it screws up the first lines in the spoiler
Spoiler
information1 = {}
function information()
ful = fs.open("information","r")
information1 = textutils.unserialize(ful.readAll())
ful.close()
item = information1[item]
rs_side = information1[rs_side]
num_items = information1[num_items]
rednet.open(information1[rednet_side])
m = peripheral.wrap(information[peripheral_wrap])
direction = information1[direction]
time1 = information1[time1]
produkt = information1[produkt]
end
information()
while true do
local lol = true
local cool = 1
local myth = math.ceil((number-cool)/produkt)
e,s,msg,dis = os.pullEvent("rednet_message")
local ytem = string.sub(msg,1,string.find(msg," ")-1)
if ytem == item then
for k,v in pairs(m.list(direction)) do
if v ~= nil then
cool = cool + v
end
end
local number = tonumber(string.sub(msg,string.find(msg," "),string.len(msg)))
for w = 1,myth do
for i = 1,num_items do
rs.setOutput(rs_side,true)
os.startTimer(time1/2)
os.pullEvent("timer")
rs.setOutput(rs_side,false)
os.startTimer(time1/2)
os.pullEvent("timer")
end
end
while lol == true do
for k,v in pairs(m.list(direction)) do
if number <= v then
rednet.send(s,item.." ".."done")
lol = false
end
os.startTimer(2)
os.pullEvent("timer")
end
end
end
end