SHOW:
|
|
- or go back to the newest paste.
| 1 | mouseWidth = 0 | |
| 2 | mouseHeight = 0 | |
| 3 | ||
| 4 | --Set monitor properties | |
| 5 | monitor = peripheral.wrap("top")
| |
| 6 | monitor.clear() | |
| 7 | monitor.setCursorPos(1,1) | |
| 8 | w,h=monitor.getSize() | |
| 9 | monitor.setBackgroundColor((colors.lime)) | |
| 10 | ||
| 11 | ||
| 12 | --Write first list of mobs | |
| 13 | monitor.setCursorPos(2,2) | |
| 14 | monitor.write(" Enderman ")
| |
| 15 | ||
| 16 | monitor.setCursorPos(2,4) | |
| 17 | monitor.write(" Skeleton ")
| |
| 18 | ||
| 19 | monitor.setCursorPos(2,6) | |
| 20 | monitor.write(" Blaze ")
| |
| 21 | ||
| 22 | monitor.setCursorPos(2,8) | |
| 23 | monitor.write(" Whisp ")
| |
| 24 | ||
| 25 | --Write second list of mobs | |
| 26 | monitor.setCursorPos(16,2) | |
| 27 | monitor.write(" Null ")
| |
| 28 | ||
| 29 | monitor.setCursorPos(16,4) | |
| 30 | monitor.write(" Null ")
| |
| 31 | ||
| 32 | monitor.setCursorPos(16,6) | |
| 33 | monitor.write(" Null ")
| |
| 34 | ||
| 35 | monitor.setCursorPos(16,8) | |
| 36 | monitor.write(" Null ")
| |
| 37 | ||
| 38 | ||
| 39 | function checkClickPosition() | |
| 40 | -- 1st Row -- | |
| 41 | - | if(mouseWidth > 1 and mouseWidth < 13 and mouseHeight = 2) then |
| 41 | + | if(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 2) then |
| 42 | --Clicked Enderman -- | |
| 43 | monitor.setCursorPos(2,10) | |
| 44 | monitor.write(" Clicked Enderman")
| |
| 45 | - | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight = 2) then |
| 45 | + | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 2) then |
| 46 | --Clicked enderman -- | |
| 47 | monitor.setCursorPos(2,10) | |
| 48 | monitor.write(" Clicked Enderman")
| |
| 49 | ||
| 50 | -- 2nd Row -- | |
| 51 | - | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight = 4) then |
| 51 | + | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 4) then |
| 52 | --Clicked Skeleton -- | |
| 53 | monitor.setCursorPos(2,10) | |
| 54 | monitor.write(" Clicked Skeleton")
| |
| 55 | - | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight = 4) then |
| 55 | + | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 4) then |
| 56 | --Clicked Skeleton -- | |
| 57 | monitor.setCursorPos(2,10) | |
| 58 | monitor.write(" Clicked Skeleton")
| |
| 59 | ||
| 60 | -- 3rd Row -- | |
| 61 | - | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight = 6) then |
| 61 | + | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 6) then |
| 62 | --Clicked Blaze | |
| 63 | monitor.setCursorPos(2,10) | |
| 64 | monitor.write(" Clicked Blaze")
| |
| 65 | - | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight = 6) then |
| 65 | + | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 6) then |
| 66 | --Clicked Blaze -- | |
| 67 | monitor.setCursorPos(2,10) | |
| 68 | monitor.write(" Clicked Blaze")
| |
| 69 | ||
| 70 | -- 4th Row -- | |
| 71 | - | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight = 8) then |
| 71 | + | elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 8) then |
| 72 | --Clicked Whisp -- | |
| 73 | monitor.setCursorPos(2,10) | |
| 74 | monitor.write(" Clicked Whisp")
| |
| 75 | - | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight = 8) then |
| 75 | + | elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 8) then |
| 76 | --Clicked Whisp -- | |
| 77 | monitor.setCursorPos(2,10) | |
| 78 | monitor.write(" Clicked Whisp")
| |
| 79 | end | |
| 80 | end | |
| 81 | ||
| 82 | repeat | |
| 83 | event,p1,p2,p3 = os.pullEvent() | |
| 84 | ||
| 85 | if event == "monitor_touch" then | |
| 86 | mouseWidth = p2 | |
| 87 | mouseHeight = p3 | |
| 88 | checkClickPosition() | |
| 89 | end | |
| 90 | until even=="char" and p1==("x") |