Error: game:133: attempt to index ? (a nil value)
if not http then -- HTTP API verification
print "HTTP API must be enabled to use SupGames"
print "Turn \"enableapi_http\" to true in [minecraft folder]/config/ComputerCraft.cfg"
else
-- Variables ---------------------------------------------------------------------------------------
pastebinGameListId = "raw.php?i=74KbnWZT" -- Pastebin ID of "GameList.txt"
--pastebinGameListId = "raw.php?i=craMFkP1"
-- Functions ----------------------------------------------------------------------------------
function printMenu(selected)
term.setCursorPos(1,2)
indic = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}
indic[selected] = "> "
if gameNums > 19 then
if gameNums > 0 and menu1page == 1 then print (indic[1]..names[1].." - by "..devloppers[1]) end
if gameNums > 1 and menu1page == 1 then print (indic[2]..names[2].." - by "..devloppers[2]) end
end
if gameNums > 2 and menu1page == 1 then print (indic[3]..names[3].." - by "..devloppers[3]) end
if gameNums > 3 and menu1page == 1 then print (indic[4]..names[4].." - by "..devloppers[4]) end
if gameNums > 4 and menu1page == 1 then print (indic[5]..names[5].." - by "..devloppers[5]) end
if gameNums > 5 and menu1page == 1 then print (indic[6]..names[6].." - by "..devloppers[6]) end
if gameNums > 6 and menu1page == 1 then print (indic[7]..names[7].." - by "..devloppers[7]) end
if gameNums > 7 and menu1page == 1 then print (indic[8]..names[8].." - by "..devloppers[8]) end
if gameNums > 8 and menu1page == 1 then print (indic[9]..names[9].." - by "..devloppers[9]) end
if gameNums > 9 and menu1page == 1 then print (indic[10]..names[10].." - by "..devloppers[10]) end
if gameNums > 10 and menu1page == 1 then print (indic[11]..names[11].." - by "..devloppers[11]) end
if gameNums > 11 and menu1page == 1 then print (indic[12]..names[12].." - by "..devloppers[12]) end
if gameNums > 12 and menu1page == 1 then print (indic[13]..names[13].." - by "..devloppers[13]) end
if gameNums > 13 and menu1page == 1 then print (indic[14]..names[14].." - by "..devloppers[14]) end
if gameNums > 14 and menu1page == 1 then print (indic[15]..names[15].." - by "..devloppers[15]) end
if gameNums > 15 and menu1page == 1 then print (indic[16]..names[16].." - by "..devloppers[16]) end
if gameNums > 16 and menu1page == 1 then print (indic[17]..names[17].." - by "..devloppers[17]) end
if gameNums > 17 and menu1page == 1 then print (indic[18]..names[18].." - by "..devloppers[18]) end
if gameNums > 18 and menu1page == 1 then print (indic[19]..names[19].." - by "..devloppers[19]) end
if gameNums > 19 and menu1page == 2 then print (indic[20]..names[20].." - by "..devloppers[20]) end
if gameNums > 20 and menu1page == 2 then print (indic[21]..names[21].." - by "..devloppers[21]) end
if gameNums > 21 and menu1page == 2 then print (indic[22]..names[22].." - by "..devloppers[22]) end
if gameNums > 22 and menu1page == 2 then print (indic[23]..names[23].." - by "..devloppers[23]) end
if gameNums > 23 and menu1page == 2 then print (indic[24]..names[24].." - by "..devloppers[24]) end
if gameNums > 24 and menu1page == 2 then print (indic[25]..names[25].." - by "..devloppers[25]) end
if gameNums > 25 and menu1page == 2 then print (indic[26]..names[26].." - by "..devloppers[26]) end
if gameNums > 26 and menu1page == 2 then print (indic[27]..names[27].." - by "..devloppers[27]) end
if gameNums > 27 and menu1page == 2 then print (indic[28]..names[28].." - by "..devloppers[28]) end
if gameNums > 28 and menu1page == 2 then print (indic[29]..names[29].." - by "..devloppers[29]) end
if gameNums > 29 and menu1page == 2 then print (indic[30]..names[30].." - by "..devloppers[30]) end
if gameNums > 30 and menu1page == 2 then print (indic[31]..names[31].." - by "..devloppers[31]) end
if gameNums > 31 and menu1page == 2 then print (indic[32]..names[32].." - by "..devloppers[32]) end
if gameNums > 32 and menu1page == 2 then print (indic[33]..names[33].." - by "..devloppers[33]) end
if gameNums > 33 and menu1page == 2 then print (indic[34]..names[34].." - by "..devloppers[34]) end
if gameNums > 34 and menu1page == 2 then print (indic[35]..names[35].." - by "..devloppers[35]) end
if gameNums > 35 and menu1page == 2 then print (indic[36]..names[36].." - by "..devloppers[36]) end
if gameNums > 36 and menu1page == 2 then print (indic[37]..names[37].." - by "..devloppers[37]) end
if gameNums > 37 and menu1page == 2 then print (indic[38]..names[38].." - by "..devloppers[38]) end
end
function clear() -- Clear the screen
term.clear()
term.setCursorPos(1,1)
end
function downloadGameList()
gameList = http.get("http://pastebin.com/"..pastebinGameListId) -- Get the text from pastebin
end
function main()
clear()
term.setCursorPos(21, 9)
print "SupGames 1.0"
sleep(math.random(5,8))
clear()
end
function readGameList()
stat = 0
ids = { }
names = { }
fileNames = { }
devloppers = { }
urls = { }
requireAdv = { }
dwnurl = { }
repeat
line = gameList.readLine()
if line ~= nil then
names[#names + 1] = gameList.readLine()
fileNames[#fileNames + 1] = gameList.readLine()
devloppers[#devloppers + 1] = gameList.readLine()
urls[#urls + 1] = gameList.readLine()
dwnurl[#dwnurl + 1] = gameList.readLine()
requireAdv[#requireAdv + 1] = gameList.readLine()
end
until line == nil
gameNums = #names
end
function menu()
menu1Stat = 3
repeat
clear()
pressedOk = false
if menu1Stat < 20 then menu1page = 1
elseif menu1Stat > 19 and menu1Stat < 38 then menu1page = 2 end
printMenu(menu1Stat)
term.setCursorPos(1,1)
term.clearLine()
print "SupGames 1.0"
event, param1 = os.pullEvent("key")
if param1 == 208 then menu1Stat = menu1Stat + 1
elseif param1 == 200 then menu1Stat = menu1Stat - 1
elseif param1 == 28 then pressedOk = true
end
if menu1Stat == gameNums + 1 then menu1Stat = 3
elseif menu1Stat == 2 then menu1Stat = gameNums end
until pressedOk == true
if fs.exists("games/"..names[menu1Stat]) ~= true then
http1 = http.get("http://pastebin.com/"..dwnurl[menu1Stat])
http1.close()
filetogame = fs.open("games/"..names[menu1Stat], "w")
repeat
line = http1.readLine()
if line ~= nil then
filetogame.writeLine(line)
end
until line == nil
filetogame.close() -- Line 133 <------------------------------
end
shell.run("games/"..names[menu1Stat])
end
-- Execution
main()
clear()
print "Please wait..."
print "Downloading game list..."
downloadGameList()
clear()
print "Please wait..."
print "Reading game list..."
readGameList()
clear()
menu()
end