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

Search the Community

Showing results for tags 'Code'.

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 3 results

  1. Michael

    Energy Stored

    Hello everyone, I'm trying to set up a Opencomputers energy monitoring system that will control the energy level of an Industrialcraft2 mfsu by turning on 1 to 6 reactors but I'm having problems at the energy reading part. Here is my code so far: https://pastebin.com/654kRYaf (ignore that getEnergyStored is commented out, I was testing something and uploaded to pastebin wrong version), but here is an abbreviated version with comments: -------------start of script---------- local fill = 0 --predefine variable fill local cap = 0 --predefine variable capacity require 'normal' things (event, component, term, colors, sides) local rs = component.redstone --Redstone I/O block local mfsu = component.ic2_te_mfsu ---as shown when components is run ----------create writing------------------ ---create writing and boxes ----------reset redstone (just in case) ---- set colors used to 0 ------------------------------------------- ------------------------------------------------------------------------ while true do local _,_,x,y = event.pull("touch") -----works up to this point fill = mfsu.getEnergyStored() --find amount of energy in mfsu cap = mfsu.getMaxEnergyStored() --find capacity of mfsu print(fill, cap) ---print it (temp) --------check user clicks squares and set redstone outputs-------- --//insert computer turn on reactors here (to do later)\\-- end ---end of script--- I plan to implement code that will turn off and on the reactors depending on the amount of energy in the mfsu but I havent been able to read the amount of energy in the mfsu to be able to make the calculations. (the big empty space on the left of the screen is for a progress bar that is currently hidden, which depends on the amount of energy in the capacitor) As you can see (bellow) the code works fine until the user clicks the screen, at which point it errors, the Max energy or current energy "returns a nil" and the code discontinues running. to my understanding this means that this doesn't exist therefore what is the current terminology? I could find one that works but I wanted to make one myself. Minecraft v. 1.10.2 Age Of Engineering v. 1.1.2 (Twitch modpack) OpenComputers v.
  2. Antheus

    Output Game

    How it Works: Write some code and use a spoiler and code that [spolier][code]Insert Lua code Here[/code][/spoiler] Then, the other people have to guess the output based on the code. If the code requires vars to run, put them as a comment at the end of the code as you would run the program with it (--Vars: XXX, XXX, Cake, Pie) The responding questions shall be as shown for strings or for numbers
  3. Hello, I'm working on a program to run my Big Reactor (ala Direwolf20's recent CC program) I started yesterday knowing very little about writing code and have managed to program the basic function which I wanted to start out with. I'm hoping to add more monitoring and adjustment functions later as I learn more, but this what I need to start off. I want my reactor to shut off when the energy buffer is at 90% and restart when the buffer is down to 10%. My buffer is currently 10mil RF. It works, once. If I run when the buffer is near full, it will shut down, and if I run the program when the buffer is low, it will start the reactor. It does not, however, shut the reactor back down once it is near full unless I rerun the program. My question is what do I need to add in order to have this run in the background and continuously manage my reactor? Here's my code: component = require("component") RF_BUFFER_MAX = 9000000 RF_BUFFER_MIN = 1000000 for _, reactor in pairs(REACTORS) do if reactor.getEnergyStored() >= RF_BUFFER_MAX then reactor.setActive(false) print("Reactor is offline") else if reactor.getEnergyStored() <=RF_BUFFER_MIN then reactor.setActive(true) print("Reactor is online") end end Thank you for any insight that you can give!
  • Create New...

Important Information

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