Jump to content

MFR RedNet API?


weirleader

Recommended Posts

Hey all, I'm having a heck of a time tracking down info on integrating RedNet (MFR RedNet, not the ComputerCraft one) into my ComputerCraft system. Essentially, I'd like to use CC to monitor my RedNet PRC to make sure it's operating as expected.

Yes, I know that for a lot of things I can probably just use CC instead and at some point in the future I'll get to that, but for now what I really want is someone to point me in the direction of any documentation.

On the MFR site it mentions that Javadocs are provided, but I've got no idea what that means and couldn't figure it out. Thanks in advance!

Link to comment
Share on other sites

So do these require installation of additional files, or are they part of the installed ComputerCraft? Because I tried that approach and the computer is getting nothing from my RedNet cables (and I've verified a signal is being sent).

I'll include the code below in case it's just my programming/syntax that's the problem.


print(colors.test (redstone.getBundledInput("top"), colors.yellow))

Link to comment
Share on other sites

They are a part of CC. I'm not able to test things at the moment so I'm pulling from memory for this. Here's what I'd do to test this. Print the output from redstone.getBundledInput("top"). This call returns a whole number which represents which colors are on or off. If things are working correctly you should see some value greater than 0 if any of the colors are active. For example if only white is on it should return 1. If only magenta is on it should return 4. If both magenta and white are on it should return 5 (4 + 1) and so on. colors.test will return true if the color provided as the second argument is "on" in the whole number passed as the first argument.

Link to comment
Share on other sites

Excellent -- that is definitely returning a value so it must be an error somewhere in my logic. Thanks for helping me understand the functionality a bit better.

EDIT: I don't suppose there's any EASY way to check the VARS values using CC, is there? I guess I'm going to have to slap something together to output varying signal strength based on vars values -- it's less than elegant, but all I can figure out at the moment.

Link to comment
Share on other sites

I think you may simply be testing the wrong color. The rednet cables are tricky to tell the colors apart some times.

Try this handly little script I just whipped up. Be sure to change the getBundledInput call to check the correct side:


c = {}

c.white = 1

c.orange = 2

c.magenta = 4

c.lightBlue = 8

c.yellow = 16

c.lime = 32

c.pink = 64

c.gray = 128

c.lightGray = 256

c.cyan = 512

c.purple = 1024

c.blue = 2048

c.brown = 4096

c.green = 8192

c.red = 16384

c.black = 32768

 

input = redstone.getBundledInput("back")

for cname,cnum in pairs© do

    if colors.test(input, cnum) then

        print( cname .. " is On!")

    else

        print( cname .. " is Off")

    end

end

I've posted it here: http://pastebin.com/1vWDfBqR. You can use the ingame pastebin command to download it to your computercraft computer: pastebin get 1vWDfBqR colortest

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...