Difference between revisions of "Talk:Making a Password Protected Door"

From ComputerCraft Wiki
Jump to: navigation, search
(Troubleshooting: new section)
m (Reverted edits by 83.169.89.163 (talk) to last revision by Thesbros)
 
(14 intermediate revisions by 9 users not shown)
Line 1: Line 1:
  
== Re: "Make code better, again" ==
+
== Rewriting Page ==
 +
This page needs a rewrite. I am currently working on one, you can see the progress [http://thesbros.koding.com/lua/cc.php here]. It may not be updated for a while since I am quite busy right now. If anyone could rewrite this page with pictures, better code, and clean it up a bit, then that would be awesome. --[[User:Thesbros|Thesbros]]
  
How is it 'better' to leave the computer running when it's not needed?
+
== Debug Password ==
Assuming this is the desired behaviour, why is it 'better' to reboot the computer each time instead of using a loop?
+
And assuming ''that'' is the desired behaviour, why is it 'better' to have the call to os.reboot() repeated inside the if blocks instead of once after the if?<small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:2.102.58.164|2.102.58.164]] ([[User talk:2.102.58.164|talk]] • [[Special:Contributions/2.102.58.164|contribs]]) </span></small><!-- Template:Unsigned -->
+
  
:Loop uses more memory. Also, there's no difference, do you really care that much? <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:24.20.22.206|24.20.22.206]] ([[User talk:24.20.22.206|talk]] • [[Special:Contributions/24.20.22.206|contribs]]) </span></small><!-- Template:Unsigned -->
+
If you still want to be able to edit the startup file after using "os.pullEvent = os.pullEventRaw", add near the top of your code, under your password:
::I reverted changes from two users. This guide is supposed to be a reasonably low level tutorial. Simply slapping code on a page is not a tutorial, hence the previous version with screen shots is more noob friendly. Secondly, the latter version used variables that don't need to be variables. [[Special:Contributions/121.45.75.253|121.45.75.253]] 14:07, 16 April 2012 (UTC)
+
  
== I think this can be more "Noob" friendly ==
+
local debug = "pass"
  
i am a noob and have just started to use Computer Craft. I was learning how to make a password protected lock and i understood all of it, until it said, " Now to start it, we have the computer call the function after it declares it." This confused me very much and i was hoping someone could clarify or edit the page to be even more "Noob" friendly. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Tpomdreams|Tpomdreams]] ([[User talk:Tpomdreams|talk]] • [[Special:Contributions/Tpomdreams|contribs]]) </span></small><!-- Template:Unsigned -->
+
you can replace "pass" with whatever you want but keep the "s.
 +
Now, after the first "os.reboot()", put an "end" there.
 +
Below that put:
  
:Try the 'Better / Alternative Code', you might understand that more. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:24.20.22.206|24.20.22.206]] ([[User talk:24.20.22.206|talk]] • [[Special:Contributions/24.20.22.206|contribs]]) </span></small><!-- Template:Unsigned -->
+
if input == (debug) then
 +
  term.clear()
 +
  term.setCursorPos(1,1)
  
== Needs work ==
+
then put your "else" and everything where you need to put it.
  
Should be formatted better and especially with the code and the comments.
+
Hope this helps
 
+
== Troubleshooting ==
+
 
+
I used the "Better/Alternative" code and when I start the computer all I get is "bios:206: [string "startup"]:16: '=' expected". Any idea what this means? Any way to fix it?
+

Latest revision as of 16:14, 4 December 2012

Rewriting Page

This page needs a rewrite. I am currently working on one, you can see the progress here. It may not be updated for a while since I am quite busy right now. If anyone could rewrite this page with pictures, better code, and clean it up a bit, then that would be awesome. --Thesbros

Debug Password

If you still want to be able to edit the startup file after using "os.pullEvent = os.pullEventRaw", add near the top of your code, under your password:

local debug = "pass"

you can replace "pass" with whatever you want but keep the "s. Now, after the first "os.reboot()", put an "end" there. Below that put:

if input == (debug) then

 term.clear()
 term.setCursorPos(1,1)

then put your "else" and everything where you need to put it.

Hope this helps