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

Non-specific thread hijack question about a password program

Started by kaioo1312, 03 September 2013 - 01:52 PM
kaioo1312 #1
Posted 03 September 2013 - 03:52 PM
I have re written the program

Request Thread Close
Lyqyd #2
Posted 03 September 2013 - 04:10 PM
Split into new topic.

There's a sticky post with the title "New Members needing to ask questions, please read" for a reason. You should have read it.
LBPHacker #3
Posted 03 September 2013 - 05:14 PM
Holy cow, did you (and the others who post code like that) actually format the code yourself?! Anyways, that won't work because the entire structure of the program… the IF-ELSE-END blocks are off. They should look like the example here. One IF, then an expression, then THEN, then something which executes if expression evaluates true, then END. And by the way, use locals. ComputerCraft runs the Lua programming language - it's not a bad idea to learn the basics of Lua before getting started with ComputerCraft.

And use CODE tags:
they're displaying the code in wrong highlighting, but at least they look like actual code
12th button on the lower toolbar, the one which looks like this: <>. You click on it, you paste the code, and magic happened. Then you can see that codes are enclosed by "code" and "/code" (inside brackets).
theoriginalbit #4
Posted 04 September 2013 - 03:37 AM
Then you can see that codes are enclosed by "code" and "/code" (inside brackets).
The way I like to type it now-a-days is [code][/code] :)/> less explaining :P/>

Why wont this work
What exactly about it wont work? Is it an error? does it not behave as expected?
kaioo1312 #5
Posted 04 September 2013 - 12:23 PM
there is an error that there is no end to close if on line 26 (if im correct) and i dont know how to fix it and it would be much apretiated if sombody can

ps i tried the 'Read before you post topic'

thanks if someone can help
theoriginalbit #6
Posted 04 September 2013 - 12:48 PM
there is an error that there is no end to close if on line 26 (if im correct) and i dont know how to fix it and it would be much apretiated if sombody can

Anyways, that won't work because the entire structure of the program… the IF-ELSE-END blocks are off. They should look like the example here. One IF, then an expression, then THEN, then something which executes if expression evaluates true, then END. And by the way, use locals. ComputerCraft runs the Lua programming language - it's not a bad idea to learn the basics of Lua before getting started with ComputerCraft.
kaioo1312 #7
Posted 04 September 2013 - 01:08 PM
there is an error that there is no end to close if on line 26 (if im correct) and i dont know how to fix it and it would be much apretiated if sombody can

Anyways, that won't work because the entire structure of the program… the IF-ELSE-END blocks are off. They should look like the example here. One IF, then an expression, then THEN, then something which executes if expression evaluates true, then END. And by the way, use locals. ComputerCraft runs the Lua programming language - it's not a bad idea to learn the basics of Lua before getting started with ComputerCraft.


Yes ok but what do you mean by the structure of the proram
kaioo1312 #8
Posted 04 September 2013 - 03:00 PM
This program works but i want to be able to go back to the last option(Type yes to turn on or type no to turn off) because if you type one option you have to go through the program again(also if you get a input wrong) So apprechiated if anyone knows the code here is my original code
www.pastebin.com/s6wCPAq5

or text


code = ("mrw12m1")
pass=("nuke")
on=("yes")
off=("no")
function codecheck()
term.clear()
term.setCursorPos(12,1)
print("Security Access Console")
term.setCursorPos(12,2)
print("Enter The Seven Digit Code")
input=read("*")
if input == (code) then
term.clear()
term.setCursorPos(12,1)
print("Security Systems Protaol File...")
term.setCursorPos(12,2)
textutils.slowPrint("Security Protocal, System Initalizing")
term.setCursorPos(12,3)
textutils.slowPrint("Standby Code Confirmed")
term.setCursorPos(12,4)
textutils.slowPrint("System Initalized")
sleep(2)
term.setCursorPos(12,5)
textutils.slowPrint("A.D.S Is Now On Standby")
term.setCursorPos(12,6)
textutils.slowPrint("Enter Password")
input=read("*")
if input == (pass) then
  term.clear()
  term.setCursorPos(12,1)
  print("A.D.S Is Now Ready!")
  term.setCursorPos(12,2)
  sleep(1)
  print("Type Yes To Activate")
  term.setCursorPos(12,3)
  print("Type No TO Deactivate")
  input=read()
   if input == (on) then
    print("A.D.S On!")
    else
    if input==(off) then
    print("A.D.S Off!")
   end
    end
  else
  print("wrong password")
  end
else
print("wrong code")
end
end
  codecheck(
Edited by
Lyqyd #9
Posted 04 September 2013 - 05:22 PM
Threads merged. Please stick to one thread for all questions about a specific program or piece of code.
Tiin57 #10
Posted 04 September 2013 - 06:38 PM
Please fix your formatting; that is unreadable code.
campicus #11
Posted 04 September 2013 - 09:20 PM
You really have trouble with the code tags don't you?

Lyqyd #12
Posted 04 September 2013 - 09:38 PM
I applied some code tags to the latest post with code.
kaioo1312 #13
Posted 05 September 2013 - 10:48 AM
Please fix your formatting; that is unreadable code.
Please fix your formatting; that is unreadable code.


Umm again i am new to lua/computercraft/coding so i have no idea what mast of the stuff means like 'formating' please explain