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

password protected gate using bundled cable

Started by rowlanm, 16 September 2012 - 09:14 PM
rowlanm #1
Posted 16 September 2012 - 11:14 PM
Hi

Im new to computercraft side of programming, and ive spent years trying to learn to program (irl) but its just something i cant seem to comprehend… ontop of that i cant get my head around the in game gui for writing a program… so im asking one of you smart people that can do the programming for help :P/>/>

basically, im running in tekkit (latest recomended build) and i want to make myself a gateway. i have the wiring sorted out, its bundled cable from the back of the computer and that then splits off into red and blue (colours dont matter) the red cable opens my gate and the blue cable closes the gate. the gate is planned to be 3 blocks wide and is a 2 part gate with each side only needing to open 2 blocks away from eachother. i would like to enter a code to open the gate, and not need a code to close the gate, kind of like a menu that asks if i want to open or close the gate, when close is selected, it forgoes the password screen and closes the gate. when opening the gate it asks for a password. it needs to pulse twice and there be aproximately a 7 tick delay between the pulses. is this doable? :/ i just can't get my head around the coding :)/>/> i think its a case of i dont know where to start, and i dont understand the functions… i couldnt even make a hello world program earlier…
many thanks in advance


edit. i also couldnt see anything that was quite what i was after, i didnt want to throw something in thats written for a slightly different role that would just end up throwing a spanner into the works if i came to finally get my head around coding in the future and expand on stuff…
etopsirhc #2
Posted 17 September 2012 - 02:57 AM
i'll give you a break down of what you'd need to do

first "edit startup" that way your program will always run

then you'll want to "print('your text')"
best setup as a somthing like "function menu()"

from there theirs a wide variaty of things , if you set up the menu to "return number"
and the menu to accept a number for either opening or closing
you can easily check "if n == 1 then" open function

and mid open function have a password input screen where
if pass == "YourPass" then
open
end

getting the input is rather simple
inputVar = io.open("*")
the io.open() will let you type stuff in
and the * will replace what you type with that so other ppl cant see it
the actual input however will be what ever you typed

have fun :)/>/>
Maome #3
Posted 17 September 2012 - 04:25 AM
This should set you up with using bundled outputs: http://computercraft.info/wiki/index.php?title=Redstone.setBundledOutput
rowlanm #4
Posted 17 September 2012 - 08:08 PM
thanks guys ill throw my work tired mind at it and see what i get :D/>/> be prepared for "lolz" when you see the pitiful code i come up with in a few days/weeks/months/lives :)/>/>

thanks for the input :)/>/>