Advertisement
Oxolin

botcontrol.lua

Apr 17th, 2024 (edited)
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. local modem = peripheral.find("modem")
  2. local right = paintutils.loadImage("/bot/images/right.nfp")
  3. local left  = paintutils.loadImage("/bot/images/left.nfp")
  4. local forward    = paintutils.loadImage("/bot/images/forward.nfp")
  5. local back  = paintutils.loadImage("/bot/images/back.nfp")
  6. local fire  = paintutils.loadImage("/bot/images/fire.nfp")
  7.  
  8. modem.open(15)
  9.  
  10. -- FORWARD
  11. term.setCursorPos(11,4)
  12. paintutils.drawImage(forward,term.getCursorPos())
  13.  
  14. -- LEFT
  15. term.setCursorPos(5, 8)
  16. paintutils.drawImage(left, term.getCursorPos())
  17.  
  18. -- RIGHT
  19. term.setCursorPos(19, 8)
  20. paintutils.drawImage(right,term.getCursorPos())
  21.  
  22. -- BACK
  23. term.setCursorPos(11,14)
  24. paintutils.drawImage(back,term.getCursorPos())
  25.  
  26. -- FIRE
  27. term.setCursorPos(10,8)
  28. paintutils.drawImage(fire,term.getCursorPos())
  29.  
  30. repeat
  31.     local event, button, x, y = os.pullEvent("mouse_click")
  32.     if x >= 11 and x <= 16 and y >= 4 and y <=9 then
  33.         modem.transmit(43,15,"forward")
  34.     elseif x >= 5 and x <= 9 and y >= 8 and y <=13 then
  35.         modem.transmit(43,15,"left")
  36.     elseif x >= 19 and x <= 20 and y >= 8 and y <=13 then
  37.         modem.transmit(43,15,"right")
  38.     elseif x >= 11 and x <= 17 and y >= 14 and y <=17 then
  39.         modem.transmit(43,15,"back")
  40.     elseif x >= 10 and x <= 18 and y >= 8 and y <=13 then
  41.         modem.transmit(43,15,"fire")
  42.     end
  43.     sleep(.5)
  44. until false
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement