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

[Cc 1.53][Mc 1.5.2][1.0.2] Wireless Peripheral - Use Peripherals Remotely!

Started by gamax92, 07 February 2013 - 05:40 PM
gamax92 #1
Posted 07 February 2013 - 06:40 PM
(Insert clever post hook here)

This peripheral is currently a work in progress. It works, but could use improvement.
Basically, with this peripheral you can input the coords of another block, and use it as if it was directly next to the computer.
1.0.0 and 1.0.1 work with Xfel's ccCables mod as well.

Recipe:


Functions
getType() - Returns the type of the mounted block.
getMethods() - Returns the methods that the mounted block has.
call(NUL, methodName, param1, param2, ... ) - Calls a method inside the mounted block.
All three functions above will throw an exception if a block is not mounted.

mountBlock(x,y,z) - This function mounts a peripheral.
unmountBlock() - This function will unmount the mounted block.
isMounted() - This function returns true or false depending if a block is currently mounted.

API
The api is not needed, but makes things a little easier.
It makes the peripheral api automatically use the mounted block instead of the native functions.
peripheral.wrapOld()
- This function works just like the original .wrap()
Its required because when you mount a block, the original wrapping used to mount the block will become invalid.

> You must rewrap the peripheral after mounting it. <

Download Mod - MC1.5.2
Download Mod - MC1.4.7
Download API
Source Code of v1.0.2

Old versions
Version 1.0.0 - MC1.4.7
Version 1.0.1 - MC1.4.7

Changelog
v1.0.2b:
More block updates, if they are unneccessary please tell me.
Same download link, 1.0.2

v1.0.2:
Ported code to MC1.5.2

v1.0.1:
Fixed a bug with not activating the tile entity correctly.
Switched block updates from this peripheral to the mounted block.
Edited on 19 December 2013 - 06:42 PM
tesla1889 #2
Posted 07 February 2013 - 06:52 PM
very clever :)/> can one wireless peripheral block interact with another?
PixelToast #3
Posted 08 February 2013 - 03:02 AM
i can emagine hacking someones immibis LAN network with this
tesla1889 #4
Posted 08 February 2013 - 03:36 AM
i can emagine hacking someones immibis LAN network with this
perfectly legitimate use of ComputerCraft
gamax92 #5
Posted 08 February 2013 - 04:07 AM
Sorry, the Wireless peripheral blocks are NOT recursive. By design the API hooks into the native peripheral functions and not into itself. Because thats an infinite loop …
tesla1889 #6
Posted 08 February 2013 - 12:46 PM
Sorry, the Wireless peripheral blocks are NOT recursive. By design the API hooks into the native peripheral functions and not into itself. Because thats an infinite loop …
gasp. wait. what happens if you set the blocks to each other? game crashing?
gamax92 #7
Posted 08 February 2013 - 02:29 PM
Nothing happens, as like i said it does not loop recursively.
tesla1889 #8
Posted 08 February 2013 - 03:02 PM
ah. disappointment.
sploders101 #9
Posted 10 February 2013 - 11:56 AM
Sorry I just checked the logs and it is an interference with mystcraft. I'll remove it and retry. I get "false" every time I try to mount a block.
I can't get it to work. I just drag it to the mods folder right? I am running mc 1.4.7 with cc 1.481. Thanks in advance.
P.S. This mod looks AWESOME!!!!!! Just what I need and I'd love to get it to work. AHHH!!! Too much editing!!! :D/> AWESOME mod!!!
TheGeek #10
Posted 12 February 2013 - 11:37 AM
I'm having troubles using the wireless peripheral block and the API. Could you write an example code that wraps a monitor?

Here's what I have I so far:

local wirelessside = "bottom:cyan" --side with wireless periph block
os.loadAPI("zzperipheral") --load the wireless periph API
wireless1 = peripheral.wrap(wirelessside) --get wireless signal block
wireless1.mountBlock(158,77,266)

wireless1.clear()
wireless1.setCursorPos(1,1)
wireless1.write("Testing! Testing on remote monitor!")

HEEEELP!
gamax92 #11
Posted 12 February 2013 - 05:17 PM
You didn't rewrap the peripheral after mounting it.
Also, you should use .wrapold if you want to wrap the wireless peripheral block itself and not the mounted block.



