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

Drum OS Update 2 Version 2.0

Started by Camwarp, 09 May 2013 - 07:03 AM
Camwarp #1
Posted 09 May 2013 - 09:03 AM
OK I Have Been Taking A Break From LUA Coding To Work On My Real Operating System. So Lately I Got Bored With The OS Programming So I Went Back TO Lua and finished the 2nd Update Of Drum OS Here It Is





term.clear()
term.setCursorPos(1,1)
print("DrumOS 2.0")
sleep(1)
print "Welcome To The Drumstick Operating System Version 2.0"
sleep(1)
cursor.setPos("25,6")
print "1.)Log"
cursor.setPos("25,7")
print "2.)Open Rednet"
cursor.setPos("25,8")
print "3.)Send Launch Command To Turtles"
cursor.setPos("25,9")
print "4.)Close rednet"
cursor.setPos("25,10")
print "5.)Reboot Computer"
curser.setPos("25,11")
print "6.)Shutdown")
write "Please Enter Which Number You Would Like To Do"
answer=read()
if answer==1 then
os.run edit Log
end
answer=read()
if answer==2 then
local function openAll()
  for _,side in pairs(rs.getSides()) do
			    if peripheral.getType(side) == "modem" then
				  rednet.open(side)
				  return true
			    end
  end
  return false
end
openAll()
print ("Rednet Opened")
end
answer=read()
rednet.broadcast("Launch")
print "Launch Sequence Complete"
end
answer=read()
if answer==4 then
local function openAll()
  for _,side in pairs(rs.getSides()) do
			    if peripheral.getType(side) == "modem" then
				  rednet.close(side)
				  return true
			    end
  end
  return false
end
openAll()
print ("Rednet Closed")
end
answer=read()
if answer==5 then
os.reboot
end
answer=read()
if answer=6 then
os.shutdown
end
Kingdaro #2
Posted 09 May 2013 - 09:09 AM
There are misspellings, missing parentheses, and missing equal signs in various areas if the script. Please test your code before testing.

Even if it did work, the program just ends after the script ends unless you shutdown or reboot; you can just enter 7 to leave. In fact, it won't catch any input because you aren't converting your input to a number.

Another problem I've noticed, you keep checking read() for every individual option, when you should only check read once, and perform the action correlating to the user's input.

And yeah, this isn't an OS. It's just a menu.

Also, please, PLEASE don't capitalize every single word when you type.
nutcase84 #3
Posted 09 May 2013 - 02:56 PM
And yeah, this isn't an OS. It's just a menu.

Don't start that argument again…
Mads #4
Posted 10 May 2013 - 02:07 AM
Don't start that argument again…

But that is impossible on these fora.