This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Jojomatik's profile picture

Need help with BigReactors

Started by Jojomatik, 31 May 2014 - 09:54 AM
Jojomatik #1
Posted 31 May 2014 - 11:54 AM
Hey I need help with BigReactors:
I found this nice wiki entry on technicpack.net:
In subsection Example I found this:
local reactor
reactor = peripheral.wrap("back")
reactor.getFuelTemperature()
reactor.setActive(true)

When I tipe in this intor my computer this message will be shown after starting the Program:

Reactor:3: attempt to index ? (a nil value)

Before I searched I tried to use my not very good computercraft skills (I have wrote a mining program for Turtles before, which is great working).

I build this:

Test=100000
Test2=900000
while getEnergyStored() < Test do
setActive("true")
end
while getEnergyStored() > Test2 do
setActive("false")
end

It says:

Reactor:3: attempt to call nil

When I wrote reactor. before every API it says:

Reactor:3: attempt to index ? (a nil value)

So I tried out if I am connected to the ComputerPort / Reactor

I did this:

if getConnected then
print("yes")
end
if not getConnected then
print("no")
end

And it says: no
I don't even know when to use "if" or "while"
The back of the computer is directly connected to the reactor.


Need help why I'm not connected to reactor.
Lyqyd #2
Posted 31 May 2014 - 09:19 PM
Moved to Ask a Pro.
kreezxil #3
Posted 31 May 2014 - 09:53 PM
Hey I need help with BigReactors:
I found this nice wiki entry on technicpack.net:
In subsection Example I found this:
local reactor
reactor = peripheral.wrap("back")
reactor.getFuelTemperature()
reactor.setActive(true)

When I tipe in this intor my computer this message will be shown after starting the Program:

Reactor:3: attempt to index ? (a nil value)

Before I searched I tried to use my not very good computercraft skills (I have wrote a mining program for Turtles before, which is great working).

I build this:

Test=100000
Test2=900000
while getEnergyStored() < Test do
setActive("true")
end
while getEnergyStored() > Test2 do
setActive("false")
end

It says:

Reactor:3: attempt to call nil

When I wrote reactor. before every API it says:

Reactor:3: attempt to index ? (a nil value)

So I tried out if I am connected to the ComputerPort / Reactor

I did this:

if getConnected then
print("yes")
end
if not getConnected then
print("no")
end

And it says: no
I don't even know when to use "if" or "while"
The back of the computer is directly connected to the reactor.


Need help why I'm not connected to reactor.

It would be helpful if you told us what modpack you were using. However, based what I could find on the internet I'd suggest you start here: http://wiki.technicpack.net/Reactor_Computer_Port

Read that whole page don't gloss over it.

My thoughts are that if ccSensors is "really" installed you'll need to both craft and install the reactor computer port and then rednet wire from your computer to that port. That should stop the errors you are receiving now.

I can't help you further as I'm not running a mod pack with big reactors or ccSensors installed.
TDplay #4
Posted 31 May 2014 - 10:59 PM
The errors mean these:

Reactor:3: attempt to call nil
It is truing to call something that it doesn't understand on line 3.

Reactor:3: Attempt to index ? (a nil value)
Reading more, that was probably caused by the word reactor on line 3.

For the future, here's the layout:
Program/API:line:error

Also,
If makes it go IF the variable is true and stops at the end.
While makes it go IF the variable is true and repeats at the end UNTIL the variable is false.

If true then
print("Hi")
end

That would result in:

Hi

Whereas:

While true do
print("Hi")
end

That code would result in:

SpoilerHi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi

Summed up:
It would keep writing Hi to the screen.
Bmandk #5
Posted 01 June 2014 - 12:54 AM
The first thing that popped up which could be wrong would be the setup. In the case with your code, you would need to have the computer directly next to the computer port in the reactor, with the computer facing away from the port. I'm assuming you have just used the modems, which is quite more complicated. This tutorial will help you out a bit with using modems for remote access for peripherals, in this case the computer port: https://www.youtube.com/watch?v=OWtzoJMmFL4
The first part with the glasses isn't important, though cool.
I have just hooked my reactor up to a computer port with a modem, and it was a bit of hassle to figure out how to call the functions with modems, but the tutorial explained it quite well for me. If you need more, I can give you some example script I have.
Retriever #6
Posted 01 June 2014 - 02:09 AM
Went to test this out and had the same problems at first, then i checked the mod version running. The current FTB packs are only running BigReactors 0.2 so only the second table of functions on http://wiki.technicp...r_Computer_Port are usable, hence why reactor.getFuelTemperature() was giving an error (assuming you're running FTB).

To create a while loop for checking the energy level would require something along the lines of this:

reactor = peripheral.wrap("back")  --Set the peripheral to a name so it can be called easily
minimum = 100000  --Define the minimum energy level
maximum = 900000  --Define the maximum energy level
while true do  --Start a constant loop
  stored = reactor.getEnergyStored()  --Check the energy level
  if stored < minimum then --Is the current level less than the minimum?
	reactor.setActive(true)  --Enable the reactor if so
  elseif stored > maximum then  --If not, is the current level more than the maximum?
	reactor.setActive(false)  --Disable the reactor if so
  end
  sleep(1)  --Wait 1 second before checking again
end

