Jump to content




[MC 1.7.10 | CC 1.65] OpenCCSensors

lua

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

#961 abiz

  • Members
  • 7 posts

Posted 27 May 2013 - 11:33 AM

I am having some problems with tank sensor. Using sensorview it indicates "No Sensor Card"
Following code prints "nil"

os.loadAPI("ocs/apis/sensor")
topSensor = sensor.wrap("top")
local targets = topSensor.getTargets()
print(textutils.serialize(targets))

Power sensor works fine.

#962 frostymm

  • Members
  • 5 posts

Posted 27 May 2013 - 01:32 PM

View PostLyqyd, on 27 May 2013 - 02:04 AM, said:

More example code would be valuable; it's true. If you can provide some simple suggestions for example code, that would be helpful. I can provide high-quality code samples, I'm just not always sure what would be most helpful.

Also, in case you didn't know about it, the ocs/programs/sensorview program can be invaluable to help determine which values you are wanting to look up. Instructions for its use are included in the first post. :)

I can think of a few examples that would be nice but I've only just gotten started and I'm only trying to do some basic things as they come up. The first thing that would be nice is a program for a sensor turtle to follow an entity (you) around. And then another nice example would be the radar in the wiki-video.

Also I did know about it but I didn't look too far into it, I'll have to take a closer look now that you've mentioned it since you sir seem to know what you're talking about. Though for now what would be nice is how to wrap the sensor on a sensor turtle since it's built-in rather than attached or do I need to at all?

#963 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 27 May 2013 - 01:52 PM

View Postabiz, on 27 May 2013 - 11:33 AM, said:

I am having some problems with tank sensor. Using sensorview it indicates "No Sensor Card"
Following code prints "nil"

os.loadAPI("ocs/apis/sensor")
topSensor = sensor.wrap("top")
local targets = topSensor.getTargets()
print(textutils.serialize(targets))

Power sensor works fine.

If you're getting "No sensor card", it usually means there's a conflict with a block from a mod somewhere. I'd recommend trying it in single player without any blocks around, then add blocks until it's similar to your setup to see where it's failing

#964 abiz

  • Members
  • 7 posts

Posted 28 May 2013 - 06:09 AM

View PostMikeemoo, on 27 May 2013 - 01:52 PM, said:

View Postabiz, on 27 May 2013 - 11:33 AM, said:

I am having some problems with tank sensor. Using sensorview it indicates "No Sensor Card" Following code prints "nil"
 os.loadAPI("ocs/apis/sensor") topSensor = sensor.wrap("top") local targets = topSensor.getTargets() print(textutils.serialize(targets)) 
Power sensor works fine.
If you're getting "No sensor card", it usually means there's a conflict with a block from a mod somewhere. I'd recommend trying it in single player without any blocks around, then add blocks until it's similar to your setup to see where it's failing

Yep you are correct.
Looks like I messed-up some Block IDs in Forestry at some point.
Fixed now :)

#965 abiz

  • Members
  • 7 posts

Posted 30 May 2013 - 04:48 PM

View Postabiz, on 28 May 2013 - 06:09 AM, said:

View PostMikeemoo, on 27 May 2013 - 01:52 PM, said:

View Postabiz, on 27 May 2013 - 11:33 AM, said:

I am having some problems with tank sensor. Using sensorview it indicates "No Sensor Card" Following code prints "nil"
 os.loadAPI("ocs/apis/sensor") topSensor = sensor.wrap("top") local targets = topSensor.getTargets() print(textutils.serialize(targets)) 
Power sensor works fine.
If you're getting "No sensor card", it usually means there's a conflict with a block from a mod somewhere. I'd recommend trying it in single player without any blocks around, then add blocks until it's similar to your setup to see where it's failing

Yep you are correct.
Looks like I messed-up some Block IDs in Forestry at some point.
Fixed now :)

Hmm looks like I was using a Mk II card, This has stopped working now.
If there is a block conflict, is there any easier way to find the problem?
I would rather wade through log files than add a block at a time until it fails.

Abiz

#966 Kramspill

  • New Members
  • 2 posts

Posted 31 May 2013 - 10:16 AM

