Posted 01 February 2013 - 10:33 AM
Title: [Lua] How to make a computer send out a user defined number of red-stone pulses
Hello, I am using Computer craft computer and red power, to make an "item vending machine", it is not meant to be comprehensive, just for the important items (iron, coal, diamonds, etc…). The way I have been coding it to write a separate program for each item, like this:
—-
print ("how many would you like")
n = read()
rs.setBundledOutput("bottom", colors.purple)
sleep(n) – place holder for were I want it to pulse, with n being the user defined number of pulses
rs.setBundledOutput("bottom", 0)
print ("thank you, enjoy!")
sleep(2)
term.clear()
—-
does someone know how I can have the user enter a number (n) and then have the red stone pulse that many time. I apologize if this is a simplistic question but I am very new to Lua, and fairly new to coding in general, thanks!
Hello, I am using Computer craft computer and red power, to make an "item vending machine", it is not meant to be comprehensive, just for the important items (iron, coal, diamonds, etc…). The way I have been coding it to write a separate program for each item, like this:
—-
print ("how many would you like")
n = read()
rs.setBundledOutput("bottom", colors.purple)
sleep(n) – place holder for were I want it to pulse, with n being the user defined number of pulses
rs.setBundledOutput("bottom", 0)
print ("thank you, enjoy!")
sleep(2)
term.clear()
—-
does someone know how I can have the user enter a number (n) and then have the red stone pulse that many time. I apologize if this is a simplistic question but I am very new to Lua, and fairly new to coding in general, thanks!