Jump to content




[mc 1.6.x] Openperipheral


1184 replies to this topic

#801 MazeusXenon

  • Members
  • 12 posts

Posted 29 October 2013 - 02:27 PM

 theoriginalbit, on 28 October 2013 - 11:17 PM, said:

*sigh* update to the latest OpenPeripheral instead of v0.2.0-Beta and confirm the problem still exists there. If you can confirm that it still exists and/or you do not wish to update, please provide screenshots of the problem as well as any appropriate code, and anything else you think could help us replicate the problem to investigate it further.

Okay, I wrong on the version I was running. I am running the latest (0.2.1) but it is still happening. My code is very simple as I am just trying to learn it and can't get out usable details. getTankInfo insists it needs a parameter and only seems to work if I put the name of the tank (I get it from right-clicking the connection to it).

The code:
net = peripheral.wrap("openblocks_tank_5")
results = net.getTankInfo("openblocks_tank_5")
print(results)

This prints to the screen:
table: a50ecb1

If I am using the code wrong please let me know. I get a "attempt to index ? (a nul value)" or "attempt to call nil" on line 2.

#802 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 29 October 2013 - 04:37 PM

Firstly, it provides a table of details so you need to iterate the table for more information.
Secondly you're meant to supply a side. You can use "top", "bottom", "north", "south", "east", "west" or "unknown". Unknown will just use whatever default side the mod hosting the tank thinks is best. Some mods wont accept unknown as they are sided. For example the portable tank from TE only works on the bottom and top so providing unknown would not work.

As for iterating the table. Try the following.
for k,v in pairs(results) do
  print(tostring(k), ':', tostring(v))
end
This will go through the table getting all the names and values out.
You can then use results.name to get any of those values. The names are on the left hand side of the output.

#803 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 October 2013 - 07:36 PM

 NeverCast, on 29 October 2013 - 04:37 PM, said:

Firstly, it provides a table of details so you need to iterate the table for more information.
GAH! I told you they'd just be trying to print a table.... why does no one read documentation?!

 NeverCast, on 29 October 2013 - 04:37 PM, said:

Secondly you're meant to supply a side. You can use "top", "bottom", "north", "south", "east", "west" or "unknown".
Someone designed the code wrong, any unknown argument will return ForgeDirection.UNKNOWN so you could do getTankInfo("I don't read documentation") and it'd still work.

#804 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 29 October 2013 - 07:53 PM

 theoriginalbit, on 29 October 2013 - 07:36 PM, said:

Someone designed the code wrong, any unknown argument will return ForgeDirection.UNKNOWN so you could do getTankInfo("I don't read documentation") and it'd still work.

Which I guess would be a good default, because someone that doesn't read code probably just wants any odd tank.

Should we throw an error instead? Since no argument is not an option.

#805 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 October 2013 - 07:54 PM

 NeverCast, on 29 October 2013 - 07:53 PM, said:

Should we throw an error instead? Since no argument is not an option.
I think we should.

#806 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 29 October 2013 - 07:59 PM

 theoriginalbit, on 29 October 2013 - 07:54 PM, said:

I think we should.

Done, and you're assigned.
https://github.com/O...heral/issues/76

#807 MazeusXenon

  • Members
  • 12 posts

Posted 29 October 2013 - 09:10 PM

 theoriginalbit, on 29 October 2013 - 07:36 PM, said:

GAH! I told you they'd just be trying to print a table.... why does no one read documentation?!

Okay, so I missed it. Where is this documentation?


 NeverCast, on 29 October 2013 - 04:37 PM, said:

Firstly, it provides a table of details so you need to iterate the table for more information.
Secondly you're meant to supply a side. You can use "top", "bottom", "north", "south", "east", "west" or "unknown". Unknown will just use whatever default side the mod hosting the tank thinks is best. Some mods wont accept unknown as they are sided. For example the portable tank from TE only works on the bottom and top so providing unknown would not work.

As for iterating the table. Try the following.
for k,v in pairs(results) do
  print(tostring(k), ':', tostring(v))
end
This will go through the table getting all the names and values out.
You can then use results.name to get any of those values. The names are on the left hand side of the output.

When I add your code I get:
1: net.mineforge.fluids.FluidTankInfo@37e57f60
What is this telling me?

And no, don't know Lua very well (obviously) so no need to be rude. Point me to the documentation that covers all this and I will learn from it. If I knew there was documentation I could access, I would have looked at that first. I ask because I know there are people out there who do know the answer and are willing to help other people. I really like this combination of mods - and I have a number turtle programs I save in pastebin and reuse a lot. I would like to be able to use this to setup something so I can see just how much I have stored so any documentation or other assistance would be appreciated.

#808 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 October 2013 - 09:12 PM

 MazeusXenon, on 29 October 2013 - 09:10 PM, said:

-snip-
It is literally the first thing in the original post

Quote

Documentation and downloads have been moved


#809 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 29 October 2013 - 09:30 PM

 MazeusXenon, on 29 October 2013 - 09:10 PM, said:

When I add your code I get:
1: net.mineforge.fluids.FluidTankInfo@37e57f60
What is this telling me?

That is telling you that there is ONE tank available.
results = results[1]

Put that before the for loop.

#810 MazeusXenon

  • Members
  • 12 posts

