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

Search the Community

Showing results for tags 'events'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Fediverse ID



Found 1 result

  1. I'm working on a small bit of code that reads from a IC2 power storage block and displays it's current and maximum storage. I also want it to toggle a Reactor based on either a keypress or a CLI menu option. As the code has to refresh a LOT, I think a keypress option is the easiest way, but I can't, for the life of me, figure it out. Here's what I have so far... os.execute("cls") -- Hook the component local component = require("component") local term = require("term") local side = require("sides") local keyboard = require("keyboard") local event = require("event") local rs = component.redstone local batbox = component.cesu local board = component.keyboard function toggleBox() if rs.getOutput(side.top) == 18 then rs.setOutput(side.top, 0) else rs.setOutput(side.top, 18) end end local function keyCheck() while true do e = event.pull(1, "key_up") if e == "enter" then toggleBox() elseif e == "back" then running = false end end end keyChecker = coroutine.create(keyCheck) function main() running = true while true do -- Get the tank information, results are in table format local tInfo = batbox local cap = tonumber(batbox.getCapacity()) local fill = tonumber(batbox.getStored()) -- Output as you want... a very simple way: print("CESU Power Levels and Controls") print("Energy Stored : "..fill) print("CESU Capacity : "..cap) print("\n Press Enter to toggle reactor.") print("Press Back to return to OpenOS.") term.setCursor(1,1) end end main() And yes, I now see the redundancy of having "cls" there, when I have 'term.setCursor(1,1)' there... What is it that I am missing?
  • Create New...

Important Information

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