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

Automatic Updating and Loading Variables from other programs

Started by Lithia, 14 December 2012 - 01:10 PM
Lithia #1
Posted 14 December 2012 - 02:10 PM
Hey pro's :3

Today i was working on a massive program that connects to Pastebin and verify's its version
if it see's that its out of date it will re download its self from pastebin and reboot

the special thing is that i can edit the scripts on pastebin so each time a Computer Verify's it can download the updates straight away

i am currently having Errors with some of the coding and i don't know where the problem is

If you want to have a try just type in the command

pastebin get RP4QxT7X lithium

and then boot the program called lithium and it should auto install

Happy hunting :3

BTW ive been searching for at least 2 hours on where the error is and i still cannot find it :/
Orwell #2
Posted 14 December 2012 - 02:14 PM
The verify program is missing an end at the bottom:
http://pastebin.com/2ssVXAXd

I'm not sure that's the only error your getting, I was just browing through the pasties.
Lithia #3
Posted 14 December 2012 - 02:19 PM
nah thats not the problem
all the programs install
They are just getting the cannot find end Error when i attach them to other scripts
they are suppost to flow with the scripts and set variables
Orwell #4
Posted 14 December 2012 - 02:27 PM
Then what is the error message you're getting? Could you post the message and the pastie of that file? I don't have time to install it myself, maybe someone else has.
Lithia #5
Posted 14 December 2012 - 03:25 PM
Then what is the error message you're getting? Could you post the message and the pastie of that file? I don't have time to install it myself, maybe someone else has.

Well its hard to explain where the error is coming from
but ill set an example

The Code of the Version Verify Runs off 3 programs that boot eachother to run certain tasks

First off the startup so that would be


STARTUP
shell.run("verify")
if uptodate == "true" then
shell.run("program")
elseif uptodate == "false" then
shell.run("update")

VERIFY
currentversion = "eight"
nextversion = "nine"
shell.run("pastebin", "get", "-Pastebin code-", "version")
shell.run("version")
shell.run("delete", "version")
if version == currentversion then
uptodate = "true"
elseif version == nextversion then
uptodate = "false"

PROGRAM
Insert whatever program you want in here

UPDATE
shell.run("pastebin", "get", "-pastebin code-", "install")
shell.run("install")

INSTALL
print("installing")
shell.run("delete", "startup")
shell.run("delete", "verify")
shell.run("delete", "program")
shell.run("pastebin", "get", "-pastebincode-", "startup")
shell.run("pastebin", "get", "-pastebincode-", "verify")
shell.run("pastebin", "get", "-pastebincode-", "program")
print("installed")
shell.run("delete", "install")
os.reboot()

Here's a Diagram
Lithia #6
Posted 14 December 2012 - 03:40 PM
oh and the Error is

Bios:206: [string "startup"]:3: 'then' expected
dissy #7
Posted 14 December 2012 - 04:57 PM
I just now made a couple programs that chained together as your startup does, and it wouldn't even interpret without closing the if statements with an end in both verify and startup.
I realize the program you are jumping to does an os.reboot, so it will never resume execution there after running update, but it's the only bug I see that I know for sure will cause an error.
Lithia #8
Posted 14 December 2012 - 10:12 PM
the reboot will start the startup program which will boot the Hooked program if Verify is "True"
i think its the IF and Elseif statements on VERIFY
but i don't know how to fix them
Orwell #9
Posted 14 December 2012 - 10:26 PM
the reboot will start the startup program which will boot the Hooked program if Verify is "True"
i think its the IF and Elseif statements on VERIFY
but i don't know how to fix them
Put an 'end' at the bottom?
Lithia #10
Posted 14 December 2012 - 11:28 PM
the reboot will start the startup program which will boot the Hooked program if Verify is "True"
i think its the IF and Elseif statements on VERIFY
but i don't know how to fix them
Put an 'end' at the bottom?

that doesnt work either it prompts for a then statement when its allredy there
CoolisTheName007 #11
Posted 14 December 2012 - 11:45 PM
snip

print("Checking Version")
shell.run("pastebin", "get", "qjP51EzM", "versioncheck")
shell.run("versioncheck")
shell.run("delete", "versioncheck")
version = "seven"
nextversion = "eight"
if version == nextversion then
   uptodate = "false"
   shell.run("startup")
elseif version == version then
    print("Version Up to date")
    uptodate = "true"
   shell.run("startup")
--this is missing:
end

You should really use indent every code block (if…end, function…end, while…end,repeat …until). It's basically the least people expect, and to be frank I wouldn't be surprised if some people just ignored requests for help if the code was not properly indented and the error message was not given(but you did include that). I think that Orwell is just expecting you to give it a try, but I had time now.
Lithia #12
Posted 14 December 2012 - 11:59 PM
Argh im confused now XD
let me peice the program together to see if it works :3
Lithia #13
Posted 15 December 2012 - 12:03 AM
OH WOOPS
Major mistake
sorry the Program that was having errors was the Startup program on line 3

the code is

print("checking version")
shell.run("verify")
if uptodate = "true" then
shell.run("program")
elseif uptodate = "false" then
shell.run("update")
end

and the error message is

bios:206: [string "startup"]:3: 'then' expected
Orwell #14
Posted 15 December 2012 - 12:44 AM
* snip *

print("checking version")
shell.run("verify")
if uptodate = "true" then
shell.run("program")
elseif uptodate = "false" then
shell.run("update")
end

should be:

print("checking version")
shell.run("verify")
if uptodate == "true" then
shell.run("program")
elseif uptodate == "false" then
shell.run("update")
end
Lithia #15
Posted 15 December 2012 - 12:47 AM
* snip *

print("checking version")
shell.run("verify")
if uptodate = "true" then
shell.run("program")
elseif uptodate = "false" then
shell.run("update")
end

should be:

print("checking version")
shell.run("verify")
if uptodate == "true" then
shell.run("program")
elseif uptodate == "false" then
shell.run("update")
end

The CC Website must be having some bugs
there's no spaces when i try to post code
i have the spaces in my original code though
Orwell #16
Posted 15 December 2012 - 02:02 AM
* snip *

print("checking version")
shell.run("verify")
if uptodate = "true" then
shell.run("program")
elseif uptodate = "false" then
shell.run("update")
end

should be:

print("checking version")
shell.run("verify")
if uptodate == "true" then
shell.run("program")
elseif uptodate == "false" then
shell.run("update")
end

The CC Website must be having some bugs
there's no spaces when i try to post code
i have the spaces in my original code though
You need to change the '=' to '==' everywhere in that script. I looked no pastebin and you have single ='s there as well. While your code snippets posted earlier in this thread did this correctly. Just change '=' to '==' twice in the program 'startup'.
Lithia #17
Posted 15 December 2012 - 03:00 PM
oh i didnt Realise that Thanks ^_^/>
Geforce Fan #18
Posted 15 December 2012 - 03:10 PM
Remove the break in lock
Lithia #19
Posted 15 December 2012 - 03:42 PM
Okay i fixed it! ^_^/> thankyou everyone for your support!