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

trying to learn - Modems

Started by Dustmuz, 18 September 2014 - 01:32 PM
Dustmuz #1
Posted 18 September 2014 - 03:32 PM
hey again fellow Crafters :)/>

i have fiddled around with some of all the coding there is for a computer on its own and monitors.. and gotten the hang if it, to my standart :P/> hehe

now im trying to learn how to use modems..
but i cant find a tutorial (might just be me that havent searched proberly)
but ive gotten as far as opening the modem, and transmit a message from A to B..
the next thing im trying to do, is "look" inside a chest with the openperipheraladdon "peripheral proxy"

my setup is as follows..

computer in the middle, monitor on the right, WIRED modem on the left, with 2 cables, then another modem, the proxy with arrows "into" a vanilla chest.

i can get the .getInventorySize() to work, it comes up with 27 as it should.
what i wanted to try was to use the .getMethods() on the chest, but that just comes up with "test:16:attempt to call nil"

My code so far
Spoiler– wraps modem and monitor
local monitor = peripheral.wrap("right")
local modem = peripheral.wrap("left")

modem.open(1)
monitor.clear()
monitor.setCursorPos(1,1)

–prefix for the chest
local chest1 = peripheral.wrap('container_chest_1')


chest1s = chest1.getInventorySize()
monitor.write("size: "..chest1s)

ch1m = chest1.getMethods()
print(ch1m)


i have tried
.getMethods() / .getMethodsRemote()
.getMethods(chest1) / .getMethodsRemote(chest1)
.getMethods("chest1") / .getMethodsRemote("chest1")
.getMethods(container_chest_1) / .getMethodsRemote(container_chest_1)
.getMethods("container_chest_1") / .getMethodsRemote("container_chest_1")
.getMethods('container_chest_1') / .getMethodsRemote('container_chest_1')

all comes up with the same "error"

if someone have a tutorial for Modems, i would appriciate a link to it, as the wiki, just makes me more confused that good is :D/> hehe

Have a nice day, and be good :)/>
Lyqyd #2
Posted 18 September 2014 - 03:44 PM
It's actually peripheral.getMethods("container_chest_1"). The getMethods function is in the peripheral API itself, not on the peripherals. If you just want to see a quick listing for use as a fast reference, executing this line in the Lua prompt may be helpful:


textutils.tabulate(peripheral.getMethods("container_chest_1"))
Dustmuz #3
Posted 18 September 2014 - 03:51 PM
It's actually peripheral.getMethods("container_chest_1"). The getMethods function is in the peripheral API itself, not on the peripherals. If you just want to see a quick listing for use as a fast reference, executing this line in the Lua prompt may be helpful:


textutils.tabulate(peripheral.getMethods("container_chest_1"))

arhh.. that was quite helpfull..

Thanks a lot..

im trying to learn this Computercraft by "trial and error"
google is quite helpfull, but sometimes, it comes up short :D/> hehe
Dustmuz #4
Posted 18 September 2014 - 05:34 PM
in hopes of that somebody is still watching..

on to the next problem in this category..

ENERGY CELLS..

i've tried looking on the forums here, in the threads
link1
link2

and that i came up "empty" with..

my "problem" so far, is "power:9: expected string"

Spoilermon = peripheral.wrap("right")
modem = peripheral.wrap("left")

mon.setBackgroundColor(colors.blue)
mon.clear()
mon.setCursorPos(1,1)
modem.open(1)

cell = peripheral.call("cofh_thermalexpansion_energycell_228")

maxen = cell.getMaxEnergyStored()

mon.write("max energy: "..maxen)
Lyqyd #5
Posted 18 September 2014 - 05:36 PM
You've got peripheral.call where you probably meant peripheral.wrap.
Dustmuz #6
Posted 18 September 2014 - 05:40 PM
You've got peripheral.call where you probably meant peripheral.wrap.

yeps.. you were right.. again :D/>

you must be quite confident, since you always are right :P/> hehe

but thanks again..