Was wondering if/when you guys will update the machine sensor to work with buildcraft?

#967 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 31 May 2013 - 11:50 AM

View PostKramspill, on 31 May 2013 - 10:16 AM, said:

Was wondering if/when you guys will update the machine sensor to work with buildcraft?

Oh wow - buildcraft isn't really support! Sorry about that.. I guess it was because of the beta nature of it.

I'll take a look at it this weekend and hopefully add some support to the power and machine cards.

#968 Kramspill

  • New Members
  • 2 posts

Posted 31 May 2013 - 12:04 PM

Thanks, I noticed it a while ago and checked your code which confirmed my suspicions :)

#969 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 01 June 2013 - 02:13 AM

View Postfrostymm, on 27 May 2013 - 01:32 PM, said:

View PostLyqyd, on 27 May 2013 - 02:04 AM, said:

More example code would be valuable; it's true. If you can provide some simple suggestions for example code, that would be helpful. I can provide high-quality code samples, I'm just not always sure what would be most helpful.

Also, in case you didn't know about it, the ocs/programs/sensorview program can be invaluable to help determine which values you are wanting to look up. Instructions for its use are included in the first post. :)

I can think of a few examples that would be nice but I've only just gotten started and I'm only trying to do some basic things as they come up. The first thing that would be nice is a program for a sensor turtle to follow an entity (you) around. And then another nice example would be the radar in the wiki-video.

Also I did know about it but I didn't look too far into it, I'll have to take a closer look now that you've mentioned it since you sir seem to know what you're talking about. Though for now what would be nice is how to wrap the sensor on a sensor turtle since it's built-in rather than attached or do I need to at all?

Just wrap the sensor by whichever side it's on, right or left. Make sure to have a card in slot 16 of the turtle. Usage is all the same aside from that.

I'll see what I can do about those code examples. They may be a bit complex to be good sample material, but I'll see how it goes.

#970 frostymm

  • Members
  • 5 posts

Posted 01 June 2013 - 01:28 PM

View PostLyqyd, on 01 June 2013 - 02:13 AM, said:

View Postfrostymm, on 27 May 2013 - 01:32 PM, said:

View PostLyqyd, on 27 May 2013 - 02:04 AM, said:

More example code would be valuable; it's true. If you can provide some simple suggestions for example code, that would be helpful. I can provide high-quality code samples, I'm just not always sure what would be most helpful.

Also, in case you didn't know about it, the ocs/programs/sensorview program can be invaluable to help determine which values you are wanting to look up. Instructions for its use are included in the first post. :)

I can think of a few examples that would be nice but I've only just gotten started and I'm only trying to do some basic things as they come up. The first thing that would be nice is a program for a sensor turtle to follow an entity (you) around. And then another nice example would be the radar in the wiki-video.

Also I did know about it but I didn't look too far into it, I'll have to take a closer look now that you've mentioned it since you sir seem to know what you're talking about. Though for now what would be nice is how to wrap the sensor on a sensor turtle since it's built-in rather than attached or do I need to at all?

Just wrap the sensor by whichever side it's on, right or left. Make sure to have a card in slot 16 of the turtle. Usage is all the same aside from that.

I'll see what I can do about those code examples. They may be a bit complex to be good sample material, but I'll see how it goes.

Thanks <3 you da king. Hopefully I can figure it out with my 3 years college visual and game programming education =p (Not as good as it sounds)

#971 Regelneef

  • Members
  • 37 posts
  • LocationThe Nether-lands...

Posted 02 June 2013 - 07:59 AM

@mikeemoo, could you share with us the liquid level script which you showed on Youtube? THNX!!

#972 frostymm

  • Members
  • 5 posts

Posted 03 June 2013 - 07:10 PM

Quick question, can these sensors tell if an animal is a baby or an adult? And if so, how?

#973 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 03 June 2013 - 07:20 PM

Yes, you can:

Spoiler

IsChild should give you what you're looking for.

#974 frostymm

  • Members
  • 5 posts

Posted 04 June 2013 - 05:45 PM

Ah thanks, I totally forgot that was there.

#975 tabs

  • Members
  • 21 posts

