Jump to content




How To Use ccSensors


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

#21 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 20 January 2013 - 05:53 PM

Already had line 3 set to the name of the sensor and my bad didnt typed the whole error, its as following:

CraftOS 1.3
right
hello
Startup:10: bad argument: table expected, got nil

(seems that it reconises the controller on the right side (otherwise it wont print "right" )
Also reconised the sensorname "Hello"

Ahh, oh! Kidding me, I typed date instead of data! That was the error (was double checking) Finaly! it works :D Well, not totaly but "assume" the rest is easy :) Great! Really great, thanks man :)

But uhm, 0 players? But im there XD Within the range of the Sensor, well Ima going to test that tomorrow, thanks for your help man! And Ill give some feedback :)


[Edit]

Created a loop but the if #players > 0 then doesnt seems to work, or wel without the # the loop works but it does not check the ''how many players are here now"

Anyway, I'll continue tomorrow, im now going to sleep, Night man and thanks for your help!

#22 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 January 2013 - 07:49 PM

Haha good to hear... typos suck sometimes... i type words funny sometimes too...

It rest is fairly easy... its just using the redstone api for the lights...

Hmmm odd. it was showing me with mine...

Ok until tomorrow :)

#23 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 20 January 2013 - 10:32 PM

View PostTheOriginalBIT, on 20 January 2013 - 12:19 PM, said:

Ok so now to the problem... It seems to me that your trying to use the World sensors to detect players... This is actually done using the proximity sensor... unfortunately I am not aware of any module that can tell you how many people are connected to the world... only how many are within the range of the sensor... ( can you confirm remiX? )

Yeah, the proximity module detects living entities around the sensor. This does infact include cows, sheep, mobs which is a pain to filter to players! Even click on the 'players' probe shows animals :/

The player targets start with 'qr' or something. I'll quickly make a code to filter it to players removing mobs etc, and I'll check what the World module does :P

Edit:

Take this for example, proximity module is really buggy...

Here is a picture of it not showing my info
Posted Image

Here is a picture of it showing my info 2 seconds later, where I'm actually further away from the sensor...
Posted Image

I don't understand... lol

#24 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 January 2013 - 11:19 PM

View PostremiX, on 20 January 2013 - 10:32 PM, said:

View PostTheOriginalBIT, on 20 January 2013 - 12:19 PM, said:

Ok so now to the problem... It seems to me that your trying to use the World sensors to detect players... This is actually done using the proximity sensor... unfortunately I am not aware of any module that can tell you how many people are connected to the world... only how many are within the range of the sensor... ( can you confirm remiX? )

Yeah, the proximity module detects living entities around the sensor. This does infact include cows, sheep, mobs which is a pain to filter to players!

The player targets start with 'qr' or something. I'll quickly make a code to filter it to players removing mobs etc, and I'll check what the World module does :P
Yeh I already did that :P

#25 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 21 January 2013 - 03:34 AM

Hello back guys,
Well I did some testing and it still does not seems to work which is kinda weird, I've put in the exact code as the one in the pastebin and it does not seems to work, well the first thing is that is says there are 0 people nearby the sensor without editting anything of the code, I've tested this with 2 players (Another person and me) When I reboot, no matter what I do it says this:

right
Hello
number of players: 0

(Hello is the sensor name so it is connected)

I've also tested the program with:

if #players > 0 then and if# players > 1 then (also tried if #players > 1 do and if #players > 0 do
rs.setBundledOutput("back", 1)
sleep(1)
rs.setBundledOutput("back", 0)

when i typed "do" instead of "then" it says "then" expected.

otherwise It keeps giving me this message: (when using "then")

startup:23: attempt go get length of number

So, what am I doing wrong?


[Edit] Also tried this in singleplayer, does not work either, bweh

[When I figured it all out I might make a Tutorial on this]

#26 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 07:44 AM

View PostNLBlackEagle, on 21 January 2013 - 03:34 AM, said:


otherwise It keeps giving me this message: (when using "then")

startup:23: attempt go get length of number
That is because in the example I wrote the number of players is already a number, so you don't need to have the # infront... The hash is only needed for string length and table length...

#27 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 21 January 2013 - 08:05 AM

Hmm, maybe because the controller isnt properly connected to the computer, the dots in the corners of the controller are red and when I logg out an in the Sensor reset its name back to ''Sensor"

Edit, i've checked the sensor out and it seems that its not vq but ahv
Could try that out

#28 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 08:12 AM

View PostNLBlackEagle, on 21 January 2013 - 08:05 AM, said:

