View difference between Paste ID: Ly3jxcSK and LbshT4pt
SHOW: | | - or go back to the newest paste.
1-
global delay = 10 --Nicht kleiner als 3!
1+
delay = 10 --Nicht kleiner als 3!
2-
global r = peripheral.wrap("back")
2+
r = peripheral.wrap("back")
3
4
while true do
5
  
6
  getData()
7
  
8
  if fuelPerc <= 25 then
9
    rs.setOutput("top", true)
10
  else
11
    rs.setOutput("top", false)
12
  end
13
  
14
  if pwrPerc >= 80 then
15
    reaktor.setActive(false)    
16
  end
17
  if pwrPerc <=30 then
18
    reaktor.setActive(true)
19
  end
20
  
21
  sleep(delay)
22
end
23
24
25
--FUNKTIONS
26
27
function getData()
28-
  global fuel = reaktor.getFuelAmount()
28+
  fuel = reaktor.getFuelAmount()
29-
  global fuelMax = reaktor.getFuelAmountMax()
29+
  fuelMax = reaktor.getFuelAmountMax()
30-
  global fuelPerc = math.floor( ((fuel / fuelMax)*100)+0.5)
30+
  fuelPerc = math.floor( ((fuel / fuelMax)*100)+0.5)
31
  
32-
  global pwr = reaktor.getEnergyStored()
32+
  pwr = reaktor.getEnergyStored()
33-
  global pwrMax = 10000000
33+
  pwrMax = 10000000
34-
  global pwrPerc = math.floor( ((pwr / pwrMax)*100)+0.5)
34+
  pwrPerc = math.floor( ((pwr / pwrMax)*100)+0.5)
35-
  global pwrLT = math.floor( reaktor.getEnergyProducedLastTick() +0.5 )
35+
  pwrLT = math.floor( reaktor.getEnergyProducedLastTick() +0.5 )
36
end