Posted 30 October 2013 - 12:46 PM

 theoriginalbit, on 29 October 2013 - 09:12 PM, said:

It is literally the first thing in the original post


And yes, that is where I went but the OpenBlocks section has nothing (http://www.openperip...tion/openblocks). There are lot for a number of other mods (which is very nice) but nothing there. Is there a wiki other than the ComputerCraft wiki you would recommend?

 NeverCast, on 29 October 2013 - 09:30 PM, said:


That is telling you that there is ONE tank available.
results = results[1]

Put that before the for loop.

Great, thanks. I will try that. This will then tell me how much is stored? Or will I get more detail I will need to figure out?

#811 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 30 October 2013 - 09:35 PM

I believe the information about tanks might be contained under Vanilla or Minecraft Forge on the documentation as it's not mod specific but Forge specific.

As for the results, it'll give you more information that you should be able to figure out.

#812 karelmikie3

  • Members
  • 112 posts

Posted 01 November 2013 - 02:29 PM

 theoriginalbit, on 06 October 2013 - 05:30 AM, said:

 karelmikie3, on 06 October 2013 - 05:22 AM, said:

openperipheral version: 0.2.1
mc version: 1.6.4
addetional info: the special sgcraft don't seem to exist but the inventory methods do
Ok I would assume that this is because when OpenPeripheral was first ported to 1.6.x there was no SGCraft for 1.6.x, meaning that support for it would have been removed until a build was released. The reason that the inventory interaction works is because anything with an inventory will be detected by OpenPeripheral and allow interaction. I just added an issue for it to remind anyone to add SGCraft support back.

sgcraft has been updated to 1.6.4

#813 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 November 2013 - 02:55 AM

 karelmikie3, on 01 November 2013 - 02:29 PM, said:

sgcraft has been updated to 1.6.4
indeed.

#814 karelmikie3

  • Members
  • 112 posts

Posted 02 November 2013 - 07:39 AM

 theoriginalbit, on 02 November 2013 - 02:55 AM, said:

 karelmikie3, on 01 November 2013 - 02:29 PM, said:

sgcraft has been updated to 1.6.4
indeed.

in what version of open peripheral it's gonna be in because i just downloaded the latest version and it doesn't work

#815 Aixler

  • Members
  • 4 posts

Posted 02 November 2013 - 09:21 AM

 NeverCast, on 30 October 2013 - 09:35 PM, said:

I believe the information about tanks might be contained under Vanilla or Minecraft Forge on the documentation as it's not mod specific but Forge specific.

As for the results, it'll give you more information that you should be able to figure out.

Using openperipherals build #73 from nov1 with minecraft 1.6.4 and computercraft 1.5.7.

With this code, i got this result:
Posted Image

It certainly is a good step in the right direction!

How do i get all information available, rather than just capacity?

#816 thislooksfun

  • Members
  • 25 posts
  • LocationBehind you

Posted 02 November 2013 - 01:10 PM

Just so I know, when will the ticket machine work again? I really want to make an automated ticket system, but I can't find a way to do that right now. :/

#817 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 02 November 2013 - 02:32 PM

 Aixler, on 02 November 2013 - 09:21 AM, said:

It certainly is a good step in the right direction!

How do i get all information available, rather than just capacity?

Do tank.listMethods() for me, what does it print out?
Also try using "unknown" as the side.

 thislooksfun, on 02 November 2013 - 01:10 PM, said:

Just so I know, when will the ticket machine work again? I really want to make an automated ticket system, but I can't find a way to do that right now. :/

I wasn't aware this was not working in Open1.6, the Ticket Machine is RailCraft, TheOriginalBIT is good with his RC compat' so he might be able to add it if it's gone.

 karelmikie3, on 02 November 2013 - 07:39 AM, said:

in what version of open peripheral it's gonna be in because i just downloaded the latest version and it doesn't work

Did you download it from here? http://openmods.info...OpenPeripheral/
These are the latest cutting edge untested builds of OpenPeripheral. If you want new features, that is where to get them.

#818 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 02 November 2013 - 02:34 PM

- Moderator delete this please -

#819 Aixler

  • Members
  • 4 posts

Posted 02 November 2013 - 05:40 PM

 NeverCast, on 02 November 2013 - 02:34 PM, said:

- Moderator delete this please -

Changed/Added your code
Posted Image

Gave this:
Posted Image

#820 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 November 2013 - 10:20 PM

 NeverCast, on 02 November 2013 - 02:32 PM, said:

 thislooksfun, on 02 November 2013 - 01:10 PM, said:

Just so I know, when will the ticket machine work again? I really want to make an automated ticket system, but I can't find a way to do that right now. :/
I wasn't aware this was not working in Open1.6, the Ticket Machine is RailCraft, TheOriginalBIT is good with his RC compat' so he might be able to add it if it's gone.
As far as I was concerned it wasn't broken... I guess I'll have to take a look into it...

 NeverCast, on 02 November 2013 - 02:32 PM, said:

 karelmikie3, on 02 November 2013 - 07:39 AM, said:

in what version of open peripheral it's gonna be in because i just downloaded the latest version and it doesn't work
Did you download it from here? http://openmods.info...OpenPeripheral/
These are the latest cutting edge untested builds of OpenPeripheral. If you want new features, that is where to get them.
Jenkins didn't initially detect those when I committed the changes, seems it still hasn't.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users