Jump to content




[MC 1.7.10 | CC 1.65] OpenCCSensors

lua

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

#361 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 09 January 2013 - 08:49 PM

View PostTheGeek, on 09 January 2013 - 04:01 PM, said:

View PostCloudy, on 09 January 2013 - 06:02 AM, said:

View PostTheGeek, on 09 January 2013 - 05:16 AM, said:

I think i have come across a bug in the OCS API, or its doing some thing screwy. I have a code that loads the API and uses a proximity sensor. On the first booting of the computer, it runs fine. However, once I terminate the program and attempt to run it again, I get a "attempt to call nil" error on the line:
sensor = sensor.wrap("right") as if the API wasn't loaded.

You're overwriting the sensor API with your sensor object :P

DOH! I sure am.

I have been noticing quite a noticeable "hiccup" in Minecraft whenever a sensor is called. My first code that checked many times a second brought my framerate from 120 down to 30. In subsequent code that only checked once a second, I still was able to tell when the sensor was activated. This concerns me a bit as I will likely have to use 4-8 sensors to cover the area in my project. I am confident you will optimize your code to minimize this in coming versions. I will have to do some testing on multiple sensors running at a reasonable rate and see if its any worse. I'll gladly share code or any debug info if it will help you in your efforts.

I haven't yet experienced any framerate loss. The code that drives OCS is pretty lightweight compared to everything else that's going on in minecraft - however, if you can provide some examples of what seems to be causing lag i'll profile it and see if it I can find a bottleneck.

#362 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 09 January 2013 - 08:57 PM

View PostHenness, on 09 January 2013 - 04:10 PM, said:

I cant seem to get any code that any one has posted to work, for example the killer program gives me an error killer:127: bad argument #1 to pairs (table expected, got number), also I don't have the graph api or the sensorview program. I looked in mods\OCSLua\lua\apis and the files are there.

Hi,

The killer turtle code was posted before we had to change the API. Try this code instead:

http://pastebin.com/UCES36jD

Make sure you've got a proximity sensor card in slot 16 of the turtle, make sure he has fuel, and make sure you start him while facing south.

Hope that works for you!

#363 Henness

  • Members
  • 189 posts

Posted 09 January 2013 - 10:33 PM

thanks it works now, I didn't know that you had to load the api ether. Before calling sensor.wrap()

#364 Henness

  • Members
  • 189 posts

Posted 10 January 2013 - 01:01 PM

Can someone clarify what the EnergyConducted variable that is returned from the ic2 sensor card is actually measuring, because I'm trying to get eu/tick or something of that sort? Also does someone have some api documentation on each sensor card because I haven't found any. I have had to save the methods table to a file to see them.

#365 StUdIoGuY

  • Members
  • 6 posts

Posted 11 January 2013 - 01:55 AM

How to make a batbox store more energy than it can :)

Posted Image

Probably that 32 EU/t energy flow is measured too :) they are built in serial, but I just got surprised and thought I'd share it :)

#366 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 02:47 AM

View PostHenness, on 10 January 2013 - 01:01 PM, said:

Can someone clarify what the EnergyConducted variable that is returned from the ic2 sensor card is actually measuring, because I'm trying to get eu/tick or something of that sort? Also does someone have some api documentation on each sensor card because I haven't found any. I have had to save the methods table to a file to see them.

All sensor cards implement the same methods:

getTargets() and getTargetDetails(key)

There will be additional methods added for each particular sensor card, but currently there is not.

More information can be found on the wiki page: http://www.computerc...e=OpenCCSensors

#367 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 03:12 AM

OCS Devs: We've had a lot... (lot!) of people asking about increasing the range of the sensors. Think it'd worth us upping the range of the 5x5x5 ones to 7x7x7 - so one block further range on each side

#368 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 11 January 2013 - 03:45 AM

View PostMikeemoo, on 11 January 2013 - 03:12 AM, said:

OCS Devs: We've had a lot... (lot!) of people asking about increasing the range of the sensors. Think it'd worth us upping the range of the 5x5x5 ones to 7x7x7 - so one block further range on each side
I agree, 5x5x5 space is a bit small for a machine set-up. And this mod is here to aid people, not to limit them. :)

#369 abihoooo

  • Members
  • 33 posts
  • LocationForge World

Posted 11 January 2013 - 04:29 AM

View PostHenness, on 10 January 2013 - 01:01 PM, said:

Can someone clarify what the EnergyConducted variable that is returned from the ic2 sensor card is actually measuring, because I'm trying to get eu/tick or something of that sort? Also does someone have some api documentation on each sensor card because I haven't found any. I have had to save the methods table to a file to see them.

The number is the total amount of EU that has flowed through the wire. You just have to do math and you can get the EU/t.

#370 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 January 2013 - 04:50 AM

View PostStUdIoGuY, on 11 January 2013 - 01:55 AM, said:

How to make a batbox store more energy than it can :)/>

Posted Image

Probably that 32 EU/t energy flow is measured too :)/> they are built in serial, but I just got surprised and thought I'd share it :)/>

I have observed this as well. It seems that a storage box will accept the entire contents of the last EU packet that arrives to fill it, even if that slightly over-fills it. You can see it on BatBoxes, MFEs, and MFSUs.

