Jump to content




[MC 1.7.10 | CC 1.65] OpenCCSensors

lua

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

#421 jewelshisen

  • Members
  • 164 posts

Posted 16 January 2013 - 04:35 AM

Hey can you try and make it compatable with the MFFS and Steve's Carts mods as well?

#422 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 04:46 AM

Already started doing a minecart sensor which'll probably deal with railcraft and steves carts stuff.

Had a few requests for MFFS so I'll look into that soon :)

#423 jewelshisen

  • Members
  • 164 posts

Posted 16 January 2013 - 04:53 AM

Awesome. But I have hit a problem with the graph API. Here is my code:

m = peripheral.wrap("right")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end


I keep getting an error at line four saying "attempt to index ? (a nil value)"

#424 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 04:59 AM

I'll let Lyqyd deal with this one because I don't know anything about the graph API!

Edit: It's likely to be "Stored" (uppercase), too. I think all/most properties return ProperCase properties at the moment

#425 jewelshisen

  • Members
  • 164 posts

Posted 16 January 2013 - 05:01 AM

View PostMikeemoo, on 16 January 2013 - 04:59 AM, said:

I'll let Lyqyd deal with this one because I don't know anything about the graph API!

Edit: It's likely to be "Stored" (uppercase), too. I think all/most properties return ProperCase properties at the moment

Tried it with tab.Stored as well. Same error.

#426 jocan2003

  • New Members
  • 5 posts

Posted 16 January 2013 - 06:25 AM

I hate to ask these kind of question, but where do i get the latest stable download of this? is it still the 0.1 on the original post or is there a place with more up-to-date package?

#427 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 January 2013 - 06:37 AM

View Postjewelshisen, on 16 January 2013 - 04:53 AM, said:

Awesome. But I have hit a problem with the graph API. Here is my code:

m = peripheral.wrap("right")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end


I keep getting an error at line four saying "attempt to index ? (a nil value)"

Please prepend the following lines and re-test from a freshly booted computer:

os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")


#428 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 06:55 AM

View Postjocan2003, on 16 January 2013 - 06:25 AM, said:

I hate to ask these kind of question, but where do i get the latest stable download of this? is it still the 0.1 on the original post or is there a place with more up-to-date package?

0.1 is the latest official release. (The ones before that were 0.0.1, 0.0.2, 0.0.4..etc..)

Go with the one from the first page :)

#429 jewelshisen

  • Members
  • 164 posts

Posted 16 January 2013 - 07:09 AM

View PostLyqyd, on 16 January 2013 - 06:37 AM, said:

View Postjewelshisen, on 16 January 2013 - 04:53 AM, said:

Awesome. But I have hit a problem with the graph API. Here is my code:

m = peripheral.wrap("right")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end


I keep getting an error at line four saying "attempt to index ? (a nil value)"

Please prepend the following lines and re-test from a freshly booted computer:

os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")

Nope... Still the same error.

#430 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 January 2013 - 07:15 AM

View Postjewelshisen, on 16 January 2013 - 07:09 AM, said:

View PostLyqyd, on 16 January 2013 - 06:37 AM, said:

View Postjewelshisen, on 16 January 2013 - 04:53 AM, said:

Awesome. But I have hit a problem with the graph API. Here is my code:

m = peripheral.wrap("right")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end


I keep getting an error at line four saying "attempt to index ? (a nil value)"

Please prepend the following lines and re-test from a freshly booted computer:

os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")

Nope... Still the same error.

Your code is using the right side for both monitor and sensor, upon closer examination. This is almost certainly the source of the issue.

#431 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 07:17 AM

View Postjewelshisen, on 16 January 2013 - 07:09 AM, said:

View PostLyqyd, on 16 January 2013 - 06:37 AM, said:

View Postjewelshisen, on 16 January 2013 - 04:53 AM, said:

Awesome. But I have hit a problem with the graph API. Here is my code:

m = peripheral.wrap("right")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end


I keep getting an error at line four saying "attempt to index ? (a nil value)"

Please prepend the following lines and re-test from a freshly booted computer:

os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")

Nope... Still the same error.

It looks like your using "right" for both the monitor and the sensor.

I've just done a test and this is working correctly for me:

os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")
m = peripheral.wrap("top")
function update()
  local tab = sensor.call("right", "getTargetDetails", "2,0,0")
  return tab.Stored