local wirelessside = "bottom:cyan" --side with wireless periph block
os.loadAPI("zzperipheral") --load the wireless periph API
wireless1 = peripheral.wrapOld(wirelessside) --get wireless signal block
wireless1.mountBlock(158,77,266)
wirelessmon = peripheral.wrap(wirelessside)
wirelessmon.clear()
wirelessmon.setCursorPos(1,1)
wirelessmon.write("Testing! Testing on remote monitor!")
TheGeek #12
Posted 13 February 2013 - 07:28 AM
Hmm, I'm not having much luck with the API. I can't seem to output to a monitor no matter what I try. I want to make sure it works at all. How would I do it with a "call" function?

wireless1 = peripheral.wrap(&amp;quot;top&amp;quot;) --get wireless signal block
print(wireless1.isMounted()) --this works, gives false
wireless1.mountBlock(145,76,287)
print(wireless1.isMounted()) --this works, gives true
print(wireless1.getType()) --this works, gives "monitor"
print(textutils.serialize(wireless1.getMethods())) --this works, gives list of methods
wireless1.call("monitor",write,"testing") --this does not work, although does not give error

Thanks for the help so far.
Kye_Duo #13
Posted 18 February 2013 - 04:04 AM
I too am having a hard time getting this to work with monitors.
I can get it to work just fine with other periphs, but monitors don't even send back an error if you don't use call() correctly
gamax92 #14
Posted 18 February 2013 - 03:00 PM
I'll just repeat what I, and specifically highlight important points of code.

You didn't rewrap the peripheral after mounting it.
Also, you should use .wrapold if you want to wrap the wireless peripheral block itself and not the mounted block.


wireless1 = peripheral.wrapOld(wirelessside) --get wireless signal block
wireless1.mountBlock(158,77,266)
wirelessmon = peripheral.wrap(wirelessside)


I've also edited the first post, please check there for changes.
Kye_Duo #15
Posted 18 February 2013 - 03:40 PM
i do a fireworks launcher this way and it works

 wireless = "top:black"
wireless1 = peripheral.wrap(wireless)
wireless1.unmountBlock()
print(wireless1.isMounted())
wireless1.mountBlock(151,85,289)
print(wireless1.isMounted())
print(wireless1.getType())
print(textutils.serialize(wireless1.getMethods()))
for i = 18,28 do
wireless1.call(nil, "launch", 7, i, 8,9)
sleep(0.01)
end

I try the call function with a monitor and nothing happens…not even an error code. I can use getMethods() and it returns the methods, but I can't use them in the call function


wireless = ("top:black")
wireless1 = peripheral.wrap(wireless)
wireless1.unmountBlock()
print(wireless1.isMounted())
wireless1.mountBlock(156,63,322)
print(wireless1.isMounted())
print(wireless1.getType())
print(textutils.serialize(wireless1.getMethods()))
wireless1.call(nil, "setBackgroundColor", "colors.blue")
wireless1.call(nil, "clear", true)
wireless1.call(nil, "setCursorPos", 1,1)
wireless1.call(nil, "write", "TESTING!")

that does nothing nor errors out with the call functions…everything else works.
gamax92 #16
Posted 19 February 2013 - 11:18 AM
BUGFIX!

Tileentity was not attached and detached properly.
Block update was switched from my peripheral to the mounted block.

Also monitors now work properly, before only a couple functions worked.
Rednet modems are also working now, before they never lit up.
Kye_Duo #17
Posted 19 February 2013 - 03:34 PM
woot! that fixed it…though…i'm not sure on the color range…its a number…but how high does it go? i used 10000 and didn't get an out of bounds error….i may just use your API for that periph…
gknova61 #18
Posted 19 February 2013 - 06:50 PM
Can't you just hack into anyone's crap on a Multiplayer server? :P/>
gamax92 #19
Posted 20 February 2013 - 01:59 PM
Implying the server owner is smart enough to restrict the block to a certain permission level.
Its not meant to be an OP only thing because frankly i get sooooooo much trouble with things like that and permission based systems.
gamax92 #20
Posted 17 August 2013 - 02:05 PM
Once upon a time, someone got bored. Then they thought, "Maybe I should go update that really old peripheral I made."

And then they did so.
gicon #21
Posted 23 October 2013 - 10:09 PM
how does one go about installing this?
PixelToast #22
Posted 24 October 2013 - 01:20 AM
how does one go about installing this?
putting it in the mods folder, like anything else c_c
gamax92 #23
Posted 19 December 2013 - 07:45 PM
So, I noticed that events wern't being sent properly. Not sure why that was but something in one of the changes I did to the code seems to have fixed this.
No massive changes occured, so the download is still the same, 1.0.2 version.
Regrab the link.