Advertisement
Guest User

monTurtle

a guest
Apr 28th, 2017
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. rednet.open("right")
  2. function drawKeyboard()
  3.   term.clear()
  4.   term.setCursorPos(1,2)
  5.   print("+---+---+---+---+")
  6.   print("|Del| W |Ent| ^ |")
  7.   print("+---+---+---+---+")
  8.   print("| A | S | D | v |")
  9.   print("+---+---+---+---+")
  10.   print("|Inv:001| - | + |")
  11.   print("+---+---+---+---+")
  12. end
  13. drawKeyboard()
  14. local TSID = 79
  15. local invCount = 1
  16. while true do
  17. local event,button,X,Y = os.pullEventRaw()
  18.   if event == "mouse_click" then
  19.     if X >= 2 and X <= 4 and Y == 3 and button == 1 then
  20.       rednet.send(TSID,"dig")
  21.     elseif X >= 6 and X <= 8 and Y == 3 and button == 1 then
  22.       rednet.send(TSID,"forward")
  23.     elseif X >= 10 and X <= 12 and Y == 3 and button == 1 then
  24.       rednet.send(TSID,"place")
  25.     elseif X >= 14 and X <= 16 and Y == 3 and button == 1 then
  26.       rednet.send(TSID,"up")
  27.     elseif X >= 2 and X <= 4 and Y == 5 and button == 1 then
  28.       rednet.send(TSID,"turnLeft")
  29.     elseif X >= 6 and X <= 8 and Y == 5 and button == 1 then
  30.       rednet.send(TSID,"back")
  31.     elseif X >= 10 and X <= 12 and Y == 5 and button == 1 then
  32.       rednet.send(TSID,"turnRight")
  33.     elseif X >= 14 and X <= 16 and Y == 5 and button == 1 then
  34.       rednet.send(TSID,"down")
  35.     elseif X >= 10 and X <= 12 and Y == 7 and button == 1 then
  36.       if invCount >= 2 and incCount <= 9 then
  37.         invCount = invCount - 1
  38.         sendInvCount = tostring(invCount)
  39.         rednet.send(TSID,sendInvCount)
  40.         term.setCursorPos(6,7)
  41.         write("00"..tostring(invCount))
  42.       elseif invCount <= 1 then
  43.         invCount = 1
  44.         rednet.send(TSID,"1")
  45.         term.setCursorPos(6,7)
  46.         write("00"..tostring(invCount))
  47.       elseif invCount <= 10 then
  48.       end
  49.     elseif
  50.     end
  51.   end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement