Spoiler
http://pastebin.com/QE96u2TsSpoiler
http://pastebin.com/gAUqnUH2P.S. This 100% my code!
while true do
shell.run("clear")
write("Would you like to turn the lights on or off? ")
local YesOrNo = read()
if YesOrNo == "on" then
rs.setOutput("back", true)
elseif YesorNo == "off" then
rs.setOutput("back", false)
else
print("Please use "on" or "off"")
sleep(3)
end
end
term.clear()
term.setCursorPos(15, 8)
print("Hit Enter to change the lights.")
while true do
local id,key = os.pullEvent("key")
if key==28 then rs.setOutput("back", not rs.getOutput("back")) end
end
Look, I'm not trying to make it short and sweet, I'm trying to learn. And if I have to code a lot of lines, so be it! You'll use your way, and I'll use mine.
yes = "yes"
if input == (yes)
you can instead use
if input == "yes"
2. As the people above already said try using while loops (build like this)
while [condition|true for infinite loop]
[stuff you want to do]
end
If you get an too long without yielding error write
while [condition|true for infinite loop] do
sleep(0)
[stuff you want to do]
end
you don't even need use2 anymore with a loopI know only the basic's and I heard that loops were bad, so I didn't use them.
I know only the basic's and I heard that loops were bad, so I didn't use them.
Loops aren't bad - so feel free to use them. I don't know why anyone would think loops are bad, they are fundamental programming concept. Does your computer shut down after you type one command or run one program? :)/>/> No, because they use loops.
local a = 0 --local variable.
while true do -- start of a loop
print (a) -- prints to the screen the value of a
a = a+1 -- makes a larger by one every loop
end -- end of the loop
I know only the basic's and I heard that loops were bad, so I didn't use them.
Loops aren't bad - so feel free to use them. I don't know why anyone would think loops are bad, they are fundamental programming concept. Does your computer shut down after you type one command or run one program? :)/>/> No, because they use loops.
I heard someone say that they caused their computer to crash. And I didn't know.
Yeah, that still doesn't crash your computer, it crashes Minecraft, it will give an 'Minecraft ran out of memory' error.I know only the basic's and I heard that loops were bad, so I didn't use them.
Loops aren't bad - so feel free to use them. I don't know why anyone would think loops are bad, they are fundamental programming concept. Does your computer shut down after you type one command or run one program? :)/>/> No, because they use loops.
I heard someone say that they caused their computer to crash. And I didn't know.
If you call the same function in a function you will eventually run out of memory - but not if you use loops properly.
Yeah, that still doesn't crash your computer, it crashes Minecraft, it will give an 'Minecraft ran out of memory' error.I know only the basic's and I heard that loops were bad, so I didn't use them.
Loops aren't bad - so feel free to use them. I don't know why anyone would think loops are bad, they are fundamental programming concept. Does your computer shut down after you type one command or run one program? :)/>/> No, because they use loops.
I heard someone say that they caused their computer to crash. And I didn't know.
If you call the same function in a function you will eventually run out of memory - but not if you use loops properly.
What is the current max stack size?By computer, I was thinking the minecraft computer, not the actual computer. It will eventually "crash" as the stack has been filled up.
What is the current max stack size?By computer, I was thinking the minecraft computer, not the actual computer. It will eventually "crash" as the stack has been filled up.
thanx… where did he say that?*cough* Cloudy, on 15 April 2012 - 05:59 PM, said:
Anywho, the max stack size in cc is 256
I was trying to point out that this topic is almost a year old. Also you can tell the max stack size by doingthanx… where did he say that?*cough* Cloudy, on 15 April 2012 - 05:59 PM, said:
Anywho, the max stack size in cc is 256
function a()
a()
end
a()
However I tried using some printing functions to print the stack number and it actually varies between 238-242 but I believe it's meant to be 256But it was bumped today, and I saw it today :P/>I was trying to point out that this topic is almost a year old. Also you can tell the max stack size by doing
Ahhh ok interesting…However I tried using some printing functions to print the stack number and it actually varies between 238-242 but I believe it's meant to be 256