Hmm, maybe because the controller isnt properly connected to the computer, the dots in the corners of the controller are red and when I logg out an in the Sensor reset its name back to ''Sensor"

Edit, i've checked the sensor out and it seems that its not vq but ahv
Could try that out
Yeh I did have a note that on SMP the sensor name is Sensor. And it should be 'vq' since your running mc 1.2.5

#29 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 21 January 2013 - 08:18 AM

Thats weird, so i can only set up 1 sensor each controller combined with computercraft?
I mean, computer>controller>sensor.
If i add like 5 more sensors it wont know wich one to chooce if I do it on 1 controller XD

#30 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 08:27 AM

View PostNLBlackEagle, on 21 January 2013 - 08:18 AM, said:

Thats weird, so i can only set up 1 sensor each controller combined with computercraft?
I mean, computer>controller>sensor.
If i add like 5 more sensors it wont know wich one to chooce if I do it on 1 controller XD
Multiple should work, and I say should because I've had them work, someone else couldn't get them to work.

#31 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 21 January 2013 - 09:16 AM

I just cant find the problem :( As you see there is a player nearby + me and the computer still does not detect them

Spoiler


#32 Getalife

  • Members
  • 6 posts

Posted 22 January 2013 - 01:45 AM

I also can't get the proximity module to work :(

#33 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 January 2013 - 01:46 AM

Sorry if I missed if you said this, but is the World Module or Proximity Module?

View PostGetalife, on 22 January 2013 - 01:45 AM, said:

I also can't get the proximity module to work :(

Yeah... I need more people to confirm that it's buggy or maybe I'm doing something wrong?

#34 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 22 January 2013 - 06:22 AM

View PostremiX, on 22 January 2013 - 01:46 AM, said:

Sorry if I missed if you said this, but is the World Module or Proximity Module?

View PostGetalife, on 22 January 2013 - 01:45 AM, said:

I also can't get the proximity module to work :(

Yeah... I need more people to confirm that it's buggy or maybe I'm doing something wrong?

Somehow the code TheOriginalBIT posted in a pastebin didnt work for me ( http://pastebin.com/S1wmCiw5 ) I tried, and tried. The program does run but it does not detect any players. There is one last thing I could do and thats testing it in singleplayer. Or is there another way to get it to work? Another code which might does work?

And I tried both the World Module and the Proximity Module. Either does not work with this code =P All I want to get is a redstone signal when someone comes near to a certain point

#35 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 January 2013 - 07:28 AM

This works with World Module.

Spoiler

I tested it and it works on SSP. Not sure about SMP. Although, I'm unsure it will update when a player joins (i haven't tested that), but I'm sure it will...

#36 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 22 January 2013 - 08:05 AM

Thanks man! I'll test it out straight away :) If it wont work im afraid there is something wrong with the server settings/files as we experienced before with the redpower computers. (the earlier version) Altough its fixed now due a new instal of them and replacement to another IP adress, kinda weird. Anyway I will give some feedback as soon im done with uhm, copying yes :P

#37 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 22 January 2013 - 08:30 AM

bios:33: bad argument: string expected, got nil

-- up
sel = sel - 1
elseif key == 208 then
-- down
sel = sel - 1
elseif key == 28 then
-- Enter
return tData[sel]
end
if sel < 1 then sel = #tData
elseif sel > #tData then sel = 1 end

Bios:33: not for shure if it ments string 33, anyway "end" is on string 33



Solved, made an mistake! Ok, lets check it out.


Ahh, got my next error but I assume that i need to put in the coordinates? Ypos, xpos?

Guess here: "local function writeAt(xPos, yPos, text)"
anyway, this is the error i get:


( After pressing "Enter" on "*Sensor")


Spoiler


#38 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 January 2013 - 06:23 PM

Hm.. The code as is should work (it did for me). No adjustments need to made but just set up the world module in the sensor.

#39 NLBlackEagle

  • Members
  • 25 posts
  • LocationNL

Posted 23 January 2013 - 05:38 AM

You mean change the name of the sensor to module?

[Edit] Oh nevermind misreaded it.

[Edit]

Well, here is the picture of it but it still gives the same error :P


Spoiler


Tried it on singleplayer, now it says startup 50 attempt to call nil.

Thats the setCursorPos string, really weird. Well, might I ask you one last fafour? Could you join the server and check it out for yourself? if that doesnt does the trick then its game over for ccSensors

#40 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 January 2013 - 11:23 AM

You sure I can jump on and try to fix... Give me about an hour (got some other stuff need to do around house) and pm the IP...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users