• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# test

a guest Jun 17th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. mon={peripheral.wrap("monitor_0"),peripheral.wrap("monitor_1"),peripheral.wrap("monitor_2"),peripheral.wrap("monitor_3")}
2.
3. function Pixel(x,y,color,a)
4.   a.setTextScale(0.5)
5.   a.setCursorPos(x,y)
6.   a.setBackgroundColor(color)
7.   a.write(" ")
8. end
9.
10. function Box(w,x,y,z,color,a)
11. -- w, x = x1, y1
12. -- y, z = x2, y2
13. -- a = monitor
14.   for g=0,z-x do
15.     for i=0,y-w do
16.       Pixel(w+i,x+g,color,a)
17.     end
18.   end
19. end
20.
21. function Elevator(x,y,color,a)
22. --x,y = x,y
23. --color = color
24. --a = monitor
25.   Box(x-3,y,x+3,y+1,color,a)
26.   Box(x-1,y,x+1,y+11,color,a)
27. end
28.
29. function Button(w,x,y,z,a,b,c)
30. -- w,x = x1 y1
31. -- y,z = x2 y2
32. -- a,b,c = side, PosX , Pos Y
33.
34.   if (a == "monitor_0" or a == "monitor_1" or a == "monitor_2" or "monitor_3") and b>=w and b<=y and c>=x and c<=z then
35.   return true
36.   else return false
37.   end
38. end
39. --16,11
40.
41. function Draw(x,i,j,a)
42. --1<x<10
43. -- a= monitor
44. --i,j == color 1, color 2
45.   Box(1,1,7,5,i,a)
46.   Box(1,6,7,6,colors.black,a)
47.   Box(1,7,7,11,j,a)
48.   Box(8,1,8,11,colors.black,a)
49.   Box(9,1,16,11,colors.gray,a)
50.   Elevator(12,x,colors.black,a)
51.
52. end
53.
54. for i=1,#mon do
55.   mon[i].setTextScale(0.5)
56.   mon[i].setBackgroundColor(colors.black)
57.   mon[i].setCursorPos(1,1)
58.   mon[i].clear()
59.   Draw(10,colors.lime,colors.red,mon[i])
60. end
61.
62. BAS=true
63.
64. while true do
65.   event,side,xPos,yPos= os.pullEvent("monitor_touch")
66.   if (Button(1,1,8,5,side,xPos,yPos) == true) and (BAS==true) then
67.     rs.setBundledOutput("back",colors.yellow)
68.     BAS=false
69.     sleep(2)
70.     for a=1,10 do
71.       for i=1,#mon do
72.         Draw(10-a,colors.lime,colors.red,mon[i])
73.       end
74.       sleep(0.3)
75.       if a == 10 then
76.         sleep(2)
77.         for i = 1, #mon do
78.           Draw(10-a,colors.red,colors.lime,mon[i])
79.         end
80.       end
81.     end
82.
83.   elseif (Button(1,7,8,11,side,xPos,yPos) == true) and (BAS==false) then
84.     rs.setBundledOutput("back",0)
85.     BAS=true
86.     sleep(2)
87.     for a=1,10 do
88.       for i=1,#mon do
89.         Draw(a,colors.red,colors.lime,mon[i])
90.       end
91.       sleep(0.3)
92.       if a == 10 then
93.         sleep(2)
94.         for i = 1,#mon do
95.           Draw(10-a,colors.lime,colors.red,mon[i])
96.         end
97.       end
98.     end
99.   end
100.
101. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top