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

Nuclearcraft Fission reactor


I was attempting to automate my fission reactor in order to increase my efficiency so it doesn't use fuel when the buffer is more than 3/4 of the max buffer size and when it is, to emit a redstone signal to the top of the redstone I?O port to turn it off until the buffer fell below 4000. as shown in the code below.




However this Error code constantly appears, and i am stumped.


Share this post

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

There are a couple errors. The first is that the `while` keyword must be lowercase. Also within the `while` loop the if statement is missing the `end` keyword. I believe you'll also need to require the libraries you need before using them in a definition.

local component = require "component"
local sides = require "sides"

local redstone = component.redstone
local reactor = component.nc_fission_reactor

local function GP()
  return reactor.getEnergyStored()

local mP, MP = 4000, reactor.getMaxEnergyStored()
local MMP, CP = (MP / 4) * 3, GP()

while CP > 0 do
  if CP > MMP then
    redstone.setOutput(sides.top, 15)
  elseif CP < mP then
    redstone.setOutput(sides.top, 0)
  CP = GP() -- # don't forget to update the variable value within the loop


Share this post

Link to post
Share on other sites
  • 0

That helps greatly, as someone more used to python and PHP coding coming to lua has meant i tend to make these types of mistakes without realizing lol

Share this post

Link to post
Share on other sites
  • 0

I suspected you might be coming from python :). You might be interested in moonscript. I made a simple patch that allows programs to use the shebang syntax in OpenOS i.e

for i = 1, 5
  print i unless i%2 == 0


Share this post

Link to post
Share on other sites

Join the conversation

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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