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

premote(Or P-Remote) a simple utility to use peripherals connected to wired modems

Started by GiantNuker, 03 April 2016 - 09:58 PM
GiantNuker #1
Posted 03 April 2016 - 11:58 PM
P-Remote is a utility to access remote peripherals connected with a wired modem.
It gives the following functions:
  1. getModemSide() - Gets the modem's side by using a bunch of ifs
  2. getModem() - Gets the modem based on 1 & 2
  3. getRemotePeripherals() - uses the peripherals api function getNamesRemote()
  4. getPeripheralMethods(peripheral) - uses the peripherals api function getMethodsRemote(peripheral)
  5. hasRemotePeripheral(peripheral) - Check if a peripheral is present
  6. callRemoteMethod(peripheral, method) - calls th peripheral's function
Note: All of the above start with "premote.", so "getModem()" would be "premote.getModem()"

DOWNLOAD
pastebin get RWYDLAD3 or http://pastebin.com/RWYDLAD3
Note 2: I Havn't tested it quite yet, I'll update this when I have(very soon)

Note 3: You may want to put this in the default apis folder.

Note 4: I'm suprised it dosent already have this functionality XD

btw this is my first WORKING program/api/util
KingofGamesYami #2
Posted 04 April 2016 - 04:04 PM
peripheral.getNames might make your life easier.