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

[LUA] Computer not responding to input

Started by JonaK, 27 February 2013 - 01:02 PM
JonaK #1
Posted 27 February 2013 - 02:02 PM
I have an elevator system set up on a tekkit server, which currently operates with buttons and complicated redstone. I made a computer program to make this easier and more user-friendly, but it does not seem to work.

Also, I was unable to add an else statement because the computer complained about expecting an end of file where the else statement was.

Code:
http://pastebin.com/d4sb8JZ0

Thank you!
immibis #2
Posted 27 February 2013 - 02:29 PM
Please say what is wrong with it. "It doesn't work" is useless.
The_Awe35 #3
Posted 27 February 2013 - 02:50 PM
I don't think anyone can really help you without seeing the elevator itself, and knowing how the elevator is supposed to work. The code looks good so I think its an elevator problem you're having. Although I think you could condense the code a bit by instead of having 40 if then statements.


if floors < 0 and floors > -21 then
rs.setOutput("bottom", true)
os.sleep(floors*-1*2)
rs.setOutput(bottom", false)
elseif floors > 0 and floors < 21then
rs.setOutput("top", true)
os.sleep(floors*2)
rs.setOutput("top", false)
else
print("Invalid Floor Selection. Please Try Again")
end
SuicidalSTDz #4
Posted 27 February 2013 - 04:42 PM
I have an elevator system set up on a tekkit server, which currently operates with buttons and complicated redstone. I made a computer program to make this easier and more user-friendly, but it does not seem to work.

Also, I was unable to add an else statement because the computer complained about expecting an end of file where the else statement was.

Code:
http://pastebin.com/d4sb8JZ0

Thank you!
Why does everyone like Tekkit so much? Oh well, your code looks fine (Except all the statements; compaction my dear boy) and like the others said "We can't help you if we don't have a clear image of what is wrong."
JonaK #5
Posted 27 February 2013 - 05:33 PM
Oh sorry. Here's a simplification of the elevator:
[media]http://www.youtube.com/watch?v=OggPE90lsIc[/media]

In the actual elevator, there is a system of not gates and timers, which pulses the frame motor every 2 seconds. When the computer outputs a redstone signal, it turns off the not gate and lets the timer run for however many pulses, then turns off.

To be more specific about my problem, the computer listens to the input, and does not output an action. The program is run, I enter a number, and the program terminates immediately.

Thank you for your help.
SuicidalSTDz #6
Posted 27 February 2013 - 06:08 PM
Either you not defining something correctly in your code or your logic gates are incorrectly oriented. Double check both.