Jump to content




[MC 1.7.10 | CC 1.65] OpenCCSensors

lua

  • You cannot reply to this topic
1334 replies to this topic

#541 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 23 January 2013 - 12:20 AM

SNJ, sorry I cant test it works right now! Hopefully it does, if not let me know.

This'll be fixed properly in the next release :)

#542 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 23 January 2013 - 12:50 AM

Actually, when I get details of this tank problem thats been reported, I'll do a mini revision release (0.1.2-r2) which'll include this fix, as well as support for railcraft iron tanks.

#543 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 23 January 2013 - 03:19 AM

Noticed a slight issue with tanks where the tank details are a bit too merged in to the additional data. For the next version I'll be splitting this out slightly, so it'll break any current programs (although it'll be VERY simple to fix)

Posted Image

will become this..

Posted Image

This'll be in the next release.


Edit: Actually, it'll be 1-indexed, not 0-indexed like in that picture.

#544 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 23 January 2013 - 08:39 AM



Sorry about the low quality!

Script is written for the next version (0.1.3), so I'll add the script as a download.

Hopefully Cruor or Lyqyd will come up with a nicer version of this script that'll be included as a default program in OCS :)

#545 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 23 January 2013 - 10:15 AM

View PostMikeemoo, on 23 January 2013 - 12:04 AM, said:

Hi SNJ,

That's a bit of an oversight on my part. I've tried to add nicer error handling in there, but I guess some things should return null instead of errors..

The offending code will be in:

/ocs/apis/sensor

you can see that if the peripheral throws an ocs_error event, it'll throw an error() in the lua.

I can fix this for the next release, however, as a workaround I recommend one of the two:

1) copy ocs/apis/sensor down to the root of your computer and edit that lua method there so it returns null instead of throwing an error

or..

2) use pcall on the sensor instead.

<immibis> pcall(function, arguments...) -> status, return_values...
<immibis> status is true for success, false for error
<immibis> if it errored, there'll be one return_value, and that's the error message

I would suggest that we return nil, "error text".

#546 abihoooo

  • Members
  • 33 posts
  • LocationForge World

Posted 23 January 2013 - 10:16 PM

I've looked in the server logs, ForgeModLoader-server-0.log, and my client's logs and it shows nothing about the tank problem. Basically what happens is when the liquid sensor trys to read a tank with more than 0 buckets in it the program stops on that command, but doesn't crash the server. If there is somewhere else the errors will show I'll look there.

#547 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 23 January 2013 - 10:30 PM

Unable to replicate this at all on my own version, in both multiplayer and single player. I'm guessing this has been fixed accidentally during my latest changes.

#548 MichiyoRavencroft

  • Members
  • 10 posts

Posted 24 January 2013 - 02:15 AM

View Postabihoooo, on 23 January 2013 - 10:16 PM, said:

I've looked in the server logs, ForgeModLoader-server-0.log, and my client's logs and it shows nothing about the tank problem. Basically what happens is when the liquid sensor trys to read a tank with more than 0 buckets in it the program stops on that command, but doesn't crash the server. If there is somewhere else the errors will show I'll look there.

Which liquids are you trying? Water, Milk, Lava, Biomass, and Honey all work fine for me in 1.2., Fuel, and Oil still crash sensorview serverside, but not in single player. I even have the "Liquid Metals" mod and all the liquids work from it too.

#549 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 24 January 2013 - 02:26 AM

hmm. Oil and fuel - i'll take a look into that.

#550 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 24 January 2013 - 03:32 AM

Oil and Fuel are fixed in my local version now. Buildcraft doesn't seem to like offering item names to computer craft :)

It'll TRY to give you a nice friendly name to look at, however if it fails it'll give a more.. codey name (such as buildcraft.fuel). Either way, the name it gives should stay consistent.

This'll be in 0.1.3, which I think i'll release soon because there's no new features but quite a few bug fixes.

Edit: I think it'll return RawName and Name, where Name will try to give a friendly name, but will fall back to RawName is it cant get it.

#551 tabs

  • Members
  • 21 posts

Posted 24 January 2013 - 04:37 AM

I would love to be able to detect a player's rotation values (where they're looking) with this, so I can make kinect style games in front of a big monitor, and an on screen cursor. Is it possible to do get that info? I've had a look at the details of my player entity and can't find rotation, only position.

#552 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 24 January 2013 - 04:54 AM

View Posttabs, on 24 January 2013 - 04:37 AM, said:

I would love to be able to detect a player's rotation values (where they're looking) with this, so I can make kinect style games in front of a big monitor, and an on screen cursor. Is it possible to do get that info? I've had a look at the details of my player entity and can't find rotation, only position.
I didn't include that, but it should be easy to do so. I agree that this could be useful. :) Maybe Mikeemoo will add that real quick? ;) (still having exams myself)

#553 tabs

  • Members
  • 21 posts

Posted 24 January 2013 - 05:22 AM

That would be great.

In return I'll share the code for a function that will take the location and dimensions of any surface (most often will be used to describe a monitor screen, I guess) and an entity position and rotation values, which returns the x,y coordinates they're looking at on that surface.

I'll need to test it first though!

Should lead to some fun applications. :)

#554 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 24 January 2013 - 05:22 AM

View Posttabs, on 24 January 2013 - 04:37 AM, said:

I would love to be able to detect a player's rotation values (where they're looking) with this, so I can make kinect style games in front of a big monitor, and an on screen cursor. Is it possible to do get that info? I've had a look at the details of my player entity and can't find rotation, only position.

Added Pitch, Yaw and YawHead. Untested, but this should make it into 0.1.3 once I've tested it :)

