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

Title: Problem With A Downloading Program

Started by DannySMc, 19 September 2013 - 07:58 AM
DannySMc #1
Posted 19 September 2013 - 09:58 AM
Okay so I am making a downloader program but it keeps saying:

startup:23: attempt to index ? (a nil value)

I have looked over this code constantly and I have no idea where it is coming from? help please
her is the program code:

term.clear()
term.setCursorPos(1,1)
print("|=================================================|")
print("| Welcome to HiveOnline - Version: 1.11.2 (Alpha) |")
print("|-------------------------------------------------|")
print("| All Hive products and logos are licensed under  |")
print("| the Creative Commons Attribution-NoDerivs 3.0   |")
print("| Unported License. To view this license, visit:  |")
print("| http://creativecommons.org/licenses/by-nd/3.0/. |")
print("|-------------------------------------------------|")
print("| Do you accept the license?					  |")
print("| + Press 1 for Yes							   |")
print("| + Press 2 for No							    |")
print("|=================================================|")
local event, param1 = os.pullEvent("char")
if param1 == "1" then
print("Thank you for accepting the license")
sleep(1)
print("Downloading Installer, Please Stand By...")
installer = http.get("https://raw.github.com/dannysmc95/hiveonline/master/installer")
installerFile = installer.readAll()
local file = fs.open("installer", "w" )
file.write(installerFile)
file.close()
print("Done!")
	    shell.run("installer")
elseif param1 == "2" then
term.clear()
term.setCursorPos(1,1)
print("Sorry!")
print("This operating system isn't available to users")
print("who do not accept the license.")
print(" ")
print("DannySMc")
os.shutdown()
else
os.reboot()
end
Goof #2
Posted 19 September 2013 - 10:10 AM
Its because of
installer = http.get("https://raw.github.c...aster/installer") – The link is broken…

Spoiler


term.clear()
term.setCursorPos(1,1)
print("|=================================================|")
print("| Welcome to HiveOnline - Version: 1.11.2 (Alpha) |")
print("|-------------------------------------------------|")
print("| All Hive products and logos are licensed under  |")
print("| the Creative Commons Attribution-NoDerivs 3.0   |")
print("| Unported License. To view this license, visit:  |")
print("| http://creativecommons.org/licenses/by-nd/3.0/. |")
print("|-------------------------------------------------|")
print("| Do you accept the license?                                       |")
print("| + Press 1 for Yes                                                         |")
print("| + Press 2 for No                                                           |")
print("|=================================================|")
local event, param1 = os.pullEvent("char")
if param1 == "1" then
print("Thank you for accepting the license")
sleep(1)
print("Downloading Installer, Please Stand By...")
installer = http.get("https://raw.github.com/dannysmc95/hiveonline/master/installer") -- get the source code for the installerFile
installerFile = installer.readAll()
installer.close()
local file = fs.open("installer", "w" )
file.write(installerFile)
file.close()
print("Done!")
sleep(1) -- sleep
shell.run("installer")
elseif param1 == "2" then
term.clear()
term.setCursorPos(1,1)
print("Sorry!")
print("This operating system isn't available to users")
print("who do not accept the license.")
print(" ")
print("DannySMc")
sleep(1) -- Remember sleep before shutdown... else the text wont be displayed.
os.shutdown()
else
os.reboot()
end
DannySMc #3
Posted 19 September 2013 - 10:13 AM
Its because of
installer = http.get("https://raw.github.c...aster/installer") – The link is broken…

Spoiler



Thanks for that, didn't see that at all. Must of deleted it….:/ thanks
Goof #4
Posted 19 September 2013 - 10:14 AM
Glad, I could help. Good luck with your script / program :)/>/>