end
graphI = graph.new(m, update, "EU Storage", nil, 0, 1000000)
while true do
  graphI:draw()
  sleep(0.5)
end

View PostLyqyd, on 16 January 2013 - 07:15 AM, said:

Your code is using the right side for both monitor and sensor, upon closer examination. This is almost certainly the source of the issue.

Dammit you won

#432 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 January 2013 - 07:21 AM

View PostMikeemoo, on 16 January 2013 - 07:17 AM, said:

Dammit you won

That's what you pay me for! ;)

#433 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 07:28 AM

View PostLyqyd, on 16 January 2013 - 07:21 AM, said:

View PostMikeemoo, on 16 January 2013 - 07:17 AM, said:

Dammit you won

That's what you pay me for! ;)

I'll pay you even less if you don't get your ass on IRC soon ;)

#434 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 January 2013 - 08:53 AM

Gimme five hours to get off work and I will! :P

#435 jocan2003

  • New Members
  • 5 posts

Posted 16 January 2013 - 08:56 AM

View PostMikeemoo, on 16 January 2013 - 06:55 AM, said:

View Postjocan2003, on 16 January 2013 - 06:25 AM, said:

I hate to ask these kind of question, but where do i get the latest stable download of this? is it still the 0.1 on the original post or is there a place with more up-to-date package?

0.1 is the latest official release. (The ones before that were 0.0.1, 0.0.2, 0.0.4..etc..)

Go with the one from the first page :)
Thank you for your answer and sorry for wasting your time on such trivial question. By the way, im really happy to see this system being taken care of ( Sorry for mistake i am french too ). Have a nice day and a late happy new year hehe.

#436 Lordmau5

  • Members
  • 22 posts

Posted 16 January 2013 - 09:30 AM

Chance for the real names coming back?
E.g. "BatBox" instead of "0,2,0"? :D

#437 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 09:41 AM

View PostLordmau5, on 16 January 2013 - 09:30 AM, said:

Chance for the real names coming back?
E.g. "BatBox" instead of "0,2,0"? :D

The target keys that come back are the relative coordinates, not the name of the entity. It's impossible for you, the user, to label a batbox with a unique name, so the target key has to be something we KNOW will always be unique, in this case, the coordinate.

If you need to get the type of entity at that position, you can get detailed information for the target which will tell you it's a batbox.

#438 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 11:07 AM

https://github.com/m...13-01-13&type=a

Just to scare you... :)

(Yes, 99% broken in my own fork at the moment. Gradually putting it back together)

I've added a few things:

1) Completely decoupled the 'Sensing' from both cards and the sensor peripheral. You can now very easily just 'use the sensors' without it being tied into the whole system. This means we can very easily add new peripherals that use the sensing ability. A "sensor" class is now just there to retrieve information and return targets - a "sensor interface" now bridges the gap between sensor cards and sensors.

2) Made a system for dealing with the whole "method call on next tick" system. As you can see here: https://github.com/m...ntityGauge.java adding a new method is done in a nice little callback.

3) Added better error handling throughout. If any of the methods throw an Exception the method calling queue thing handles it and returns it back to the lua as an ocs_error event along with the error message. (I've modified the lua to deal with this)

4) I've prepared the system to be able to handle sensor upgrades, although I havent gone as far as implementing these yet

5) General tidying up. The code base was getting a little bit spaghetti, so it's much cleaner now. I think I've made a few classes completely redundant too so I'll delete them as part of this process.

#439 jewelshisen

  • Members
  • 164 posts

Posted 16 January 2013 - 01:06 PM

Is there any hope of making the card ranges part of the config file like the rednet range is?

#440 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 16 January 2013 - 08:38 PM

View Postjewelshisen, on 16 January 2013 - 01:06 PM, said:

Is there any hope of making the card ranges part of the config file like the rednet range is?


For the time being, if this card upgrade stuff goes ahead, the ability to change range by using different cards should be enough.. I'm nervous about having them configurable because I know people will just set it really high then produce a load of bug reports when it starts to become slow! :)

However, I know other mods do have that kinda thing configurable (such as nuclear explosion strength in ic2), so configurable ranges is a possibility, but I'll leave that decision to Cloudy..

For the time being it's not something I'll be focusing on. Plenty of other stuff to do :)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users