Alright well I'm trying to get a password door down for a map. It's an adventure maze going up a tower- I believe we have 15 levels at the moment?- players will have to find their way through, collect an item, read it, input whatever is needed as the password and move on to the next level. I have been able to get that far. However if the player fails and gets the password wrong, then the area below their feet will open (do to the computer activating sticky pistons) and they'll fall back to the previous level.
This is where I get stuck. I'm not quite sure how to write in the "else" command. I can get dialogue through and it shows that it understands that the password is not correct, but actually activating anything is where I have the problem.
Here's what I have so far just for testing (I'm going off of the Wiki's example- if anyone wouldn't mind, I would love to learn this hands on but I'm horrible with any languages purely off of text and not really through a hands on effort.T.T):
local side = "left"
local password = "Yes."
while true do
term.clear()
term.setCursorPos(1,1)
write("Yes or No?")
term.setCursorPos(1,4)
write("Answer: ")
local input = read("*")
if input == password then
term.setCursorPos(1,6)
print("Please proceed to the next room.")
redstone.setOutput(side,true)
sleep(5)
redstone.setOutput(side,false)
else
term.setCursorPos(1,6)
write("I'm sorry, you are incorrect. Prepare for a fall.")
sleep(2)
term.setCursorPos(1,7)
write("Goodbye.")
sleep(2)
os.shutdown()
end
end
-------
Where/how would I use redstone to activate pistons? Would I have a trail of redstone below the comp and lead it to the piston or should I have a torch? I am such an inexperienced redstone nublet.:c I don't learn things without hands on help so if anyone would be able to, that'd be great.:3 I have not been able to find any good tutorials about this and it got me thinking- is this just a largely overcomplicated way to do this? Is there something easier? If someone could either tell me how to write it out for the comp and/or lay redstone/pistons out or show me a better way for executing this, I would be most thankful.:3
OH. Also how would you make it impossible to Ctl+T out of the program, as well as a way to over-ride that option if the need arises?o:
~Dale
This is where I get stuck. I'm not quite sure how to write in the "else" command. I can get dialogue through and it shows that it understands that the password is not correct, but actually activating anything is where I have the problem.
Here's what I have so far just for testing (I'm going off of the Wiki's example- if anyone wouldn't mind, I would love to learn this hands on but I'm horrible with any languages purely off of text and not really through a hands on effort.T.T):
local side = "left"
local password = "Yes."
while true do
term.clear()
term.setCursorPos(1,1)
write("Yes or No?")
term.setCursorPos(1,4)
write("Answer: ")
local input = read("*")
if input == password then
term.setCursorPos(1,6)
print("Please proceed to the next room.")
redstone.setOutput(side,true)
sleep(5)
redstone.setOutput(side,false)
else
term.setCursorPos(1,6)
write("I'm sorry, you are incorrect. Prepare for a fall.")
sleep(2)
term.setCursorPos(1,7)
write("Goodbye.")
sleep(2)
os.shutdown()
end
end
-------
Where/how would I use redstone to activate pistons? Would I have a trail of redstone below the comp and lead it to the piston or should I have a torch? I am such an inexperienced redstone nublet.:c I don't learn things without hands on help so if anyone would be able to, that'd be great.:3 I have not been able to find any good tutorials about this and it got me thinking- is this just a largely overcomplicated way to do this? Is there something easier? If someone could either tell me how to write it out for the comp and/or lay redstone/pistons out or show me a better way for executing this, I would be most thankful.:3
OH. Also how would you make it impossible to Ctl+T out of the program, as well as a way to over-ride that option if the need arises?o:
~Dale