This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
epicowner97's profile picture

I'm stuck with OpenCCSensors.

Started by epicowner97, 06 October 2014 - 06:28 PM
epicowner97 #1
Posted 06 October 2014 - 08:28 PM
Hey,

So I've tried some things with openperipherals and openCCsensors but im stuck on setting the RS output on true when i'm close to a sensor next to my computer, I know it's a fault in the code but I can't seem to find where or why because i'm still a beginner. here's the code


s = peripheral.wrap("left")
function list()
while true do
  list1 = s.getPlayerNames()
  names = textutils.serialize(list1[1])
  if names == "epicowner97" then
	rs.setOutput("back", true)
  end
  sleep(0.1)
end
end
list()

I hope that you can help me :)/>
KingofGamesYami #2
Posted 06 October 2014 - 08:38 PM
Well, for one thing, even if you were there, textutils.serialize would return something like this:

"{epicowner97={stuffs}}"
epicowner97 #3
Posted 06 October 2014 - 08:52 PM
Well, for one thing, even if you were there, textutils.serialize would return something like this:

"{epicowner97={stuffs}}"

So how would I rewrite the code so it gives "epicowner97" instead of "{epicowner97={stuffs}}" ?
KingofGamesYami #4
Posted 07 October 2014 - 12:02 AM
Dont. Look for the key "epicowner97".


if list1[ "epicowner97" ] and #list1 == 1 then --#if only you are in range

PS: It would be nice if I could summon a pro that has used OpenCCSensors before… **does elaborate summoning ritual**
Agent Silence #5
Posted 07 October 2014 - 12:10 AM

s = peripheral.wrap("left")
function list()
 while true do
  for i,v in pairs(s.getPlayerNames()) do
   if v == "epicowner97" then
    rs.setOutput("back", true)
   end
   sleep(0.1)
  end
 end
end
list()

PS: You put too much force into the summoning ritual, now I can't stop spinning!
Lyqyd #6
Posted 07 October 2014 - 12:57 AM
That's not OpenCCSensors code.

OP, are you using OCS or OpenP? It makes a big difference, the code is rather different.
epicowner97 #7
Posted 07 October 2014 - 11:49 AM
That's not OpenCCSensors code.

OP, are you using OCS or OpenP? It makes a big difference, the code is rather different.

this code uses OCS, just the sensor
Dragon53535 #8
Posted 07 October 2014 - 04:53 PM
That's not OpenCCSensors code.

OP, are you using OCS or OpenP? It makes a big difference, the code is rather different.

this code uses OCS, just the sensor
The problem being is that OpenCCSensors requires a sensor card, does the one you're using require one?