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

basicaly, i suck :-) help me!

Started by mrcrocodile123, 17 July 2013 - 10:03 AM
mrcrocodile123 #1
Posted 17 July 2013 - 12:03 PM
i am trying to produce a password lock, but using a numberpad on an advanced monitor, however i am having some issues, i worked my way through all the errors and i believe it should work, however:

when i run the program, the display appears perfectly fine, numbers in the right place ect, BUT the monitor is completely unresponsive when you try and press on it? even after the fourth count still nothing happens?

please help! ive been working on this for ages!

http://pastebin.com/VCNY1Z1n
Lyqyd #2
Posted 17 July 2013 - 01:31 PM
The elseif at the end should probably be an if. You'll need another end preceding it. Also, "true" isn't a valid side.
mrcrocodile123 #3
Posted 17 July 2013 - 01:50 PM
thanks i will try this now, fingers crossed!
mrcrocodile123 #4
Posted 17 July 2013 - 02:51 PM
The elseif at the end should probably be an if. You'll need another end preceding it. Also, "true" isn't a valid side.

thanks for the reply, however there is still no response when the correct code is entered?

here is the corrected one (so far) http://pastebin.com/jh44ttjr
MKlegoman357 #5
Posted 17 July 2013 - 05:52 PM
When you redirect terminal to a monitor the "monitor_touch" event is not fired when you click a monitor. Instead it produces "mouse_click" event. "monitor_touch" event is fired when a monitor is attached to a computer but terminal is not redirected to it.

EDIT: This is not true. Sorry, got confused by "monitor" program (default for CC) :P/>. Never looked carefully into that.
ZagKalidor #6
Posted 17 July 2013 - 05:59 PM

if inp == 72 then
    term.setBackgroundColor(colors.green)
    redstone.setOutput("top",true)
    sleep(5)
    redstone.setOutput("top", true)
    inp = 1
    count = 0
    end

Could it be, that it depends on giving 2 times redstone.setOutput("top", true). Maybe you should turn off the power to the topside at the second call.
In that case, the power will always stay on, never turn off.
Mickvvt1 #7
Posted 17 July 2013 - 06:10 PM
There are some good youtube videos about them but..
Heres Mine

	
[color=#000000][color=#0000AA]os[/color][color=#66CC66].[/color]pullEvent[color=#66CC66]=[/color][color=#0000AA]os[/color][color=#66CC66].[/color]pullEventRaw[/color]
	
[color=#000000][color=#0000AA]print[/color][color=#66CC66]([/color][color=#FF6666]"Welcome To ...."[/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#0000AA]print[/color][color=#66CC66]([/color][color=#FF6666]"Im Sorry But This Area Is Private And Requires You To Have The Password"[/color][color=#66CC66])[/color][/color]
	
[color=#000000]pass[color=#66CC66]=[/color][color=#FF6666]'example'[/color][/color]
	
[color=#000000][color=#0000AA]write[/color][color=#66CC66]([/color][color=#FF6666]"Enter Password: "[/color][color=#66CC66])[/color][/color]
	
[color=#000000]input[color=#66CC66]=[/color][color=#0000AA]read[/color][color=#66CC66]([/color][color=#FF6666]"+"[/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#AA9900][b]if[/b][/color] input [color=#66CC66]==[/color] pass [color=#AA9900][b]then[/b][/color][/color]
	
[color=#000000]term[color=#66CC66].[/color]clear[color=#66CC66]([/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#0000AA]print[/color][color=#66CC66]([/color][color=#FF6666]"Access Granted"[/color][color=#66CC66])[/color][/color]
	
[color=#000000]rs[color=#66CC66].[/color]setOutput[color=#66CC66]([/color][color=#FF6666]"back"[/color][color=#66CC66],[/color] [color=#AA9900]true[/color][color=#66CC66])[/color][/color]
	
[color=#000000]sleep[color=#66CC66]([/color][color=#CC66CC]3[/color][color=#66CC66])[/color][/color]
	
[color=#000000]rs[color=#66CC66].[/color]setOutput[color=#66CC66]([/color][color=#FF6666]"back"[/color][color=#66CC66],[/color] [color=#AA9900]false[/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#0000AA]os[/color][color=#66CC66].[/color]reboot[color=#66CC66]([/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#AA9900][b]else[/b][/color][/color]
	
[color=#000000]term[color=#66CC66].[/color]clear[color=#66CC66]([/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#0000AA]print[/color][color=#66CC66]([/color][color=#FF6666]"Access Denied"[/color][color=#66CC66])[/color][/color]
	
[color=#000000]sleep[color=#66CC66]([/color][color=#CC66CC]2[/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#0000AA]os[/color][color=#66CC66].[/color]reboot[color=#66CC66]([/color][color=#66CC66])[/color][/color]
	
[color=#000000][color=#AA9900][b]end[/b][/color][/color]

  • os.pullEvent=os.pullEventRaw
  • print("Welcome To NpDruggies")
  • print("Im Sorry But This Area Is Private And Requires You To Have The Password")
  • pass='meplease'
  • write("Enter Password: ")
  • input=read("+")
  • if input == pass then
  • term.clear()
  • print("Access Granted")
  • rs.setOutput("back", true)
  • sleep(3)
  • rs.setOutput("back", false)
  • os.reboot()
  • else
  • term.clear()
  • print("Access Denied")
  • sleep(2)
  • os.reboot()
  • end
Lyqyd #8
Posted 17 July 2013 - 06:35 PM
When you redirect terminal to a monitor the "monitor_touch" event is not fired when you click a monitor. Instead it produces "mouse_click" event. "monitor_touch" event is fired when a monitor is attached to a computer but terminal is not redirected to it.

This is simply not true.
ZagKalidor #9
Posted 17 July 2013 - 07:06 PM
There are some good youtube videos about them but..
Heres Mine

Your password is overridden by simply one lever…
immibis #10
Posted 17 July 2013 - 10:31 PM
There are some good youtube videos about them but..
Heres Mine
I was about to fix your formatting, but then I noticed that you're using os.reboot() as a loop. Don't do that.
mrcrocodile123 #11
Posted 18 July 2013 - 04:47 AM
thanks for the responces everyone, i have redone the code slightly to make it seem more straight forward and work :D/>
however i am still having the same problems! the screen just seems to be completely unresponsive :(/>

http://pastebin.com/rf5HyH0L