4 posts
Posted 20 December 2015 - 05:46 PM
Good day,
After fiddling with this code long enough and it not working, I was hoping if someone could shine some light on me.
Spoiler
while x ~= "exit" do
print("-------------------------------")
print("Main menu:")
print("Type MFSU and then hit the enter key for MFSU management.")
print("Type em for energy management.")
print("Type exit to go back to previous menu.")
write(" Choose an option now, please.")
print("-------------------------------")
x = io.read()
if x == "MFSU" then
while y ~= "exit" do
print("-------------------------------")
print("MFSU Factory:")
print("To turn on, type on. To turn off, type off")
print("to exit from MFSU menu type exit")
write("")
print("-------------------------------")
y = io.read()
if y == "on" then
redstone.setOutput("right", true )
print("------------------------------")
print("You have chosen to turn the Factory on.")
elseif y == "off" then
redstone.setOutput("right", false )
print("------------------------------")
print("You have chosen to turn the Factroy off.")
end -- if y = on/off
end -- while y
end -- if MFSU
if x == "em" then
while u ~= "exit" do
print("-------------------------------")
print("Energy management menu:")
print("- ")
print("To turn The Reactor On, type on. To turn the Reactor off type off")
print("to exit from energy management menu type exit")
write("")
print("-------------------------------")
u = io.read()
if u == "on" then
redstone.setOutput("left", true )
print("------------------------------")
print("You have chosen to turn the Reactor On.")
elseif u == "off" then
redstone.setOutput("left", false )
print("------------------------------")
print("You have chosen to turn the Reactor off.")
end -- if u = on/off
end -- while u
end -- if em
end -- while z
Edited by
7083 posts
Location
Tasmania (AU)
Posted 21 December 2015 - 12:31 AM
"Not working" doesn't give us a lot to go on. What DOES it do, and how's that different to what you were expecting? If you get error messages, then what do they say?
173 posts
Location
The hall of 1000 monkeys and only 1 typewriter
Posted 21 December 2015 - 11:04 AM
what I can gather, it works computer wise, apart from I can't seem to get it to start up a second time… What is the program meant to do? Is it to control an IC2 MSFU or Reactor? if you could give us some details about the problem that'd be great
I found the problem about the starting and fixed it
while x~= "exit" do --Problem
At the bottom of the entire program
x = " "
Edited on 21 December 2015 - 10:15 AM
4 posts
Posted 22 December 2015 - 02:13 AM
Well, the program is mainly just needing to output a redstone output, but yes it is for a IC2. I am getting a error stating "bios:14: [string "Menu"] :43: 'end' expected to close 'while' at line 25)".
7083 posts
Location
Tasmania (AU)
Posted 22 December 2015 - 02:33 AM
The code you've posted does not have a "while" at line 25, and would not appear to generate a similar error in any case. Check that the script you're running is the script you're editing.
4 posts
Posted 22 December 2015 - 02:57 AM
It would seem I had forgotten I tried to fix the code and changed it a little, from the base the error was "bios:1: [string "Menu"]:47: '<eof>' expected"
7083 posts
Location
Tasmania (AU)
Posted 22 December 2015 - 04:38 AM
Both errors boil down to the same thing; you've got your "end"s messed up in some way. Make sure you've got the right amount and that they're in the correct locations.
173 posts
Location
The hall of 1000 monkeys and only 1 typewriter
Posted 22 December 2015 - 11:00 PM
It would seem I had forgotten I tried to fix the code and changed it a little, from the base the error was "bios:1: [string "Menu"]:47: '<eof>' expected"
I am not getting either of the errors you spoke of… All I did was add
x = " "
to the end and that sorted it out…
I did not get the errors initially either
Edited on 22 December 2015 - 10:00 PM