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

ForceFieldProtection code needed!

Started by sin_samsonsin, 27 March 2014 - 02:25 PM
sin_samsonsin #1
Posted 27 March 2014 - 03:25 PM
Hey, i need to make a program using the "Sensor" ot detect players. I need it because i want a Force Field to turn on when other players besides me and my 2 friends are nearby. I have tried to write the program myself but i suck at writing code. Spent hours on tutorials but still cant make the program work as i want it to. I would be very happy and so will my generators be. Thank you to everyone that are trying to help me.

Sin
Agoldfish #2
Posted 27 March 2014 - 04:36 PM
In Ask a Pro, we don't write stuff for you. Though you can tell us specific problems you have and we can help.
TheOddByte #3
Posted 27 March 2014 - 10:19 PM
Post your current code, Saw that you posted the exact same stuff in General/Idea Exchange.
I don't think Cross-Posting is allowed, If you do it multiple times a moderator might ban you :P/>
sin_samsonsin #4
Posted 28 March 2014 - 06:08 PM
Hey, im not good in computercraft (i dont understand how to extract information from tables even) so the program i wrote was basicly me printing the player names then spending half an hour trying to make it output a redstone signal when it saw me. I gave up so i came here. Ive deleted the program since its so small. Thank you also for replying, informating me and trying to help me :D/>

Sin
TheOddByte #5
Posted 28 March 2014 - 06:42 PM
Hey, im not good in computercraft (i dont understand how to extract information from tables even) so the program i wrote was basicly me printing the player names then spending half an hour trying to make it output a redstone signal when it saw me. I gave up so i came here. Ive deleted the program since its so small. Thank you also for replying, informating me and trying to help me :D/>

Sin
Getting information from tables isn't ComputerCraft, It's Lua :P/>
And it isn't very hard

local t = {} -- This is the table

-- Some random variables
local a = "This will be stored in the table later"
local b = 23

-- Insert the variables into the table
table.insert( t, a )
table.insert( t, b )

-- Print them
print( t[1] ) -- This will print out what we assigned the variable 'a' to since that was inserted to the table first
print( t[2] ) -- And this will output the variable 'b'
If you want to gain experience and be able to create awesome Lua programs yourself you should check out http://www.lua.org/ :D/>
Edited on 28 March 2014 - 05:42 PM
Bomb Bloke #6
Posted 29 March 2014 - 12:07 AM
You may find this thread to be of use.