10 posts
Posted 27 July 2012 - 04:52 PM
I dont know how to fix this, please help!
Code: Name of code: collect
——————————————————————————————-
print("How many diamonds do you wish to collect?")
x = io.read()
x = tonumber(x)
if x => 65 then # i think this is the problem i dont want it to be == though
Print("Collecting "..x.." diamonds for you!")
rs.setOutput("back", true)
sleep(x) # this works with what setup i have (Using timers and stuff)
rs.setOutput("back", false)
print("Thank you for using this program")
sleep(2)
shell.run("startup")
else
print("You can only take a maximum of 64 diamonds out at once!")
sleep(2)
shell.run("collect")
end
———————————————————————————————
Thanks for helping! That is, if you do help me…
30 posts
Posted 27 July 2012 - 05:04 PM
write("How many diamonds do you wish to collect?: ")
x = io.read()
x = tonumber(x)
if x => 65 then
Print("Collecting "..x.." diamonds for you!")
rs.setOutput("back", true)
sleep(x)
rs.setOutput("back", false)
print("Thank you for using this program")
sleep(2)
shell.run("startup")
else
print("You can only take a maximum of 64 diamonds out at once!")
sleep(2)
shell.run("collect")
end
did not test it, but i think this would work
59 posts
Location
Norway
Posted 27 July 2012 - 05:05 PM
print("How many diamonds do you wish to collect?")
x = io.read()
x = tonumber(x)
if x >= 65 then # Guessing your using it the wrong way
Print("Collecting "..x.." diamonds for you!")
rs.setOutput("back", true)
sleep(x)
rs.setOutput("back", false)
print("Thank you for using this program")
sleep(2)
shell.run("startup")
else
print("You can only take a maximum of 64 diamonds out at once!")
sleep(2)
shell.run("collect")
end
30 posts
Posted 27 July 2012 - 05:09 PM
print("How many diamonds do you wish to collect?")
x = io.read()
x = tonumber(x)
if x >= 65 then # Guessing your using it the wrong way
Print("Collecting "..x.." diamonds for you!")
rs.setOutput("back", true)
sleep(x)
rs.setOutput("back", false)
print("Thank you for using this program")
sleep(2)
shell.run("startup")
else
print("You can only take a maximum of 64 diamonds out at once!")
sleep(2)
shell.run("collect")
end
am i bind or did you just copy/paste his code into a code area?
59 posts
Location
Norway
Posted 27 July 2012 - 05:10 PM
I changed
if x => 65 then
to
if x >= 65 then
10 posts
Posted 27 July 2012 - 05:14 PM
Thank you!
You have fixed the problem
30 posts
Posted 27 July 2012 - 05:15 PM
I changed
if x => 65 then
to
if x >= 65 then
i knew i was blind :)/>/>
992 posts
Posted 27 July 2012 - 05:22 PM
couple of small problems comments are made using – not # btw
Spoiler
print("How many diamonds do you wish to collect?")
x = io.read()
x = tonumber(x)
if x < 64 then -- i think this is the problem i dont want it to be == though
print("Collecting "..x.." diamonds for you!") -- print not Print
rs.setOutput("back", true)
sleep(x) -- this works with what setup i have (Using timers and stuff)
rs.setOutput("back", false)
print("Thank you for using this program")
sleep(2)
os.reboot() -- or you will cause stack over flow
else
print("You can only take a maximum of 64 diamonds out at once!")
sleep(2)
shell.run("collect")
end