The link for the code is here http://pastebin.com/JdFPHCfs
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
My 136 lines of code does nothing?
Started by koslas, 07 August 2012 - 01:13 AMPosted 07 August 2012 - 03:13 AM
I am having trouble with this code. As stated in the title I made a program with 136 lines of code, but when I run the program it does NOTHING. It doesn't even give me errors…
The link for the code is here http://pastebin.com/JdFPHCfs
The link for the code is here http://pastebin.com/JdFPHCfs
Posted 07 August 2012 - 04:05 AM
Well you are calling the function printMain() which doesn't exist.
EDIT: Nvm I didn't see the function. Now I see it XD
EDIT: Nvm I didn't see the function. Now I see it XD
Posted 07 August 2012 - 04:13 AM
printMain fuction that exists:
function printMain()
if nSelect == 1 then clear()
printCentered(2, "PickOS")
printCentered(4, "[Login]")
printCentered(5, " Register ")
printCentered(6, " Update ")
printCentered(7, " Exit ")
printCentered(8, " Shutdown ")
else end
if nSelect == 2 then clear()
printCentered(2, "PickOS")
printCentered(4, " Login ")
printCentered(5, "[Register]")
printCentered(6, " Update ")
printCentered(7, " Exit ")
printCentered(8, " Shutdown ")
else end
if nSelect == 3 then clear()
printCentered(2, "PickOS")
printCentered(4, " Login ")
printCentered(5, " Register ")
printCentered(6, "[Update]")
printCentered(7, " Exit ")
printCentered(8, " Shutdown ")
else end
if nSelect == 4 then clear()
printCentered(2, "PickOS")
printCentered(4, " Login ")
printCentered(5, " Register ")
printCentered(6, " Update ")
printCentered(7, "[Exit]")
printCentered(8, " Shutdown ")
else end
if nSelect == 5 then clear()
printCentered(2, "PickOS")
printCentered(4, " Login ")
printCentered(5, " Register ")
printCentered(6, " Update ")
printCentered(7, " Exit ")
printCentered(8, "[Shutdown]")
else end
Posted 07 August 2012 - 05:30 AM
You really should learn how if blocks work, including proper usage of elseif.
Also, it looks like it should be throwing all kinds of errors. Is that pastebin the most updated code? The printMain function you just put in your last post is different from the one in your code. Please provide the most updated copy of the code, and the errors it's giving.
Also, it looks like it should be throwing all kinds of errors. Is that pastebin the most updated code? The printMain function you just put in your last post is different from the one in your code. Please provide the most updated copy of the code, and the errors it's giving.
Posted 07 August 2012 - 06:49 AM
Yes that pastebin code is the most updated, bu i am getting the error
bios:206: [string "startup"]:89: '=' expected
bios:206: [string "startup"]:89: '=' expected
Posted 07 August 2012 - 08:22 AM
Problem is on line 88, remove the print from it. Or change it so the syntax is correct for a blank print. See comment below.
elseif key == 28 and nSelect == 1 then print -- if the print is needed do print("")
clear()
Posted 07 August 2012 - 12:42 PM
Problem is on line 88, remove the print from it. Or change it so the syntax is correct for a blank print. See comment below.elseif key == 28 and nSelect == 1 then print -- if the print is needed do print("") clear()
Umm… wait, what!? A blank print will do nothing for you. Not to mention, just putting the word "print" isn't going to actually call anything…
You really should learn how if blocks work, including proper usage of elseif.rintMain function you just put in your last post is different from the one in your code. Please provide the most updated copy of the code, and the errors it's giving.
YES!!! LEARN THE IF/THEN/ELSEIF/ELSE!!!!!!!
Badasspick… Test around with it a little to see how things react. Take apart the code, piece by piece, till you find what part isn't working. It may be VERY tedious, but the payout is great. Not only do you fix your programs, but all in all, it makes you a better programmer :P/>/>
Try out this tutorial and see if it helps your understanding a bit more so.
if then else - Lua
Posted 07 August 2012 - 01:09 PM
Problem is on line 88, remove the print from it. Or change it so the syntax is correct for a blank print. See comment below.elseif key == 28 and nSelect == 1 then print -- if the print is needed do print("") clear()
Umm… wait, what!? A blank print will do nothing for you. Not to mention, just putting the word "print" isn't going to actually call anything…You really should learn how if blocks work, including proper usage of elseif.rintMain function you just put in your last post is different from the one in your code. Please provide the most updated copy of the code, and the errors it's giving.
YES!!! LEARN THE IF/THEN/ELSEIF/ELSE!!!!!!!
Badasspick… Test around with it a little to see how things react. Take apart the code, piece by piece, till you find what part isn't working. It may be VERY tedious, but the payout is great. Not only do you fix your programs, but all in all, it makes you a better programmer :P/>/>
Try out this tutorial and see if it helps your understanding a bit more so.
if then else - Lua
1) print is a lua function, if you type just print without any of the rest of the proper syntax following it you will get the error he posted in his most current post. Try it…
I have already tested his code and that will fix the error.
2) His current post has proper if/elseif formatting so I'm not sure why you're telling him something that someone else did and that he obviously followed their advice on..
Posted 07 August 2012 - 03:31 PM
its line 101 you spelled nSelect wrong :P/>/> please reply if this helped you