View PostMikeemoo, on 11 January 2013 - 03:12 AM, said:

OCS Devs: We've had a lot... (lot!) of people asking about increasing the range of the sensors. Think it'd worth us upping the range of the 5x5x5 ones to 7x7x7 - so one block further range on each side

This seems like a reasonable range upgrade.

#371 Znubbis

  • Members
  • 14 posts

Posted 11 January 2013 - 08:09 AM

Hello, thank you for a very nice mod!

I have a problem to get the multi-trace to work with the graph api to have several values at the same screen.

I think i need a small example, can someone please help me?

Thank you!

#372 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 10:13 AM

View PostZnubbis, on 11 January 2013 - 08:09 AM, said:

Hello, thank you for a very nice mod!

I have a problem to get the multi-trace to work with the graph api to have several values at the same screen.

I think i need a small example, can someone please help me?

Thank you!

I'd try to help with this one, but I think it's better you wait for Lyqyd ;) He's the man for the job!

#373 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 10:15 AM

Posted Image

Sneak preview.. thaumcraft 3 sensor card. Ignore the current card texture.

The API for this one isn't as easy for me to develop with, and I'd really like to speak to Azanor before releasing anything to do with this

#374 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 11:12 AM

http://i.imgur.com/txwRz.png

As above, not sure if this'll get release. Maybe maybe maybe. :)

(Can't actually work out what LiquidQty is - might remove that)

#375 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 January 2013 - 11:33 AM

View PostZnubbis, on 11 January 2013 - 08:09 AM, said:

Hello, thank you for a very nice mod!

I have a problem to get the multi-trace to work with the graph api to have several values at the same screen.

I think i need a small example, can someone please help me?

Thank you!

function upfun1()
  return math.random(0, 100)
end

function upfun2()
  return math.random(0, 100)
end

gradient1 = {colors.blue, colors.cyan, colors.green, colors.lime}
gradient2 = {colors.purple, colors.magenta, colors.red, colors.orange}
--gradient declarations are unnecessary if you wish to use the default gradient.

local gr, err = graph.new(peripheral.wrap("top"), {upfun1, upfun2}, {"Bluish", "Reddish"}, {gradient1, gradient2}, {0, 0}, {100, 100}, true)
--I believe I stated the effect of the sharedBounds value incorrectly; it seems likely that true forces them to share maximum and minimum values.

if gr then
  while true do
    gr:draw()
    sleep(0.5)
  end
else
  print(err)
end

Basically, just a table of multiple different trace specifications for each parameter that needs to be different per trace. Hopefully the example makes what I mean clear. :-)

#376 jewelshisen

  • Members
  • 164 posts

Posted 11 January 2013 - 06:06 PM

I can't find the config file and i am having a block id conflict.

#377 Heracles421

  • Members
  • 258 posts

Posted 11 January 2013 - 06:30 PM

Would a Spanish translation be convenient? Or the people that know want Spanish are just a small portion?

#378 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 08:45 PM

View PostHeracles421, on 11 January 2013 - 06:30 PM, said:

Would a Spanish translation be convenient? Or the people that know want Spanish are just a small portion?

All translations would be really really appreciated, no matter what the language.

#379 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 11 January 2013 - 10:18 PM

Thinking about slightly reducing the functionality of the buildcraft engine sensors, however, I'll add additional buildcraft sensors for a few more blocks to make up for it..

There's technical reasons for this. I'll talk to the buildcraft guys to see if we can get the additional functionality reimplemented in a more sane way.


Stuff I'm looking at in the next few days:

1) Still need to fix the range/shape of the sphere in the proximity/dropped cards
2) Need to increase the range of the block sensors
3) Need to reduce the functionality of the inventory card slightly. Right now there's a few bits of data it's giving out that we probably shouldn't be for some items

Once done, I'll be looking at implementing a few new sensor cards. The ones I'm keen to look at soon are: Forestry, Advanced Machines, and Factorization.

Other stuff I know needs doing:

1) We need to make the system a lot more configurable. An admin should be able to disable/enable things easily
2) Cloudy is going to look at a better way to load dependencies/packs in

Also I wanted to get some thoughts on an idea I've had - I'd really like some feedback from the other devs on this: sensorCardCall and getSensorMethods feel really clunky to use in practice. I propose that we ditch them, but change the base peripheral methods so it includes methods for any inserted sensor cards.

For example:

Java side:
public String[] getMethodNames() {
  String[] names = new String[] { "getTargets", "getTargetDetails", "getSensorName" };
  if (card != null) {
	names = StringUtils.merge(names, card.getMethodNames())
  }
  return names;
}
public Object[] callMethod(..etc.) {
   // main logic here
  }else if (card != null) {
	 card.callMethod(.etc..)
  }
}

Lua side:

os.loadAPI("ocs/apis/sensor")
local invent = sensor.wrap("left")
local mapData = invent.getMapImageData("0,0,0", 1)


What do you guys think about that idea? I think it'd be a lot easier for a user to understand

#380 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 11 January 2013 - 11:56 PM

It isn't possible. ComputerCraft only checks the method list once, and that's when the peripheral is attached.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users