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

[lua][question]

Started by jordan30001, 15 April 2012 - 07:59 AM
jordan30001 #1
Posted 15 April 2012 - 09:59 AM
HI I'm having trouble with the following code http://pastebin.com/qHixyL8t .
What I'm trying to do is send a rednet message from another computer for example it could be any of these combinations seperated by comas

rednet.send(id, "right,back,left|red power color code") *color codes ranging from 1 trough 15 (white to red)

the first data sent before the "|" is to tell the computer which side to send the data after the "|".

once it has figured out which side it needs to send the signal it inputs the color code into the next free available space in the array.

it then loops trough and adds all the array up and outputs a bundled output signal now this works great…if you send it in order 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 fine great work, but if you send for instance this 4,7,11,15,1 then all will show up except one and the same with this sequence of numbers 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1 everything except the 1 will turn on.

would be great if someone could fix this and make it so that it will work no matter which combinations of colors are sent
Cloudy #2
Posted 15 April 2012 - 04:52 PM
It might be easier if you use colors.combine on all the colours at the sending side - and send that number. That way the computer on the other end can just do rs.setBundledOutput("side", number). Saves messing around with arrays.
jordan30001 #3
Posted 16 April 2012 - 03:37 PM
the sending side is a server and it doesn't store any information it just forwards it to the right slave depending on the information it receives and I would sill have to do it the same way as i have done it currently jut on the server