#555 Speedfister

  • Members
  • 5 posts

Posted 24 January 2013 - 05:25 AM

Heya. This looks very interesting but I'm still using Minecraft 1.4.5 and ComputerCraft 1.4.7 and was wondering if any of the earlier versions of OpenCCSensors are working with this combo?

I've tried the ones posted in this thread (like 0.06.1 and 0.06.3) but not sure if it's my fault they don't work :) Computer's able to detect sensor but when I use the sample "os.loadAPI("ocs/apis/sensor") and so on" ... I get an error. Am I supposed to have a folder named ocs/apis/ somewhere? If so - where do I get it and where do I put it?

Thanks.

#556 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 24 January 2013 - 05:26 AM

View PostSpeedfister, on 24 January 2013 - 05:25 AM, said:

Heya. This looks very interesting but I'm still using Minecraft 1.4.5 and ComputerCraft 1.4.7 and was wondering if any of the earlier versions of OpenCCSensors are working with this combo?

I've tried the ones posted in this thread (like 0.06.1 and 0.06.3) but not sure if it's my fault they don't work :) Computer's able to detect sensor but when I use the sample "os.loadAPI("ocs/apis/sensor") and so on" ... I get an error. Am I supposed to have a folder named ocs/apis/ somewhere? If so - where do I get it and where do I put it?

Thanks.

With the earlier versions you mention, you can probably access the sensor directly through the peripheral API like you would with any other peripheral, so you dont need to load the sensor api.

However, I unfortunately wont be able to support you with this and I know the earlier versions have quite a few little bugs in them, so I fully recommend upgrading if you can.

#557 tabs

  • Members
  • 21 posts

Posted 24 January 2013 - 05:31 AM

View PostMikeemoo, on 24 January 2013 - 05:22 AM, said:

Added Pitch, Yaw and YawHead. Untested, but this should make it into 0.1.3 once I've tested it :)

Thank you!

#558 Speedfister

  • Members
  • 5 posts

Posted 24 January 2013 - 05:35 AM

View PostMikeemoo, on 24 January 2013 - 05:26 AM, said:

View PostSpeedfister, on 24 January 2013 - 05:25 AM, said:

Heya. This looks very interesting but I'm still using Minecraft 1.4.5 and ComputerCraft 1.4.7 and was wondering if any of the earlier versions of OpenCCSensors are working with this combo?

I've tried the ones posted in this thread (like 0.06.1 and 0.06.3) but not sure if it's my fault they don't work :) Computer's able to detect sensor but when I use the sample "os.loadAPI("ocs/apis/sensor") and so on" ... I get an error. Am I supposed to have a folder named ocs/apis/ somewhere? If so - where do I get it and where do I put it?

Thanks.

With the earlier versions you mention, you can probably access the sensor directly through the peripheral API like you would with any other peripheral, so you dont need to load the sensor api.

However, I unfortunately wont be able to support you with this and I know the earlier versions have quite a few little bugs in them, so I fully recommend upgrading if you can.

Ok, any chance you could give a tiny little example that would show me if the version I have is working or not?

When I tried to update MC and my mods, with their random block ID's, my world didn't quite work as it should I'm afraid. Will have to play like this til I get bored and want to start something fresh :)

#559 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 24 January 2013 - 05:42 AM

View PostSpeedfister, on 24 January 2013 - 05:35 AM, said:

View PostMikeemoo, on 24 January 2013 - 05:26 AM, said:

View PostSpeedfister, on 24 January 2013 - 05:25 AM, said:

Heya. This looks very interesting but I'm still using Minecraft 1.4.5 and ComputerCraft 1.4.7 and was wondering if any of the earlier versions of OpenCCSensors are working with this combo?

I've tried the ones posted in this thread (like 0.06.1 and 0.06.3) but not sure if it's my fault they don't work :) Computer's able to detect sensor but when I use the sample "os.loadAPI("ocs/apis/sensor") and so on" ... I get an error. Am I supposed to have a folder named ocs/apis/ somewhere? If so - where do I get it and where do I put it?

Thanks.

With the earlier versions you mention, you can probably access the sensor directly through the peripheral API like you would with any other peripheral, so you dont need to load the sensor api.

However, I unfortunately wont be able to support you with this and I know the earlier versions have quite a few little bugs in them, so I fully recommend upgrading if you can.

Ok, any chance you could give a tiny little example that would show me if the version I have is working or not?

When I tried to update MC and my mods, with their random block ID's, my world didn't quite work as it should I'm afraid. Will have to play like this til I get bored and want to start something fresh :)


Try something like this:

local sensor = peripheral.wrap("left")
print(textutils.serialize(sensor.getTargets()))
If it spits out a load of junk, your version is working ;) In your old version you can pretty much use any code example posted, but use peripheral.wrap() instead of sensor.wrap()

#560 Speedfister

  • Members
  • 5 posts

Posted 24 January 2013 - 06:04 AM

View PostMikeemoo, on 24 January 2013 - 05:42 AM, said:

View PostSpeedfister, on 24 January 2013 - 05:35 AM, said:

Ok, any chance you could give a tiny little example that would show me if the version I have is working or not?

When I tried to update MC and my mods, with their random block ID's, my world didn't quite work as it should I'm afraid. Will have to play like this til I get bored and want to start something fresh :)


Try something like this:

local sensor = peripheral.wrap("left")
print(textutils.serialize(sensor.getTargets()))
If it spits out a load of junk, your version is working ;) In your old version you can pretty much use any code example posted, but use peripheral.wrap() instead of sensor.wrap()

Awesome, it worked :) Thanks for the help!





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users