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

Nuclearcraft Fission reactor

Question

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.

 

image.thumb.png.783d87a3b7535453946a003910b9323c.png

 

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

 image.thumb.png.e756578da8814511e53e1094c875faae.png

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()
end

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)
  end
  CP = GP() -- # don't forget to update the variable value within the loop
end

 

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.

Guest
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.

Loading...

×
×
  • Create New...

Important Information

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