Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("right")
- nombre = 1
- p.clear()
- button_plus = {
- "---",
- " + ",
- "---"
- }
- button_moin = {
- "---",
- " - ",
- "---"
- }
- button_ok = {
- "-----------",
- "| VALIDER |",
- "-----------"
- }
- for k,v in ipairs(button_plus) do
- p.setCursorPos(4,4 + k)
- p.write(v)
- end
- for k,v in ipairs(button_moin) do
- p.setCursorPos(12,4 + k)
- p.write(v)
- end
- for k,v in ipairs(button_ok) do
- p.setCursorPos(4,7 + k)
- p.write(v)
- end
- while true do
- p.setCursorPos(8, 6)
- p.write(nombre)
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- print("X: "..xPos.."Y:"..yPos)
- if xPos > 4 and xPos < 9 and yPos > 3 and yPos < 9 then
- nombre = nombre + 1
- end
- if xPos > 12 and xPos < 17 and yPos > 4 and yPos < 10 then
- nombre = nombre - 1
- end
- if xPos > 3 and xPos < 16 and yPos > 6 and yPos < 14 then
- if nombre >= 1 then
- tonumber(nombre)
- rs.setOutput("back", true)
- sleep(nombre/2)
- rs.setOutput("back", false)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement