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

peripheral.call() confusion.

Started by Wojbie, 06 June 2014 - 08:18 PM
Wojbie #1
Posted 06 June 2014 - 10:18 PM
I had small conversation with Cranium today about peripheral.call() at this topic:
Starting here - to here

I'd recommend some punctuation on that post ASAP. Makes my brain hurt to read.
I don't really agree with this idea, it just seems like there's no real reason to make turtles wired. If you want a turtle to connect to a wired network, you can use a properly coded regular computer as a proxy. Remember, you can greate your own peripheral calls.

What did you exactly meant by making your own peripheral calls?

Using peripheral.call(), you can pass a custom peripheral call to any peripheral attached. It depends on if you're listening to the right calls though. I think there was an OS that did this a while back…

Wait… you could use peripherall.call() to call a custom call? How does that even work? Doesn't it just do nothing if peripheral don't have that method? Or are we talking about custom peripheral mod here? Sorry for offtopic but i am confused a lot.

I've never personally used it, but I was under the impression that almost anything can go into the parentheses, and as long as the peripheral(in this case a computer) was watching for that event, you can handle it. Again, I've not tested this myself, but that's what I was told.


Could anyone confirm and give example of it working like that or deny its existence? I attempted to test it myself and it did not work as advertised. Thank you in advance.
Edited on 06 June 2014 - 08:22 PM
Cranium #2
Posted 06 June 2014 - 10:25 PM
If it doesn't work the way I said it did, I'd love to know as well. I was under the impression that peripheral.call() can pass custom events between computers.
Wojbie #3
Posted 07 June 2014 - 12:54 AM
After some more testing i have come to believe that it don't look possible :P/> O well that was nice dream while it lasted :)/>
theoriginalbit #4
Posted 07 June 2014 - 01:27 AM
Could anyone confirm and give example of it working like that or deny its existence? I attempted to test it myself and it did not work as advertised. Thank you in advance.
If it doesn't work the way I said it did, I'd love to know as well. I was under the impression that peripheral.call() can pass custom events between computers.
Definitely not. A peripheral will implement methods Java-side and these list of methods are the only methods that can be invoked on peripherals, invoking any other method would result in a 'method does not exist' error. Cranium, I'm not too sure where you've heard that you could put anything in the peripheral.call call.
Bomb Bloke #5
Posted 07 June 2014 - 01:28 AM
What you can do is create a table containing functions on one system, said functions rednet-send strings to another, which peripheral.call()s those strings to a peripheral, and rednet-sends the return values back for the original functions to return.

In this way, it's possible to treat eg a monitor attached to a different system as a directly wrapped peripheral, one you could even term.redirect() to.

Edit: This is the most recent attempt that I can recall.
Edited on 06 June 2014 - 11:36 PM
Wojbie #6
Posted 07 June 2014 - 01:41 AM
Definitely not. A peripheral will implement methods Java-side and these list of methods are the only methods that can be invoked on peripherals, invoking any other method would result in a 'method does not exist' error. Cranium, I'm not too sure where you've heard that you could put anything in the peripheral.call call.

Thank you for confirmation that this is wrong. This confirms my suspicion.

What you can do is create a table containing functions on one system, said functions rednet-send strings to another, which peripheral.call()s those strings to a peripheral, and rednet-sends the return values back for the original functions to return.

In this way, it's possible to treat eg a monitor attached to a different system as a directly wrapped peripheral, one you could even term.redirect() to.

Yes i realize this possibility. I keep promising myself that i will make something like that one day when i get free time but i never get to it. One day i guess.