Hello, when I run the program I'm not getting the correct variable.
The variables remain at the default value, I do not know where the error.
Thank you for your help in advance.
local hardware = require("component")
local term = require("term")
local os = require("os")
local gpu = hardware.gpu
local zahl = 0
local AdresseGp = {["EVerbunden"]=0, ["EVorhanden"]=0, ["EDerzeit"]=0, ["ESpannung"]=0, ["ETick"]=0}
function coreUp()
local AdresseGp = {["EVerbunden"]=0, ["EVorhanden"]=0, ["EDerzeit"]=0, ["ESpannung"]=0, ["ETick"]=0}
for adresse, typName in hardware.list() do
if typName == "mfsu" then
AdresseGp["EVerbunden"] = AdresseGp["EVerbunden"] + 1
AdresseGp["EVorhanden"] = AdresseGp["EVorhanden"] + hardware.proxy(adresse).getEUCapacity()
AdresseGp["EDerzeit"] = AdresseGp["EDerzeit"] + hardware.proxy(adresse).getEUStored()
AdresseGp["ESpannung"] = AdresseGp["ESpannung"] + hardware.proxy(adresse).getDemandedEnergy()
AdresseGp["ETick"] = AdresseGp["ETick"] + hardware.proxy(adresse).getEUOutputPerTick()
end
end
end
term.clear()
while true do
term.clear()
coreUp()
term.setCursor(1,1)
if AdresseGp["EVerbunden"] <= 0 then
if zahl == 0 then
gpu.setBackground(0xFFFFFF)
gpu.setForeground(0xFF0000)
print("? Fehler: Es sind keine Devices Verbunden ---")
zahl = 1
else
gpu.setBackground(0x000000)
gpu.setForeground(0xFFFFFF)
print("? Fehler: Es sind keine Devices Verbunden ---")
zahl = 0
end
else
gpu.setBackground(0x000000)
gpu.setForeground(0xFFFFFF)
print("!Fehler: Quell Code in Beta!")
end
gpu.setBackground(0x000000)
gpu.setForeground(0xFFFFFF)
print("###########################################")
print("Energie Speicher Verbunden : "..AdresseGp["EVerbunden"])
print("Energie Speicher Insgesammt: "..AdresseGp["EVorhanden"])
print("Energie Speicher Derzeit : "..AdresseGp["EDerzeit"])
print("Energie Akku Ladestand : ".."n/a")
print("Energie Spannung : "..AdresseGp["ESpannung"])
print("Energie Richtung Derzeit : "..AdresseGp["ETick"])
os.sleep(0.5)
end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hello, when I run the program I'm not getting the correct variable.
The variables remain at the default value, I do not know where the error.
Thank you for your help in advance.
fixed code tags
Link to post
Share on other sites