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

More than 6 in/out using Rednet passing a variable?

Started by Ashton, 01 May 2013 - 09:10 PM
Ashton #1
Posted 01 May 2013 - 11:10 PM
TOPIC: More than 6 in/out using Rednet passing a variable?

I'm working on a path-traking program, there are 4 "paths" (N, S, E, W, as per my variables) and when the player gets to the end of the path, he is teleported back and the path is logged using a pressure-plate feeding into a PC. The idea is based on which paths he chooses, he can end up at different locations, (i.e. N,N,N,W TPs him to Loc1, while W,E,S,W TPs him to Loc2 —- it's the same idea as Zelda OOT's lost woods puzzle, out of a string of 4^4 possible combinations of exits, only 3 or so work)

But, I keep stumbling on needing 5 inputs for the system (start, N, S, E, W) and then wanting a minimum of 3 outputs (Loc1, Loc2, Loc3 - command blocks) but there are only 6 sides, so I came up with the logical idea of using the 6th side of that terminal that logs the players path for a rednet modem, and then using rednet to send a variable/command to a second PC, thus giving me a total of 10 possible input/outputs… however this is where I break down, I'm not sure how to code a method of sending anything to a second terminal (rednet has never worked properly for me…) I dont care if I have to read only a single number as a variable (i.e. "if recive = 1 / rs.setOutput("back:, true) / elseif recieve = 2 / rs.setOutput("left",true)" etc) or if I actively pass the command itself along "rs.setOutput("back",true) — though I'd need to pass 3 commands to activate the redstone, sleep, then deactivate it…

Any suggestions on how to integrate these?
Lyqyd #2
Posted 02 May 2013 - 12:51 PM
Why not just tell the other computer the destination as a name or something and have it set all of the redstone outputs accordingly? Also, if you happen to be playing on a mod pack that includes RedPower, look into the bundled cables. Computers can interact with them directly.
LBPHacker #3
Posted 02 May 2013 - 12:59 PM
What version of CC are you using? There's a slight chance that you can just wrap the command block as a peripheral.
Lyqyd #4
Posted 02 May 2013 - 02:03 PM
That option does require editing a config file, FYI.
Ashton #5
Posted 02 May 2013 - 03:52 PM
Why not just tell the other computer the destination as a name or something and have it set all of the redstone outputs accordingly? Also, if you happen to be playing on a mod pack that includes RedPower, look into the bundled cables. Computers can interact with them directly.

That's still what I'm trying to do, I'm not sure how to write a program to record and compare the inputs, send a message to the second PC and have it activate the corresponding command block. I've got the "track player's movements" program figured out (just debugging it) but I've had zero luck getting the "send data between PCs" part to work… (I spent hours one day using *just* the rednet/modem on two PCs trying to send a message from one to the other and never could get it to work…)

I'm on 1.5.1, No RedPower update yet… I've been looking to see if there's a way to get bundled cables without the RP update to 1.5.1 but so far no luck…

What version of CC are you using? There's a slight chance that you can just wrap the command block as a peripheral.

I'm on 1.52, if I can interact with command-blocks directly (i.e. "if X=loc1, then output.commandblock("/tp @p 1, 2, 3")) that would make it MUCH easier. I'm actually playing with the AdventureMap peripheral (immumbris's peripherals, I think) but I cant figure out how to determine who the player is in order to execute teleport commands, and using OpenCCSensors (if I can get it to work) requires another side that I dont have…)

That option does require editing a config file, FYI.

No Problem, I have FTP/console server access (server owner) the only thing I cant really do at this point is add mods because it'll anger the players having to install a new mod (after installing around 30 others)
LBPHacker #6
Posted 02 May 2013 - 03:59 PM
Oh okay then, 1.52 works with command blocks, but as Lqyqd's mentioned before, you have to enable that in the config.
A command block peripheral has 3 methods (or functions or whatever):
  • .setCommand: sets the command (what a surprise) - doesn't execute it though
  • .runCommand: runs the set command
  • .getCommand: self-explaining
In early-1.5, command blocks iterated the operation list backwards (so you had to run the command before you set it), but I think that's been fixed in 1.51. If it doesn't work as it should though, try it backwards!…
Ashton #7
Posted 02 May 2013 - 05:18 PM
Oh okay then, 1.52 works with command blocks, but as Lqyqd's mentioned before, you have to enable that in the config.
A command block peripheral has 3 methods (or functions or whatever):
  • .setCommand: sets the command (what a surprise) - doesn't execute it though
  • .runCommand: runs the set command
  • .getCommand: self-explaining
In early-1.5, command blocks iterated the operation list backwards (so you had to run the command before you set it), but I think that's been fixed in 1.51. If it doesn't work as it should though, try it backwards!…


It… WORKS! O_O

THANK YOU! :D/> :D/> :D/>

You all have no idea how awesome this is for me, building self-reseting dungeons on a server… this is a godsend! THANK YOU!!! :D/> :D/> :D/>