Advertisement
Good_Pudge

AutoCraft in Minecraft [OC]

Jul 11th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. local com = require("component")
  2. local gpu = com.gpu
  3. local modem = com.modem
  4. local colors = require("colors")
  5. local term = require("term")
  6. local kb = require("keyboard")
  7. local event = require("event")
  8. local thread = require("thread")
  9.  
  10. OldF=gpu.getForeground()
  11. OldB=gpu.getBackground()
  12. OldSX,OldSY=gpu.getResolution()
  13.  
  14. gpu.setResolution(80,25)
  15.  
  16. NewF=colors.blue
  17. NewB=colors.orange
  18.  
  19. gpu.setBackground(NewB,true)
  20. gpu.setForeground(NewF,true)
  21.  
  22. term.clear()
  23.  
  24. thread.init()
  25.  
  26. locRU=
  27. {
  28.     Version="0.1",
  29.     Main="Автокрафт ",
  30.     Error="Ошибка",
  31.     Exit="Выход",
  32.     AddRecept="Добавить рецепт"
  33. }
  34.    
  35. --Заголовок--
  36. term.setCursor(40-(12/2),2)
  37. term.write(locRU.Main.." "..locRU.Version)
  38.  
  39. --Выход--
  40. term.setCursor(80-7,24)
  41. term.write(locRU.Exit)
  42.  
  43. --Добавить рецепт--
  44. term.setCursor(40-(17/2),13)
  45. term.write(locRU.AddRecept)
  46.  
  47. --Поисковая строка--
  48. gpu.setBackground(colors.black)
  49. gpu.setForeground(colors.white)
  50. gpu.fill(20,16,40,3," ")
  51.    
  52. while true do
  53.     function KD()
  54.         KD,_,_,_,_,_=event.pull("key_down")
  55.         return KD
  56.     end
  57.    
  58.     function Touch()
  59.         Touch,_,ScreenX,ScreenY,_,nick=event.pull("touch")
  60.         return Touch
  61.     end
  62.    
  63.     thread.create(KD)
  64.     thread.create(Touch)
  65.    
  66.     T=Touch()
  67.     K=KD()
  68.    
  69.     if T and ScreenX>=73 and ScreenX<=78 and ScreenY==24 then
  70.         break
  71.     end
  72.    
  73.     if K and kb.isKeyDown(kb.keys.q) then
  74.         break
  75.     end
  76.    
  77.     if T and ScreenX>=20 and ScreenY<=60 and ScreenY==16 then
  78.         term.setCursor(22,16)
  79.     end
  80.    
  81.     thread.waitForAll()
  82. end
  83.  
  84. gpu.setBackground(OldB)
  85. gpu.setForeground(OldF)
  86. gpu.setResolution(OldSX,OldSY)
  87. term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement