34 posts
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 :)/>
3057 posts
Location
United States of America
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}}"
34 posts
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}}" ?
3057 posts
Location
United States of America
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**
376 posts
Location
[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)
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!
8543 posts
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.
34 posts
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
1080 posts
Location
In the Matrix
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?