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

IceG4merBR

Members
  • Content Count

    8
  • Joined

  • Last visited

Posts posted by IceG4merBR

  1.  

    I did a program to manage my batteries and reactors, and i got a problem in reactor.setActive(true/false)

     for address, name in pairs(reactorsID) do
        local reactor = component.proxy(address)
        countR = countR + 1
        local tR = (countR + count) * 3
        progressBar( name, tR, reactor.getEnergyStored(), reactor.getEnergyCapacity(), 0x00bb00, true, "RF")
        progressBar( "Reactor(Energy Last Tick)", tR + 3, math.ceil(reactor.getEnergyProducedLastTick()), 6200, 0x00bb00, true, "RF")
        if brPower + totalPower < brMaxPower + totalMaxPower then
          reactor.setActive(True)
        else
          reactor.setActive(False)
        end
      end

    The reactor doesn't turn on or off, and the program doesn't return any error

    image.thumb.png.8acb5fdcddb459e20580084ccccb6a91.png.

    Here is the full code : https://pastebin.com/gkmtstis

  2. I got this error now.

    image.png.e303047f1b6b4f5a0f48a63e1cc413ac.png

    Only changed the printInfos() in startup() to printInfos("stored")

    local component = require("component")
    local term = require("term")
    local gpu = component.gpu
    local cube = component.basic_energy_cube
    local event = require("event")
     
    local colors = { black = 0x000000, red = 0xC14141}
     
    gpu.setBackground(colors.black)
    term.clear()
     
    local infos = {}
     
    cube["stats"] = {}
     
    function setInfos()
      infos["stored"] = { x = 3, y = 2, weight = 73, height = 1, title = "STORED ENERGY : ", unit = " RF"}
      infos["capacity"] = { x = 3, y = 4, weight = 73, height = 1, title = "BATTERY CAPACITY : ", unit = " RF"}
    end
     
    function printInfos(infoName)
      local maxLenght = 15
      local i = infos[infoName]
      gpu.set(i.x, i.y, i.title .. cube.stats[infoName] .. i.unit)
    end
     
    function updateCubeStats()
      cube.stats["stored"] = cube.getEnergyStored
    end
     
    function startup()
      updateCubeStats()
      setInfos()
      printInfos("stored")
    end
     
    startup()
     
    repeat
      updateCubeStats()
    until event.pull(0.1) == "interrupted"
  3. Got this error, but i have no idea how to fix it, need some help!.

    image.png.60d39dc095d3173c407069e70661963d.png

    Here is the code.

    local component = require("component")
    local term = require("term")
    local gpu = component.gpu
    local cube = component.basic_energy_cube
    local event = require("event")
     
    local colors = { black = 0x000000, red = 0xC14141}
     
    gpu.setBackground(colors.black)
    term.clear()
     
    local infos = {}
     
    cube["stats"] = {}
     
    function setInfos()
      infos["stored"] = { x = 3, y = 2, weight = 73, height = 1, title = "STORED ENERGY : ", unit = " RF"}
      infos["capacity"] = { x = 3, y = 4, weight = 73, height = 1, title = "BATTERY CAPACITY : ", unit = " RF"}
    end
     
    function printInfos(infoName)
      local maxLenght = 15
      local i = infos[infoName]
      gpu.set(i.x, i.y, i.title .. cube.stats[infoName] .. i.unit)
    end
     
    function updateCubeStats()
      cube.stats["stored"] = cube.getEnergyStored
    end
     
    function startup()
      updateCubeStats()
      setInfos()
      printInfos()
    end
     
    startup()
     
    repeat
      updateCubeStats()
    until event.pull(0.1) == "interrupted"

     

  4. I did this program, it's very simple, but i want to terminate it and i don't know how to do it... I tried Ctrl + C, Ctrl + Alt + C.

    I need some help.

    local component = require("component")
    local term = require("term")
    local event = require("event")
    local keyboard = require("keyboard")
     
    local cube = component.basic_energy_cube
    local computer = component.computer
    local gpu = component.gpu
    local w, h =gpu.getResolution()
     
    local colors = {}
    colors.gray = 0x555555
    colors.red = 0xFF0000
    colors.lime = 0x00FF00
     
    function label(x, y, message, color, ...)
      local color = color or gpu.getForeground()
      local oldColor = gpu.getForeground()
     
      gpu.setForeground(color)
      term.setCursor(x, y)
      print(string.format(message, ...))
      gpu.setForeground(oldColor)
    end
     
    function toMRf(val)
      return val / 1000000
    end
     
    function toJ(val)
      return val / 4 / 100000
    end
     
    os.sleep(2)
    term.clear()
    computer.beep(1000,1.5)
     
    while true do
     
      energy = toMRf(cube.getEnergyStored())
      energyMax = toMRf(cube.getMaxEnergyStored())
      energyJ = toJ(cube.getEnergyStored())
      energyMaxJ = toJ(cube.getMaxEnergyStored())
     
      label(1, 1, "%.2f MRf / %.2f MJ (Energia Acumulada)", colors.red, energy, energyJ )
      label(1, 3, "%.2f MRf / %.2f MJ (Capacidade da bateria)", colors.lime, energyMax, energyMaxJ)
    end

     

×
×
  • Create New...

Important Information

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