Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

yannickkutil

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by yannickkutil

  1. 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
    
    
    
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.