Posted 05 June 2013 - 12:32 PM

Are there any plans to add detection for the Tinker's Construct smeltery? It would be great to be able to read exactly what is in there.

#976 Conan1981m

  • Members
  • 28 posts

Posted 07 June 2013 - 11:50 AM

Man, i see a lot of old scripts around and most of it dont work anymore :-(
could you maybe program a parser or something ?
I mean, read the old codes and replace code that wont work with the new format
so will spit out the actual required format ?!?

this might be hard to do but i would highly appreciate something like that.
there are a lot of codes out there, weather station for example or other stuff
and i just cant get it running or it spits out tons of information i dont know how to filter ...

Im quite noobish in lua and coding, would be great if i could even run the codes that others did before ..

#977 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 June 2013 - 12:09 PM

If you're talking about code written for the old ccSensors mod (which is completely separate), that mod is rather old and code written for it is pretty hairy. It's also impossible to automatically convert code to/from it, due to the way its returned data is structured.

#978 ZagKalidor

  • Members
  • 111 posts

Posted 07 June 2013 - 05:14 PM

Hey guys,

i think the most difficult thing for us newbees, noobs, nerds or whatever - starters with lua and its world of coding, is, for OCS, just a very simple thing - the processing of the the table that the command returns. It took hours to me to get a specific data, that i wanted to process, out of this very long and nested table data. It took me hours and hours to search for a comprehensive dokumentation for OCS and had to perceive, that it defines itself by "targets" and "targetDetails". My first thought was: there's got to be more. So, the most important thought, in my opinion, is getting on with lua and its data structures, to be a master of OCS-coding, FOR NEWBEES like me. 30 Years ago i learned BASIC and now wanted to get back into coding just for fun, and was very shocked, how coding advanced in these days. Not easy to find that corners to look around and to build ladders when you can use the elevator. Processing the table-data is the only key to it all. Someone's got to start a School of Data...

With this background, i want to thank you guys for getting me back on some road to get back into the thing. I love computercraft and OCS, so thank you for that. I never thought, that It could be that thrilling to me. Some sort of funny to sit at a computer, loading a computer inside a game, and coding it. Some kind of weird, isnt it?


Getting a question on the way:

Could it be possible to scan for specific biomes inside "some" sensor? Don't know if minecraft includes such data? Would be nice to get "some kind of" direction to go to, maybe the next jungle available. Maybe you all start laughing or shit into pants but: could there be a Sattelite-like sensor that gives data about the surrounding biomes. Could be a table that gives a simple grid of biometypes. I did not ask for a googleearth-like map! Biometype is part of data of the World-Sensor-Card. Maybe it could detect adjacent biometypes.

#979 ZagKalidor

  • Members
  • 111 posts

Posted 08 June 2013 - 07:29 PM

Hey Nightwalkers,

reading my own post brought up some new weird idea,

somewhere i tested a script of someone that took the data of a map (crafted vanilla minecraft map) inside a chest, (hope it was that way but i think it was) and gave it back to a computercraft-monitor screen.

What if my "Sattelite-Sensor" could give a overview of the world, like Rei“s Minimap does, but with more resolution to the world, if you know what i mean. Rei`s Minimap shows only a small part of the world. What if that sensor could bring up a very larger map of the world - maybe with coloured biome types as a option.

I know that, shown on a computercraft-monitor, the pixels would have more height than width, due to the ASCI-Screen Graphic, so maybe it could be recraftet into a (vanilla-minecraft) map, that is ejected by the Sensor as a dropped item or maybe it could be printed by a computercraft printer (dont know if that could work, but you are the pros, me just noob). That way could use the minecraft-graphics without the ASCI pixel "uncubeness".

Decide yourself if this is a part of a sensor-mod or more part of a map-mod, i dont know. Maybe it could be to intense or "OFF-TOPIC" for OCS ??!!??

#980 ZagKalidor

  • Members
  • 111 posts

Posted 08 June 2013 - 07:42 PM

another thought,

like the gps function of the modem, 3 Sensors are build in a very high height and give ( in some kind of cooperation) a very large overview of the adjacent world. Could give a expensive touch to a exclusive function in survival mode.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users