This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Debane's profile picture

Password controlled Engine control (overheat safe)

Started by Debane, 03 June 2013 - 07:15 AM
Debane #1
Posted 03 June 2013 - 09:15 AM
I wanted to create a simple programm that takes in a password to then loop redstone signals on and off for a period of time to prevent engines from overheating.
I having problems with my repeat part though
(i have used a big part from the wiki because this is my first try)

local side = "back"
local password = "bacon"
local opentime = 5
while true do
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Password correct!")
repeat
term.clear()
term.setCursorPos(1,1)
print("Currently running")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
until read("stop")
else
print("password incorrect!")
sleep(2)
end
end

during the repeat i can only type the letter "s" (also multiple times) and the engines will only turn on
for one tick after i have pressed return :s
help please im a nooby
Lyqyd #2
Posted 03 June 2013 - 01:34 PM
Split into new topic.

read()'s argument is a masking string. It will replace whatever you type with the first character of the string that you pass it. There are a number of other issues with your program.
Debane #3
Posted 03 June 2013 - 02:27 PM
Like i said im new…
How do i split?
Lyqyd #4
Posted 03 June 2013 - 03:56 PM
What? If you're referring to the first line of my post, I'm simply stating that I split your post out into its own topic.