Posted 22 July 2016 - 06:59 PM
HI Guys!
I have a really annoying Problem with a program I'm writing. The program is called "KI6" and is 3000 lines long and work perfect until today.
It's a program for mining turtles, to search Ores and of course: find back!
Yesterday I added the function that it updates itself, by starting another program, which deletes, and redownloads "KI6". Yesterday it worked fine, today it doesn't. When I start my program I get an Error: bios:367: [string "KI6"]:1: '=' expected.
The strange thing is, when I remove any letter in my Program, save, rewrite the letter and save again (obviously nothing changed) the program works!
Then I terminate it and try it again and get the Error again?! This makes absoloutly no sense to me, but maybe someone can help?
My whole program on pastebin: http://pastebin.com/gkz5sgZ8
The part I wrote yesterday:
How the OCM.updater looks:
Pls help me, I'm really frustrated.
Sorry for bad english (I'm german)
EDIT: I found out what was wrong! It actually was an Error with automatic update and my text editor. Because, I accidently posted a wrong script onto pastebin where the Error occurs. So every time I started the program, it updated itself and started the now wrong script. But the script didn't get updated in my texteditor where I had opened the correct script. By removing and rewriting any letter in my texteditor, the correct script was saved again, and active again. So when I started the program again (this time it didn't load the wrong code from pastebin, because it knew that it updated right before) it worked. And after that it didn't work again because it updated to the wrong script again and so on and so on…
Thanks to anyone who tried to help, next time I will give all the information and a more Intelligent title to don't waste your time!
Bruno
I have a really annoying Problem with a program I'm writing. The program is called "KI6" and is 3000 lines long and work perfect until today.
It's a program for mining turtles, to search Ores and of course: find back!
Yesterday I added the function that it updates itself, by starting another program, which deletes, and redownloads "KI6". Yesterday it worked fine, today it doesn't. When I start my program I get an Error: bios:367: [string "KI6"]:1: '=' expected.
The strange thing is, when I remove any letter in my Program, save, rewrite the letter and save again (obviously nothing changed) the program works!
Then I terminate it and try it again and get the Error again?! This makes absoloutly no sense to me, but maybe someone can help?
My whole program on pastebin: http://pastebin.com/gkz5sgZ8
The part I wrote yesterday:
function save(path, content)
local file = fs.open(path, "w")
file.writeLine(content)
file.close()
end
if fs.exists("database/OCM/updater") == false then
save("database/updater", "0")
end
file = fs.open("database/OCM/updater","r")
local fileData = {}
local line = file.readLine()
repeat
table.insert(fileData, line)
line = file.readLine()
until line == nil
file.close()
updated = fileData[1]
if updated == "0" then
dead = 1
if shell.run("OCM.updater") == false then
term.clear()
print("test")
shell.run("pastebin get rUMt9siN OCM.updater")
term.clear()
print("loading...")
shell.run("OCM.updater")
end
end
if dead == 1 then
return
end
save("database/OCM/updater", "0")
How the OCM.updater looks:
function save(path, content)
local file = fs.open(path, "w")
file.writeLine(content)
file.close()
end
shell.run("delete KI6")
shell.run("pastebin get gkz5sgZ8 KI6")
term.clear()
print("updating...")
save("database/OCM/updater", "1")
shell.run("KI6")
Pls help me, I'm really frustrated.
Sorry for bad english (I'm german)
EDIT: I found out what was wrong! It actually was an Error with automatic update and my text editor. Because, I accidently posted a wrong script onto pastebin where the Error occurs. So every time I started the program, it updated itself and started the now wrong script. But the script didn't get updated in my texteditor where I had opened the correct script. By removing and rewriting any letter in my texteditor, the correct script was saved again, and active again. So when I started the program again (this time it didn't load the wrong code from pastebin, because it knew that it updated right before) it worked. And after that it didn't work again because it updated to the wrong script again and so on and so on…
Thanks to anyone who tried to help, next time I will give all the information and a more Intelligent title to don't waste your time!
Bruno
Edited on 17 August 2016 - 08:43 AM