Hope this helps.
Edited on 01 June 2014 - 12:11 AM
Jojomatik #7
Posted 01 June 2014 - 12:09 PM
Thank you for replying to my Post.
I'm using a Modpack called Dinoxic: 1.6.4
Installed are (I'm just saying the name of the .jar):
-BigReactors-0.3.3.A.jar
-ComputerCraft1.58.zip
We don't have ccSensors installed, should we? It's our own Modpack and still in development.
Thanks to Retriever I'll try this out but I think we have installed BigReactors 0.3

My setup:
A Computer which is directly placed next to the port and the display is facing away from the Computerport.
Jojomatik #8
Posted 01 June 2014 - 12:15 PM
When I use your code Retriever I get this:
New:5: attempt to index ? (a nil value)
Whitecatblack #9
Posted 01 June 2014 - 05:30 PM
Jojomatik said:
When I use your code Retriever I get this:
New:5: attempt to index ? (a nil value)
I know hardly anything about Big Reactors, but this seems like a very simple, generic error.


reactor = peripheral.wrap("back")  --Set the peripheral to a name so it can be called easily
minimum = 100000  --Define the minimum energy level
maximum = 900000  --Define the maximum energy level
while true do  --Start a constant loop
  stored = reactor.getEnergyStored()  --Check the energy level
  if stored < minimum then --Is the current level less than the minimum?
		reactor.setActive(true)  --Enable the reactor if so
  elseif stored > maximum then  --If not, is the current level more than the maximum?
		reactor.setActive(false)  --Disable the reactor if so
  end
  sleep(1)  --Wait 1 second before checking again
end
Well, that is because you reactor is not on the "back" side of your computer, if my guess is correct. How are the computer and the reactor connected? If the reactor is directly touching the computer, change "back" on line 1 to whatever side it is touching. If it is connected with wired modems and networking cables or wireless modems, it is a bit different.

Whitecatblack
Jojomatik #10
Posted 01 June 2014 - 06:16 PM
Jojomatik said:
When I use your code Retriever I get this:
New:5: attempt to index ? (a nil value)
I know hardly anything about Big Reactors, but this seems like a very simple, generic error.


reactor = peripheral.wrap("back")  --Set the peripheral to a name so it can be called easily
minimum = 100000  --Define the minimum energy level
maximum = 900000  --Define the maximum energy level
while true do  --Start a constant loop
  stored = reactor.getEnergyStored()  --Check the energy level
  if stored < minimum then --Is the current level less than the minimum?
		reactor.setActive(true)  --Enable the reactor if so
  elseif stored > maximum then  --If not, is the current level more than the maximum?
		reactor.setActive(false)  --Disable the reactor if so
  end
  sleep(1)  --Wait 1 second before checking again
end
Well, that is because you reactor is not on the "back" side of your computer, if my guess is correct. How are the computer and the reactor connected? If the reactor is directly touching the computer, change "back" on line 1 to whatever side it is touching. If it is connected with wired modems and networking cables or wireless modems, it is a bit different.

Whitecatblack

As i told before my Computers display is facing away from the reactor so the backside should be connected to the Computer Port.

My Guess:

We have to install OpenPeripheral in the modpack.
Because line 5 is the first place where peripheral.wrap("back") is used.

Do we have to install?
Whitecatblack #11
Posted 01 June 2014 - 06:49 PM
jjomatik said:
We have to install OpenPeripheral in the modpack.
No, I don't think you have to. If your computer's back is directly touching the Reactor Computer Port block of a formed big reactor, it should work. If the computer truly is setup as I described above, type into the computer's main screen "lua"(without the quotes) and then type these commands once in lua:

p = peripheral.wrap("back") --then press enter
p.getActive() -- then press enter
If everything is set up as it should be, that will return true.

Whitecatblack
Retriever #12
Posted 01 June 2014 - 07:34 PM
As Whitecatblack is saying, if you are running 0.3 all the errors are being caused by the computer not being able to find the peripheral or the reactor not being setup properly.

Here is the setup i tested with:
Spoiler
If the reactor is properly setup white dots will appear in the corners:
Spoiler
Jojomatik #13
Posted 01 June 2014 - 08:25 PM
When i would know how to, I would add images of my setup, but I don't.

@Whitecatblack:

When I type in lua I get this:

lua>

then I write … it seems like this
lua> p = peripheral.wrap("back")
lua> p.getActive()
then I get this:
lua:1: attempt to index ? (a nil value)
Whitecatblack #14
Posted 01 June 2014 - 08:34 PM
Well, that would indicate that either the block on the "back" of the computer isn't the Reactor Computer Port block, or you didn't properly form the multi-block reactor structure. Ensure that you can actually access and run the reactor so that you can prove it has actually formed.
Retriever said:
If the reactor is properly setup white dots will appear in the corners:
Or this, and as I don't actually use Big Reactors, I cannot confirm what Retriever says, although that may be a good place to start.

Whitecatblack
Jojomatik #15
Posted 01 June 2014 - 08:41 PM
As Whitecatblack is saying, if you are running 0.3 all the errors are being caused by the computer not being able to find the peripheral or the reactor not being setup properly.

Here is the setup i tested with:
Spoiler
If the reactor is properly setup white dots will appear in the corners:
Spoiler
What modpack are you running on / are ccSensors / OpenPeripherals Installed?

Yes I see the white dots and the lines. The only difference between yours and mine:

Mine is 5*5*5 Blocks big and I have some Reactor glass instead of the normal blocks. And it is even producing Energy fine but I can't control it with my computer.

I can't find my problem.
Retriever #16
Posted 01 June 2014 - 08:47 PM
Modpack i'm running is FTB Tech World 2 (1.1.6), BigReactors 0.2 and OpenPeripherals 0.3.1
Jojomatik #17
Posted 01 June 2014 - 09:01 PM
I'm going to install openPeripherals tomorrow and try it out again.
Jojomatik #18
Posted 01 June 2014 - 09:28 PM
Modpack i'm running is FTB Tech World 2 (1.1.6), BigReactors 0.2 and OpenPeripherals 0.3.1

Would be nice when you could try it out again in our modpack. Thanks