SHOW:
|
|
- or go back to the newest paste.
1 | s = sleep(0.2) | |
2 | a = peripheral.wrap("back") | |
3 | mon = peripheral.wrap("left") | |
4 | ||
5 | mon.clear() | |
6 | ballMax = a.getMaxEnergyStored() | |
7 | - | function init() |
7 | + | print(ballMax/5) |
8 | - | ballMin = a.getEnergyStored() |
8 | + | print(ballMax/4) |
9 | - | ballMax = a.getMaxEnergyStored() |
9 | + | print(ballMax/3) |
10 | print(ballMax/2) | |
11 | - | init() |
11 | + | |
12 | - | function math() |
12 | + | function ballIO() |
13 | - | ballMinNow = ballMin |
13 | + | ballMinNow = a.getEnergyStored() |
14 | - | sleep(0.5) |
14 | + | sleep(1) |
15 | - | ballMinLater = ballMin |
15 | + | ballMinLater = a.getEnergyStored() |
16 | ballState = ballMinLater - ballMinNow | |
17 | - | mon.setCursorPos(1,2) |
17 | + | if ballState >= 0.0 then |
18 | - | mon.setTextColor(colors.white) |
18 | + | mon.setCursorPos(1,2) |
19 | - | print(ballMin) |
19 | + | mon.setTextColor(colors.green) |
20 | - | mon.write(ballState) |
20 | + | mon.write("+"+tostring(ballState)+" RF/s") |
21 | elseif ballState <= 0.0 then | |
22 | mon.setCursorPos(1,2) | |
23 | mon.setTextColor(colors.orange) | |
24 | - | math() |
24 | + | mon.write("-"+tostring(ballState)+" RF/s") |
25 | end | |
26 | - | sleep(s) |
26 | + | |
27 | ||
28 | function ballBuffer() | |
29 | ballCharge = a.getEnergyStored() | |
30 | - | mon.clear() |
30 | + | if ballCharge >= ballMax/2 then |
31 | mon.setCursorPos(1,1) | |
32 | - | end |
32 | + | mon.setTextColor(colors.purple) |
33 | mon.write(tostring(ballCharge)+" RF ") | |
34 | elseif ballCharge >= ballMax/3 then | |
35 | mon.setCursorPos(1,1) | |
36 | mon.setTextColor(colors.cyan) | |
37 | mon.write(tostring(ballCharge)+" RF ") | |
38 | elseif ballCharge >= ballMax/4 then | |
39 | mon.setCursorPos(1,1) | |
40 | mon.setTextColor(colors.lightblue) | |
41 | mon.write(tostring(ballCharge)+" RF ") | |
42 | elseif ballCharge >= ballMax/5 then | |
43 | mon.setCursorPos(1,1) | |
44 | mon.setTextColor(colors.blue) | |
45 | mon.write(tostring(ballCharge)+" RF ") | |
46 | elseif ballCharge >= ballMax/6 then | |
47 | mon.setCursorPos(1,1) | |
48 | mon.setTextColor(colors.lime) | |
49 | mon.write(tostring(ballCharge)+" RF ") | |
50 | elseif ballCharge >= ballMax/7 then | |
51 | mon.setCursorPos(1,1) | |
52 | mon.setTextColor(colors.green) | |
53 | mon.write(tostring(ballCharge)+" RF ") | |
54 | elseif ballCharge >= ballMax/8 then | |
55 | mon.setCursorPos(1,1) | |
56 | mon.setTextColor(colors.yellow) | |
57 | mon.write(tostring(ballCharge)+" RF ") | |
58 | elseif ballCharge >= ballMax/9 then | |
59 | mon.setCursorPos(1,1) | |
60 | mon.setTextColor(colors.orange) | |
61 | mon.write(tostring(ballCharge)+" RF ") | |
62 | elseif ballCharge >= ballMax/10 then | |
63 | mon.setCursorPos(1,1) | |
64 | mon.setTextColor(colors.red) | |
65 | mon.write(tostring(ballCharge)+" RF ") | |
66 | elseif ballCharge >= ballMax/11 then | |
67 | mon.setCursorPos(1,1) | |
68 | mon.setTextColor(colors.white) | |
69 | mon.write(tostring(ballCharge)+" RF ") | |
70 | end | |
71 | end | |
72 | ||
73 | function update() | |
74 | ballIO() | |
75 | ballBuffer() | |
76 | end | |
77 | ||
78 | while true do | |
79 | sleep(s) | |
80 | update() | |
81 | end | |
82 | ||
83 | --Größer-als-Zeichen (>) und das Kleiner-als-Zeichen (<) | |
84 | --2 140 000 000 000 trillion |