Posted 09 February 2013 - 06:34 PM
Here is my code:
I dont know what is wrong with it! It is in a program called startup (so it runs the program on every boot up) and whenever I reboot, it gives me the OS 1.4 screen, I type one of the beer kinds and it gives me the bar info, but doesnt let me type anything after that, and becomes irresponsive. I have tried many things, which didnt work. Can someone help?
local pulses = 0
local input = read()
while true do
print("Welcome to my bar! Put the diamonds in the box to the right and enter your wanted beer kind! (strong or thick)")
os.pullEvent 'redstone'
if rs.getInput 'bottom' then
pulses = pulses + 1
repeat
os.pullEvent 'redstone'
until not rs.getInput 'bottom'
pulses = 0
end
end
end
function waitForKeyword()
while true do
print("Payment: " ..pulses.. "diamonds, which will buy you" ..pulses.. "beers!")
if input == 'strong' then
print("Thank you for your payment! Your beer(s) will be right out!")
for i=1, pulses do
rs.setInput('right', true)
sleep(0.1)
rs.setInput('right', false)
sleep(2)
os.shutDown()
elseif input == 'thick' then
print("Thank you for your payment! Your beer(s) will be right out!")
for i=1, pulses do
rs.setInput('left', true)
sleep(0.1)
rs.setInput('left', false)
os.shutDown()
end
end
end
end
parallel.waitForAny(waitForKeyword, getPulses)
I dont know what is wrong with it! It is in a program called startup (so it runs the program on every boot up) and whenever I reboot, it gives me the OS 1.4 screen, I type one of the beer kinds and it gives me the bar info, but doesnt let me type anything after that, and becomes irresponsive. I have tried many things, which didnt work. Can someone help?