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

Big Reactors Computer Port Questions

Started by Nio9345, 24 May 2014 - 12:47 PM
Nio9345 #1
Posted 24 May 2014 - 02:47 PM
So I want to write a simple program to control reactors and turbines with ComputerCraft Computers via wired modem and also some other questions if it possible. But first I run into a problem with the output in the screen:
I wrote 2-3 lines of code so I can start getting the hang of the API of these mods but I run in a bit of problem. This is what I wrote :
local reactor = peripheral.wrap ("back")

print ("The reactor fuel level is ", reactor.getFuelAmount)

and this is what I got :
The reactor fuel level is function:43aa55c5

which is totaly wrong according to Big Reactor's Computer Port API, it supposed to show some amount in mB. I run the latest update of Tekkit mod pack + Mekanism which I added myself.

As for the rest of the questions are,

1) How I use the wired modem in order to control the Reactors and Turbines without the need to attach computers directly on them ?
2) If I want to use a monitor in order to get some info regarding some values and the program runs on loop, how I can print various informations without the program printing every line while looping ?
3) Can I write a library of functions in order, for examble get various info, without writing pages of functions in the main program like I can do in C++ ?
4) Do I ask dumb questions ?
Lyqyd #2
Posted 24 May 2014 - 09:43 PM
You'll need to actually call the function, so change it to reactor.getFuelAmount().
Sir_Mr_Bman #3
Posted 24 May 2014 - 10:32 PM
-snip-

1) How I use the wired modem in order to control the Reactors and Turbines without the need to attach computers directly on them ?
2) If I want to use a monitor in order to get some info regarding some values and the program runs on loop, how I can print various informations without the program printing every line while looping ?
3) Can I write a library of functions in order, for examble get various info, without writing pages of functions in the main program like I can do in C++ ?
4) Do I ask dumb questions ?

1) Use their peripherals, and just read the API's on it.
2) You can print to a monitor, sure! Something like this might do the trick…

-- You can also "wrap" the peripheral side to a variable:
local monitor = peripheral.wrap("top")
monitor.write("Hello World!")
-- Stolen from the wiki, http://computercraft.info/wiki/Monitor
Just have a loop clearing the monitor (same way you would with term.clear()), and then redrawing your information.
3) You can write an API, but this is a little bit more advanced. Here's the way to write a very BASIC api…
File that contains the API. Directory: "/derp"

function aFunctionName(args)
	print(args)
end
This is the code in the file that is implementing the api. Directory: "/startup"

os.loadAPI("derp")
derp.aFunctionName("Hello, world!")

Result: "Hello, world!"


4) Depends on who you ask.
Edited on 24 May 2014 - 08:34 PM
Nio9345 #4
Posted 25 May 2014 - 07:19 AM
Thank you both of you for the info that you provided me … ! :D/>

-snip-

1) How I use the wired modem in order to control the Reactors and Turbines without the need to attach computers directly on them ?
2) If I want to use a monitor in order to get some info regarding some values and the program runs on loop, how I can print various informations without the program printing every line while looping ?
3) Can I write a library of functions in order, for examble get various info, without writing pages of functions in the main program like I can do in C++ ?
4) Do I ask dumb questions ?

1) Use their peripherals, and just read the API's on it.
2) You can print to a monitor, sure! Something like this might do the trick…

-- You can also "wrap" the peripheral side to a variable:
local monitor = peripheral.wrap("top")
monitor.write("Hello World!")
-- Stolen from the wiki, http://computercraft.info/wiki/Monitor
Just have a loop clearing the monitor (same way you would with term.clear()), and then redrawing your information.
3) You can write an API, but this is a little bit more advanced. Here's the way to write a very BASIC api…
File that contains the API. Directory: "/derp"

function aFunctionName(args)
	print(args)
end
This is the code in the file that is implementing the api. Directory: "/startup"

os.loadAPI("derp")
derp.aFunctionName("Hello, world!")

Result: "Hello, world!"


4) Depends on who you ask.

I tried with the help of the wired modem API but I still can't get in to give me info on the reactor and the first line that have reactor.get"Anything" just returns error with nill value