View difference between Paste ID: Tpsx2mNm and QpJqXjEb
SHOW: | | - or go back to the newest paste.
1
-- FUNCTIONS
2
function signal()
3
    rs.setOutput("back",true)
4
    sleep(1)
5
    rs.setOutput("back",false)
6
end
7
8
function checkWater()
9
  rednet.open('bottom')
10
  rednet.broadcast('check_water')
11
  id, result = rednet.receive()
12
  rednet.close()
13
  return result
14
end
15
16
function slitVodu()
17
   if checkWater() then
18
      signal()
19
      print('Voda slita')
20
   else
21
      print('Voda uzhe slita')
22
   end
23
end
24
25
function haletVodu()
26-
      
26+
   if checkWater() then    
27-
      print('Bada y ga haleta')
27+
      print('Bada yga haleta')
28-
      
28+
29
      signal()
30-
     signal()
30+
      print('haleBaey')
31-
       print('haleBaey')
31+
32
end
33
  
34
-- PROGRAM
35
while true do
36-
print ("Dobro pozhalovat")
36+
    print ("Dobro pozhalovat")
37-
print ("1 - slit' vodu ")
37+
    print ("1 - slit' vodu ")
38-
print ("2 - napolnit' vodoy ")
38+
    print ("2 - napolnit' vodoy ")
39
40-
text = read()
40+
    text = read()
41-
if text == '1' then
41+
    if text == '1' then
42-
    slitVodu()
42+
        slitVodu()
43-
elseif text == '2' then
43+
    elseif text == '2' then
44-
    --
44+
        haletVodu()
45-
else
45+
    else
46-
    print('Nepravilnaya komanda')
46+
        print('Nepravilnaya komanda')
47
    end
48
end
49
50
51