View difference between Paste ID: bdejZfAc and 6bpWVE3e
SHOW: | | - or go back to the newest paste.
1
local term           = require("term")
2
local com            = require("component")
3
4
if false == com.isAvailable("robot") then
5
    print("Эта прога для робота =Р")
6
    os.exit()
7
end
8
9
local unicode        = require("unicode")
10
local r              = require("robot")
11
local active_slot    = 1
12
local size           = r.inventorySize()
13
local gpu            = com.gpu
14
local w, h           = 50, 16  -- разрешение экрана (1тир макс "50, 16")
15
16
term.clear()
17
gpu.setResolution(w, h)
18
--gpu.setBackground(0xFFFFFF)       -- цвет фона
19
--gpu.setForeground(0x000000)       -- цвет текста
20
gpu.fill(1, 1, w, h, " ")         -- заливаем пустоту
21
-- Обводка экрана
22
gpu.fill(1, 1, 1, 1, "┌")
23
gpu.fill(1, h, 1, 1, "└")
24
gpu.fill(1, 2 ,1, h-2, "│")       -- левая пололса
25
gpu.fill(w, 2, 1, h-2, "│")       -- правая полоса
26
gpu.fill(2, 1, w-2, 1, "─")       -- верхняя полоса
27
gpu.fill(2, h, w-2, 1, "─")       -- нижняя полоса
28
gpu.fill(w, 1, 1, 1, "┐")
29
gpu.fill(w, h, 1, 1, "┘")
30
-- Текст
31
gpu.set(3, 2, "Робот "..r.name().." запущен!")
32
gpu.fill(3, 3, unicode.len("Робот "..r.name().." запущен!"), 1, "─")
33
gpu.set(w-1-unicode.len("by bogatyr4ik"), h-1, "by bogatyr4ik")
34
while true do
35
  r.place(0, true)
36
  if  r.count(active_slot) == 0 and r.select(active_slot) ~= size then
37
      active_slot = active_slot + 1
38
  end
39
  if  r.select(active_slot) == size and r.count(active_slot) == 0 then
40
      active_slot = 1 
41
  end
42
  os.sleep(0)
43
end