SHOW:
|
|
- or go back to the newest paste.
| 1 | p = peripheral.wrap("right")
| |
| 2 | nombre = 1 | |
| 3 | p.clear() | |
| 4 | button_plus = {
| |
| 5 | "---", | |
| 6 | " + ", | |
| 7 | "---" | |
| 8 | } | |
| 9 | button_moin = {
| |
| 10 | "---", | |
| 11 | " - ", | |
| 12 | "---" | |
| 13 | } | |
| 14 | button_ok = {
| |
| 15 | "-----------", | |
| 16 | "| VALIDER |", | |
| 17 | "-----------" | |
| 18 | } | |
| 19 | for k,v in ipairs(button_plus) do | |
| 20 | p.setCursorPos(4,4 + k) | |
| 21 | p.write(v) | |
| 22 | end | |
| 23 | for k,v in ipairs(button_moin) do | |
| 24 | p.setCursorPos(12,4 + k) | |
| 25 | p.write(v) | |
| 26 | end | |
| 27 | for k,v in ipairs(button_ok) do | |
| 28 | - | if xPos > 4 and xPos < 8 and yPos > 4 and yPos < 8 then |
| 28 | + | p.setCursorPos(4,7 + k) |
| 29 | p.write(v) | |
| 30 | end | |
| 31 | ||
| 32 | while true do | |
| 33 | p.setCursorPos(8, 6) | |
| 34 | p.write(nombre) | |
| 35 | event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 36 | print("X: "..xPos.."Y:"..yPos)
| |
| 37 | if xPos > 4 and xPos < 9 and yPos > 3 and yPos < 9 then | |
| 38 | nombre = nombre + 1 | |
| 39 | end | |
| 40 | if xPos > 12 and xPos < 17 and yPos > 4 and yPos < 10 then | |
| 41 | nombre = nombre - 1 | |
| 42 | end | |
| 43 | if xPos > 3 and xPos < 16 and yPos > 6 and yPos < 14 then | |
| 44 | if nombre >= 1 then | |
| 45 | tonumber(nombre) | |
| 46 | rs.setOutput("back", true)
| |
| 47 | sleep(nombre/2) | |
| 48 | rs.setOutput("back", false)
| |
| 49 | end | |
| 50 | end | |
| 51 | end |