Jump to content




Need help implementing password protection into "Slots" Game


  • You cannot reply to this topic
1 reply to this topic

#1 Codyth

  • New Members
  • 1 posts

Posted 20 January 2013 - 02:34 AM

Hello. I've been trying really hard lately to take a simple door lock with a masterpassword (It unlocks the pc allowing you to run programs)... I've been trying to input it somewhere into this code found here : http://pastebin.com/6egT38Jq ...I've been trying to put this :
masterpassword = "hco"
prizeamount = 10
detectside = "front"
monside = "right"
dispenserside = "bottom"
showloser = true

mon = peripheral.wrap(monside)
shell.run("clear",1)
mon.clear()
mon.setCursorPos(1,1)
mon.write(" Put")
mon.setCursorPos(1,2)
mon.write("Diamond")
mon.setCursorPos(1,3)
mon.write("In Chest")
mon.setCursorPos(1,4)
mon.write("To Play")
os.pullEvent = os.pullEventRaw
print("Password Lock by Cody and Neil")
write"Enter Password: "
local input = read("*")

if input == (masterpassword) then
term.clear()
term.setCursorPos(1,1)
print("Access Granted. Welcome master")
sleep(1)
print("Make your motherfucking changes.")
sleep(2)
term.clear()
term.setCursorPos(1,1)
return

else --
term.clear()
term.setCursorPos(1,1)
print("Password Incorrect")
sleep(1)

end


Into the first little bit of the Slots game, I get it to work, but then the game doesnt work. Is there any way that I can be able to password protect the program or make it only so I am able to get into it? I'm REAAALLY new to Computercraft but I'm trying....

Its not working as in, the numbers wont output on the monitor, so I think its not reading passed the first 41 lines of code...Because nothing happens, at all.

This is where I got to...http://pastebin.com/AEpLUDZN

#2 lieudusty

  • Members
  • 419 posts

Posted 20 January 2013 - 04:52 AM

Well wrap the slots thing into a big function and when the password is correct then it will run the function.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users