r/ComputerCraft • u/Grouchy-Ad6784 • Nov 11 '25
I suck at this
So I am trying to make a code that asks for a password, then makes a redstone to the back for 20 ticks/ 1 second, I don't know how to make that and I can't find the answer anywhere
4
Upvotes
3
u/NortWind Nov 12 '25
Here's a good source of reference.
1
u/dgendreau Nov 12 '25 edited Nov 12 '25
Go easy on yourself. Remember everyone sucks at what they are just learning how to do. ChatGPT knows how to write lua code for CC:Tweaked... You might try explaining what you want it to do and asking it to take a shot at writing the script and ask for extra comments to explain what each line does?
Example prompt: "I would like to write a script for ComputerCraft that prompts the user to enter a password and sends a redstone signal from the back for one second. can you show me how to do that?"
Result:
1
u/Pioepod Nov 12 '25
I made one like two years ago but I can’t find the save.
However I can give you the gist of what I did, and the way to think about coding that I’ve learned.
First step is figure out what you wanna do, this is what my brother, a real web developer has taught me -
Based on your answers you want this:
That’s the first part, it’s pretty simple, right? Now that you know that this is the tedious part. It requires a bunch of googling, but you don’t need anything to specifically tell you here’s the code. Of course you can use Chat GPT, if you want, and don’t care about the actual coding part, but I mean, then what’s the fun in learning Lua for computer craft? I digress.
You essentially need a few conditionals and variables.
You need a variable that is the password you set in the program itself. Then you need a variable that is based on the user’s input.
Now you then need to write a conditional that basically does the third and fourth steps above linked to to the redstone function.
You can look every single one of these things up. How to write variables in lua. How to use if/then/else statements, computercraft function. It’s how I did it, it was fun, and I finally was able to trap my cultist.
After that it’s just mostly debugging for missed syntax errors or whatever. If you wanna get complex, or add flair, you can. It’s easier to discover funny functions through experimentation.
1
u/SamirG569 Jan 12 '26
redstone.setOutput("side", true)
ab = true
while ab == true do