Mod Release: OpenPeripheral

  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Poppycocks

New Member
Jul 29, 2019
1,914
0
0
I've just tested..

It all works correctly. slot 0 - 8 are the grid of slots in the top left. Slots 9 - 17 are the remaining slots listed along the bottom.

Code:
p = peripheral.wrap("right")
for i=0, p.getSizeInventory()-1 do
  stack = p.getStackInSlot(i)
  if stack ~= nil then
    print("Stack ".. i .." id: ".. stack.id)
  else
  print("Nothing in slot ".. i)
  end
end

Well, looks like I made a complete ass of myself xD.

Thanks and sorry Mike.
 

chronos_qc

New Member
Jul 29, 2019
16
0
0
Whoa, that robot looks awesome! I can already see my entire base protected by these giant robots.

What would be cool btw is a function where you can determine the position of the player. That way the robot could follow you everywhere and protect you from those sneaky creepers.
 

natnif36

New Member
Jul 29, 2019
623
0
0
You mean kinda like a robit from Mekanism?
But with combat capabilities?

Or perhaps less than somehow determining "the player" it's going by Terminal Glasses?
That may be easier/better/less buggy than "a player".

Perhaps even add some way for it itself to get a general feel of its surroundings - so someone with the Glasses could be "seeing" through the robots eyes, and then controlling it via terminal glasses commands for afar?
How amazing would that be?
 

chronos_qc

New Member
Jul 29, 2019
16
0
0
You mean kinda like a robit from Mekanism?
But with combat capabilities?

Or perhaps less than somehow determining "the player" it's going by Terminal Glasses?
That may be easier/better/less buggy than "a player".

Perhaps even add some way for it itself to get a general feel of its surroundings - so someone with the Glasses could be "seeing" through the robots eyes, and then controlling it via terminal glasses commands for afar?
How amazing would that be?


That would be very cool.

But yea, I thought of something more simple. For example you call the function getPosPlayer() that returns a table of the x, y and z coordonnates of the player wearing the glasses and then you send the robot to those coordonnates. It could be useful for computerCraft in general and not only for OpenPeripheral. Like you walk close to a door and it opens instantly, or maybe you could make a program to have your own pet turtle that follows you.
 

natnif36

New Member
Jul 29, 2019
623
0
0
I think between Immibis Periferals, OpenCcSensors, Misc Periferals and this there IS various player detectors, I think an addition like that would be more suited to the Terminal Glasses than a giant robot.
 

mikeemoo

New Member
Jul 29, 2019
117
0
0
Pet turtles that follow you and player sensors is all covered by OpenCCSensors.

OpenCCSensors is probably going to be merged into OpenPeripheral in the very near future, because right now there's a lot of functionality overlap between the two mods and I want to streamline the process a bit so I have more time to put out releases and improve features.

Of course, some people don't want all the functionality that OpenPeripheral will be offering, so you'll be able to configure exactly whats enabled and disabled in the config.

On a side note, lots of work happening on robots at the moment. I've been putting a lot of videos out there that make robots seem quite overpowered, but fear not - they wont be. They'll have awesome abilities (hopefully!), but it'll all come at a pretty big cost.
It'll be a modular upgrade system so you can configure exactly what abilities you want your robots to have.
Nothing will come free! and to be honest I'll probably likely to make them a bit 'too' expensive to because I really want robots to be used for fun and experience, not for doing things more efficiently.

Here's a new video:

Explosive lazers! :)
 

Brian Lenz

New Member
Jul 29, 2019
1
0
0
Hey, not sure if you still monitor this thread, but we seem to be having some issues with OpenPeripherals. At least that's what it seems to be.

We are trying the simplest commands for vanilla items, yet they always return nil. The only issue that we can really diagnose is that it's on a server, as when we use identical code and item setup (Computer next to vanilla chest) on a single player world, it works without flaw.

We are using the Unleashed pack version 1.1.4. Any help would be wonderful.
 

apparatusdeus

New Member
Jul 29, 2019
4
0
0
@mikeemoo, Is it possible to render different displays for different players connected to the same glasses bridge?

