Posted 02 May 2013 - 10:24 PM
I am trying to make an OS for non-advance computers.
As you can see,I want it so if you click restart,it will reboot.But clicking restart won't do anything.If I click shutdown,it doesn't do anything either.I looked at all of my code.I don't see anything wrong.Can anyone help me??
Spoiler
--CraftOS+ 1.0.0 created by:27thColt
function menu()
term.clear()
term.setCursorPos(1, 1)
print("X---------------------------------X")
term.setCursorPos(36, 1)
print("[Shutdown]")
term.setCursorPos(1, 2)
print("CraftOS+ 1.0.0")
term.setCursorPos(36, 2)
print("[Restart]")
term.setCursorPos(1, 4)
print("X---------------------------------X")
end
menu()
while true do
local event button, X, Y = os.pullEventRaw()
if event == "mouse_click" then
if X >= 36 and X <= 45 and Y == 1 and button == 1 then
term.setCursorPos(1, 4)
print("Shutting down....")
os.sleep(2)
os.shutdown()
elseif X >= 36 and X <= 44 and Y == 2 and button == 1 then
term.setCursorPos(1, 4)
print("Restarting....")
os.reboot()
end
end
end