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

I need To Know If This Code Will Work

Started by Camwarp, 16 April 2013 - 06:43 AM
Camwarp #1
Posted 16 April 2013 - 08:43 AM

term.clear()
term.setCursorPos(1,1)
print("DrumOS 2.0")
sleep(1)
print "Welcome To The Drumstick Operating System Version 2.0"
sleep(1)
term.setCursorPos("25,6")
print "1.)Log"
term.setCursorPos("25,7")
print "2.)Open Rednet"
term.setCursorPos("25,8")
print "3.)Close rednet"
term.setCursorPos("25,9")
print "4.)Reboot Computer"
term.setCursorPos("25,10")
print "5.)Shutdown")
write "Please Enter Which Number You Would Like To Do"
answer=read()
if answer==1 then
shell.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()
if answer==3 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==4 then
os.reboot()
end
answer=read()
if answer=5 then
os.shutdown()
end
end

I created This Code As A run Off Of My Other Drum OS Version 1.2. I Just Started Experimenting With Menus And Need 2 Know I This Will Work Please Give Constructive Feedback
Sammich Lord #2
Posted 16 April 2013 - 08:45 AM
Do you want us to actually run the code, or what? We can't really give constructive feedback if you are just asking us to run it for you.
Camwarp #3
Posted 16 April 2013 - 08:46 AM
I Just Want Someone To Look Over It Please
Sammich Lord #4
Posted 16 April 2013 - 08:47 AM
There is no "cursor.setPos", it is "term.setCursorPos".
Camwarp #5
Posted 16 April 2013 - 08:54 AM
So The Code Runs Now With The Menu Right?
Sammich Lord #6
Posted 16 April 2013 - 08:55 AM
You did os.run wrong. Use shell.run instead. shell.run("edit Log").
You also forgot () on os.shutdown and os.reboot.
Camwarp #7
Posted 16 April 2013 - 08:57 AM
Thanks