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

disk reading help

Started by LDDestroier, 10 October 2014 - 08:35 PM
LDDestroier #1
Posted 10 October 2014 - 10:35 PM
Hey, I need help dearly with this program. It uses two identical disks to communicate.
How it is SUPPOSED to work is that it gets a rednet message, then puts it onto the disk. Then, at the same time, detects changes on the disk, broadcasts it on rednet, and deletes the data to save disk space and prevent feedback loops.
This is what I got. It can read rednet okay, and it can put data on the disk okay, but I don't know how to get it to read the disk data properly. That's what I need help with.

Test it with 4 computers in this order:

[computer]-wired-[pc with program][disk drive] [computer]-wired-[pc with program][disk drive]

The computer has a rednet chat program, the 'pc with program' has the program loaded on it, 'wired' means connected with WIRED NETWORKING CABLES, and both of the disk drives have the same floppy that had been duplicated in creative mode

Please get this working! The first computer, with that setup, should be able to chat with the other computer!
Cranium #2
Posted 11 October 2014 - 02:23 AM
Hey, I need help dearly with this program. It uses two identical disks to communicate.
How it is SUPPOSED to work is that it gets a rednet message, then puts it onto the disk. Then, at the same time, detects changes on the disk, broadcasts it on rednet, and deletes the data to save disk space and prevent feedback loops.
This is what I got. It can read rednet okay, and it can put data on the disk okay, but I don't know how to get it to read the disk data properly. That's what I need help with.

Test it with 4 computers in this order:

[computer]-wired-[pc with program][disk drive] [computer]-wired-[pc with program][disk drive]

The computer has a rednet chat program, the 'pc with program' has the program loaded on it, 'wired' means connected with WIRED NETWORKING CABLES, and both of the disk drives have the same floppy that had been duplicated in creative mode

Please get this working! The first computer, with that setup, should be able to chat with the other computer!
I've moved your request to Ask A Pro, because it sounds like you already have code. Please post your code, and we can have someone help you!
Bomb Bloke #3
Posted 11 October 2014 - 03:32 AM
How it is SUPPOSED to work is that it gets a rednet message, then puts it onto the disk. Then, at the same time, detects changes on the disk, broadcasts it on rednet, and deletes the data to save disk space and prevent feedback loops.

I'm not sure how that will prevent a loop. Say computer 1 receives a message, writes it to disk, resends then deletes it. Computer 2 will get the message, do the same, computer 1 gets the message and… does it all again?

It's worth noting that you can't readily detect when data in a file changes, short of reading the whole thing into RAM over and over.
Dragon53535 #4
Posted 11 October 2014 - 04:10 AM
He's using KingofGamesYami's disknet api, and how's he's got it is a computer connected to the server computer through rednet, server computer connected to a different one over disknet, that being the disk data sending, and that computer connected over rednet to another.