Does anyone have an example of the parameters the chat_command event returns? Does it include the name of the player that entered the command?
 

LaughingLeader

New Member
Jul 29, 2019
1
0
0
Hey, not sure if you still monitor this thread, but we seem to be having some issues with OpenPeripherals. At least that's what it seems to be.

We are trying the simplest commands for vanilla items, yet they always return nil. The only issue that we can really diagnose is that it's on a server, as when we use identical code and item setup (Computer next to vanilla chest) on a single player world, it works without flaw.

We are using the Unleashed pack version 1.1.4. Any help would be wonderful.


Are you going by the method names displayed on OpenPeripheral's documentation site? If you're using a more current version of OpenPeripheral on the server, those method names are currently incorrect, and will return nil if you try and use them.

Inventories (chests, etc) use these methods:
getInventoryName
getInventorySize
getStackInSlot
swapStacks
condenseItems
pushItem
pushItemIntoSlot
pullItem
pullItemIntoSlot
You'll notice in the OpenPeripheral documentation that these names are slightly different, like how what should be "pushItem()" is labelled as "push()", "getInventoryName()" is labelled as "getInvName()", and so on. Since you can't really go by the documentation till it's updated, I recommend making a test computer and doing something like this to check the method names of peripherals:

Code:
local side = "top";
local methods = peripheral.getMethods(side);
print("Methods:")
for i=1, #methods do
print(i.." = "..methods[i]);
end

Hope that helps.
 

apparatusdeus

New Member
Jul 29, 2019
4
0
0
So I've been playing around with the terminal glasses bridge (and computer craft in general) and so far I think its awesome.

I've been working on some scripts to provide useful information via the glasses and I've found a few things that I'm not entirely sure about. Could people please have a look at my script here: https://gist.github.com/apparatusdeus/bbb8d53940b55965a540 and let me know what they think?
At the minute all it does is process events and renders the time out to the user. I'm also adding a command to render unprocessed events so I can see what's getting triggered and the arguments that get passed. (It will help with expanding the script)

My main question at the minute is what happens if a script is half way through running and a peripheral such as the terminal glasses bridge is removed? I know that an event will be triggered but what happens to the handle that I have got from calling peripheral.wrap(side) will it still function? as I would like to store the terminal handles rather than looping over all attached devices looking for bridges each loop.

Also the only way I have found to render different displays per player is to have 1 bridge per player. Is this their another way to do this or am I missing something?
 

budge

New Member
Jul 29, 2019
273
0
0
Are you going by the method names displayed on OpenPeripheral's documentation site? If you're using a more current version of OpenPeripheral on the server, those method names are currently incorrect, and will return nil if you try and use them.

Inventories (chests, etc) use these methods:

You'll notice in the OpenPeripheral documentation that these names are slightly different, like how what should be "pushItem()" is labelled as "push()", "getInventoryName()" is labelled as "getInvName()", and so on. Since you can't really go by the documentation till it's updated, I recommend making a test computer and doing something like this to check the method names of peripherals:

Code:
local side = "top";
local methods = peripheral.getMethods(side);
print("Methods:")
for i=1, #methods do
print(i.." = "..methods[i]);
end

Hope that helps.
I'm having trouble using push/pull and their slot variants. Since the documentation seems to be wrong, I'm not even sure if the arguments are correct. I'm trying to use a turtle to pull from a chest to the left of it and put it in a chest to the right of it. Here's the code I'm using.
Code:
local leftchest = peripheral.wrap("left")
local rightchest = peripheral.wrap("right")
local size = leftchest.getInventorySize()

for i = 1,size do
  local info = leftchest.pushItem("right",i,64)
  print(i..": "..info)
end
I've tried variants of pullItem, the IntoSlot versions with a 1 after the 64, I've tried left and right both...Nothing ever gets moved. Anyone have ideas?

Edit: The documentation says directions are "east, west, up, down," etc., but the code fails with anything but left/right/top/bottom/etc.
 
Last edited: