Jump to content




Having trouble with a startup program...

help computer lua

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

#1 SovietRussianSpy

  • Members
  • 10 posts

Posted 17 June 2015 - 10:46 PM

I'm not every good with lua nor this mod but I have been learning a bit, so if you decide to help me please be patient with me. I made a program that opens a room with a password. The only problem is, is the chunk isn't loaded. The computer resets and anyone is able to anything they like, which isn't good. I knew how to fix startup where it runs the program, but that ran into it's own problems. Like not being able to enter the code: 1234 and being able to go back and edit the program or add anything I'd like. I just wanted to see if anyone knew a way to fix this problem. The links to the password program and startup program is lined in the word program.

#2 Quintuple Agent

  • Members
  • 107 posts
  • LocationThis page

Posted 17 June 2015 - 11:09 PM

The problem with you trying to exit out using your admin password is that once your door script has stopped, your run command in your startup file is in a loop and so it will run it again, you can just remove the loop and have the run command. Since the main part of your door program is in a while loop it should keep running until you call error() (you could also just use return )
Also another tip, in your code for correct password (123) you should have it reset x to 1

Edit: I just remembered that cc has that pesky terminate keypress <_< however you can avoid the termination by putting
local oldEve = os.pullEvent
os.pullEvent = os.pullEventRaw
at the top of your code, this is make it so the termination event will not work
Then before you exit your script you can do
os.pullEvent = oldEve
to change it back to normal

And yet another edit: I noticed that the code already has the os.pullEventRaw, good, however it is a good idea to save the old pullEvent then return it to normal, so that still stands.

Ex:
Spoiler

Edited by Quintuple Agent, 17 June 2015 - 11:26 PM.


#3 SovietRussianSpy

  • Members
  • 10 posts

Posted 17 June 2015 - 11:57 PM

Thanks so much for your help.

View PostQuintuple Agent, on 17 June 2015 - 11:09 PM, said:

The problem with you trying to exit out using your admin password is that once your door script has stopped, your run command in your startup file is in a loop and so it will run it again, you can just remove the loop and have the run command. Since the main part of your door program is in a while loop it should keep running until you call error() (you could also just use return )
Also another tip, in your code for correct password (123) you should have it reset x to 1

Edit: I just remembered that cc has that pesky terminate keypress <_< however you can avoid the termination by putting
local oldEve = os.pullEvent
os.pullEvent = os.pullEventRaw
at the top of your code, this is make it so the termination event will not work
Then before you exit your script you can do
os.pullEvent = oldEve
to change it back to normal

And yet another edit: I noticed that the code already has the os.pullEventRaw, good, however it is a good idea to save the old pullEvent then return it to normal, so that still stands.

Ex:
Spoiler
Thanks so much for your help.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users