Posted 19 December 2013 - 09:04 PM
Here's my code
mbars function the mouse click is not working
please HELP ME!
function drawLogin()
paintutils.drawImage(loginp,16,11)
term.setBackgroundColor(colors.blue)
term.setCursorPos(21,11)
term.setBackgroundColor(colors.yellow)
term.setTextColor(colors.black)
print " Administrator "
term.setTextColor(colors.white)
term.setBackgroundColor(colors.blue)
term.setCursorPos(21,12)
print " "
term.setCursorPos(21,13)
print " Login Please "
term.setCursorPos(21,14)
print " "
term.setCursorPos(21,15)
print " "
term.setCursorPos(22,14)
term.setBackgroundColor(colors.lightGray)
print " "
term.setCursorPos(36,14)
term.setBackgroundColor(colors.blue)
print " "
term.setBackgroundColor(colors.cyan)
if fs.exists("/.turtpass") then
term.setCursorPos(22,14)
term.setBackgroundColor(colors.lightGray)
input = read("x")
f = fs.open("/.turtpass", "r")
cpass = f.readAll()
f.close()
if input == cpass then
desk()
else
os.reboot()
end
else
term.setBackgroundColor(colors.blue)
term.setCursorPos(21,13)
print " Setup Login "
term.setCursorPos(22,14)
term.setBackgroundColor(colors.lightGray)
input = read()
f = fs.open("/.turtpass", "w")
f.writeLine(input)
f.close()
os.reboot()
end
end
function icon()
term.setCursorPos(iX, iY)
paintutils.drawImage(fb,iX,iY)
term.setCursorPos(iX-1,iY+4)
print "FileBrowser"
end
function menu()
term.setCursorPos(1,2)
term.setBackgroundColor(colors.gray)
print " "
print " "
print " "
print " "
print " "
print " "
print " "
ln = 3
for i = 1, 6 do
term.setBackgroundColor(colors.white)
term.setCursorPos(2,ln)
print " "
term.setCursorPos(12,ln)
term.setBackgroundColor(colors.gray)
print " "
ln = ln + 1
end
term.setBackgroundColor(colors.lightGray)
term.setCursorPos(1,ln)
print " Admin "
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.setCursorPos(2,3)
print " Reboot "
term.setCursorPos(2,4)
print " Shutdown "
term.setCursorPos(2,5)
print " CraftOS "
term.setTextColor(colors.white)
term.setBackgroundColor(colors.green)
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.lightGray)
print " start "
end
function mbars()
while m == 1 do
local event2, button2, X2, Y2 = os.pullEvent("mouse_click")
if X2 >= 1 and X2 <=12 and Y2 >= 2 and Y2 <= 9 and button2 == 1 then
elseif X2 >=3 and X2 <=11 and Y2 == 3 and button2 == 1 then
os.reboot()
elseif X2 >=3 and X2 <=11 and Y2 == 4 and button2 == 1 then
os.shutdown()
elseif X2 >=3 and X2 <=11 and Y2 == 5 and button2 == 1 then
shell.run("shell")
else
m = 0
desk()
on = true
end
end
end
function on1()
while on do
local event, button, X, Y = os.pullEvent("mouse_click")
if X >= 1 and X <=7 and Y == 1 and m == 0 and button == 1 then
menu()
m = 1
mbars()
on = false
elseif X >= iX and X <=iX + 4 and Y >= iY and Y <= iX + 4 and button == 1 then
shell.run("lister")
end
end
end
function desk()
turtle = paintutils.loadImage("logo.bmp")
loginp = paintutils.loadImage("loginpic.bmp")
term.setBackgroundColor(colors.cyan)
term.clear()
paintutils.drawImage(turtle,3,8)
term.setBackgroundColor(colors.lightGray)
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.green)
print " start "
icon()
on1()
end
function draw()
turtle = paintutils.loadImage("logo.bmp")
loginp = paintutils.loadImage("loginpic.bmp")
fb = paintutils.loadImage("filebrow.bmp")
term.setBackgroundColor(colors.cyan)
term.clear()
paintutils.drawImage(turtle,3,1)
term.setCursorPos(20,8)
term.setBackgroundColor(colors.gray)
print "Super Fast!"
drawLogin()
end
iX = 2
iY = 4
on = true
m = 0
draw()
mbars function the mouse click is not working
please HELP ME!