Posted 01 January 2013 - 11:18 AM
Code:
DrawImage() code:
Question:
Why it print ">" only when i press q? (q = exit)
term.clear()
do
charSelected = ">"
selected = 1
exit = false
end
repeat
term.clearLine(2)
term.clearLine(4)
configText = fs.open("configText", "r")
term.setBackgroundColor(colors.white)
drawImage("Config/test.nfp")
term.setTextColor(colors.lightGray)
term.setCursorPos(3,2)
term.setBackgroundColor(colors.white)
print(configText.readLine())
term.setTextColor(colors.lightGray)
term.setCursorPos(3,4)
term.setBackgroundColor(colors.white)
print(configText.readLine())
event, param1 = os.pullEvent("key")
if param1 == 200 then selected = selected + 1
elseif param1 == 208 then selected = selected - 1
elseif param1 == 16 then exit = true end
if selected == 3 then selected = 1
elseif selected == 0 then selected = 2 end
if selected == 1 then
term.setCursorPos(2,2)
print(charSelected)
elseif selected == 2 then
term.setCursorPos(2,4)
print(charSelected)
end
until exit == true
DrawImage() code:
function drawImage( img, y, x)
img = "images/"..img
x = x or 1
y = y or 1
local ImageToDraw = paintutils.loadImage(img)
paintutils.drawImage(ImageToDraw, y, x)
end
Question:
Why it print ">" only when i press q? (q = exit)