line = "back"
ping = "front"
binary = ""
function wait()
while true do
timer = os.startTimer(1)
evt, timera = os.pullEvent("timer")
if timer==timera then
fr = "timer"
end
if timer==timera then break end
end
return
end
function redstone()
while true do
os.pullEvent("redstone")
if rs.getOutput(ping) then
if rs.getOutput(line) then
fr = "1"
else
fr = "0"
end
end
end
end
function send(filename)
file = fs.open(filename, "b")
while true do
a = file.read()
if not a then break end
binary = binary..a
end
for i = 1, #binary do
local c = binary:sub(i,i)
sleep(0)
if c=="1" then
rs.setOutput(line, true)
rs.setOutput(ping, true)
else
rs.setOutput(line, false)
rs.setOutput(ping, true)
end
end
end
function receive(filename)
while true do
parallel.waitForAny(wait, redstone)
if fr=="timer" then break end
binary = binary..fr
end
file = fs.open(filename, "wb")
file.write(binary)
file.close()
end
args = {...}
if args[1] == "-send" then
send(args[2])
else
receive(args[2])
end
it says test:27 unssoported mode
Program doesnt send anything
Started by FuuuAInfiniteLoop(F.A.I.L), Mar 31 2013 02:40 PM
9 replies to this topic
#1
Posted 31 March 2013 - 02:40 PM
#2
Posted 31 March 2013 - 02:44 PM
if can help, im using computercraft 1.52 in minecraft 1.5.1 with the last forge (7.7.1) and i have installed NEI, galacticraft and rei minimap on windows 8 x64
#3
Posted 31 March 2013 - 02:44 PM
file = fs.open(filename, "rb")
Have a read
EDIT: Whoops, wrong link.
#4
Posted 31 March 2013 - 02:49 PM
Now the code doesnt send anything, and the ping line is always turned on, even if the program is closed
#5
Posted 31 March 2013 - 03:07 PM
what exactly is this program meant to be doing?
#6
Posted 31 March 2013 - 05:54 PM
It would be easier to read this if you could space a little better, not trying to be rude, but it would help if you were to space this better, it would let us read your code better and help you faster.
#7
Posted 31 March 2013 - 10:37 PM
Has does sleep(0) allow redstone to do anything... I told you this in IRC. It has to be (I believe) at least 0.2 seconds.
#8
Posted 31 March 2013 - 10:39 PM
1lann, on 31 March 2013 - 10:37 PM, said:
Has does sleep(0) allow redstone to do anything... I told you this in IRC. It has to be (I believe) at least 0.2 seconds.
#9
Posted 31 March 2013 - 10:43 PM
theoriginalbit, on 31 March 2013 - 10:39 PM, said:
1lann, on 31 March 2013 - 10:37 PM, said:
Has does sleep(0) allow redstone to do anything... I told you this in IRC. It has to be (I believe) at least 0.2 seconds.
He's trying to send/receive a file through 2 redstone wires, through binary.
Also the reason why the ping line is always on is because you never then turn it off
#10
Posted 31 March 2013 - 10:49 PM
1lann, on 31 March 2013 - 10:43 PM, said:
He's trying to send/receive a file through 2 redstone wires, through binary.
well... you will encounter a problem when attempting to write the string out to the file when it is opened in binary mode. you will need to get 8 pulses (bits) and then encode them into a byte and write it to the file. also how does it know when the file is finished copying across? You need to setup some kind of bit count at the start of the stream, or you need to setup some kind of terminating byte that is sent across so it knows when it is the end...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











