Jump to content




Password controlled Engine control (overheat safe)


  • You cannot reply to this topic
3 replies to this topic

#1 Debane

  • New Members
  • 2 posts

Posted 03 June 2013 - 08: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

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 03 June 2013 - 12: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.

#3 Debane

  • New Members
  • 2 posts

Posted 03 June 2013 - 01:27 PM

Like i said im new...
How do i split?

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 03 June 2013 - 02: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users