Jump to content




Non-specific thread hijack question about a password program



  • You cannot reply to this topic
12 replies to this topic

#1 KDJSAIUH

  • Members
  • 35 posts

Posted 03 September 2013 - 02:52 PM

I have re written the program

Request Thread Close

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 03 September 2013 - 03: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.

#3 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 03 September 2013 - 04: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).

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 02:37 AM

View PostLBPHacker, on 03 September 2013 - 04:14 PM, said:

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

View Postkaioo1312, on 03 September 2013 - 02:52 PM, said:

Why wont this work
What exactly about it wont work? Is it an error? does it not behave as expected?

#5 KDJSAIUH

  • Members
  • 35 posts

Posted 04 September 2013 - 11:23 AM

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

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 11:48 AM

View Postkaioo1312, on 04 September 2013 - 11:23 AM, said:

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

View PostLBPHacker, on 03 September 2013 - 04:14 PM, said:

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.


#7 KDJSAIUH

  • Members
  • 35 posts

Posted 04 September 2013 - 12:08 PM

View Posttheoriginalbit, on 04 September 2013 - 11:48 AM, said:

View Postkaioo1312, on 04 September 2013 - 11:23 AM, said:

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

View PostLBPHacker, on 03 September 2013 - 04:14 PM, said:

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

#8 KDJSAIUH

  • Members
  • 35 posts

Posted 04 September 2013 - 02: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, 04 September 2013 - 08:38 PM.
added code tags


#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 September 2013 - 04:22 PM

Threads merged. Please stick to one thread for all questions about a specific program or piece of code.

#10 Tiin57

    Java Lunatic

  • Members
  • 1,412 posts
  • LocationIndiana, United States

Posted 04 September 2013 - 05:38 PM

Please fix your formatting; that is unreadable code.

#11 campicus

  • Members
  • 164 posts

Posted 04 September 2013 - 08:20 PM

You really have trouble with the code tags don't you?

Posted Image

#12 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 September 2013 - 08:38 PM

I applied some code tags to the latest post with code.

#13 KDJSAIUH

  • Members
  • 35 posts

Posted 05 September 2013 - 09:48 AM

View Posttiin57, on 04 September 2013 - 05:38 PM, said:

Please fix your formatting; that is unreadable code.

View Posttiin57, on 04 September 2013 - 05:38 PM, said:

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





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users