Posted 13 October 2012 - 10:45 AM
Hi everyone,
I'm new to ComputerCraft(not new to Lua scripting though). I've had experience scripting for years using the LÖVE2D engine and ROBLOX. Though I'm new to ComputerCraft and a little confused.
I'm trying to make something print to the screen after the user types in something. I need this for tekkit, if that's an important detail. Here's the script:
while true do
term.clear()
term.setCursorPos(1,1)
write([[
Welcome to the Exedra Pump System!
To turn the pumps on, please type "ON".
To turn the pumps off, please type "OFF".
The statuses are not case-sensitive.
STATUS:
]])
local input = io.read()
if string.lower(input) == "on" then
print("Redstone pumps turned on!") – this part won't show up
rs.setOutput("back",true)
elseif string.lower(input) == "off" then
print("Redstone pumps turned off!") – and this part.
rs.setOutput("back",false)
else
print("ERROR: "..input.." is not a valid status!")
sleep(2)
end
end
I'm sorry if it's not tabbed, I did tab it in notepad++, not sure if it works on forum posts. It's also the same for a redstone mechanic of mine. But it's similar to this. Thanks in advance for the help!
I'm new to ComputerCraft(not new to Lua scripting though). I've had experience scripting for years using the LÖVE2D engine and ROBLOX. Though I'm new to ComputerCraft and a little confused.
I'm trying to make something print to the screen after the user types in something. I need this for tekkit, if that's an important detail. Here's the script:
while true do
term.clear()
term.setCursorPos(1,1)
write([[
Welcome to the Exedra Pump System!
To turn the pumps on, please type "ON".
To turn the pumps off, please type "OFF".
The statuses are not case-sensitive.
STATUS:
]])
local input = io.read()
if string.lower(input) == "on" then
print("Redstone pumps turned on!") – this part won't show up
rs.setOutput("back",true)
elseif string.lower(input) == "off" then
print("Redstone pumps turned off!") – and this part.
rs.setOutput("back",false)
else
print("ERROR: "..input.." is not a valid status!")
sleep(2)
end
end
I'm sorry if it's not tabbed, I did tab it in notepad++, not sure if it works on forum posts. It's also the same for a redstone mechanic of mine. But it's similar to this. Thanks in advance for the help!