2 questions,
Trying to rm startup gives me access denied (on my server, if that helps). How do I get it done?
How do I get the computer to detect disks I put into a drive, determine if the password is written there and opens the door accordingly?
If 'rm' does that, check the directories. I should have mentioned this but when you put '..' when explaining directories it means up one, so '../../rom' means up two and into rom. Also check the server's CC version and make sure you're 'rm'ing the startup (if it's there) in the computer's root (pretty much '..' until you hit "Not a directory").
To detect disks is with the "disk" event in 'os.pullEvent()'. Perhaps I should do a tutorial on pullEvents? It runs like this:
while true do
event, param = io.pullEvent()
if event == "disk" then
print("The disk was inserted!")
sleep(2)
print("Ejecting...")
disk.eject(side) -- replace side with the side the disk drive is on
break -- stops the while loop
end
end
I also believe it is something like this you are wanting to do?
So I followed all of this pretty well, but now, I can still open and close my door without entering the password. How can I get it to not do this?
Thanks,
stea1th4
So I followed all of this pretty well, but now, I can still open and close my door without entering the password. How can I get it to not do this?
Thanks,
stea1th4
Well hi.
Your tutorials are great thanks!
But still i have an issue. Can you plase let me know if there's something wrong whit this code i wrote?
term.clear()
term.setCursorPos(1,1)
password = "INeedRedWool"
debug = "Let'sDebugThisThing"
write("Please,Enter the password here: ")
input = read()
term.clear()
term.setCursorPos(1,1)
if input == password then
print("Acces garanted, Unlocking red wool storage...")
sleep(2)
rs.setOutput("right",true)
sleep(1)
rs.setOutput("right",false)
term.clear()
term.setCursorPos(1,1)
print("The door is unlocked, Good day.")
sleep(5)
os.shutdown()
elseif input == debug then
print("Entering debug mode..)
sleep(3)
exit()
else
print("The password you entered is wrong. Emergency protocol activated")
sleep(3)
rs.setOutput("left",true)
sleep(1)
rs.setOutput("left"false)
sleep(2)
os.shutdown()
end
Thank you for your time and again, you are a great guy.
Check the 23rd line, the 'print("Entering debug mode..)'. You didn't end the string, make it 'print("Entering debug mode..")'.
Also, check the 12th line and its spelling, something you might want to fix .
Whenever I go exit the program and go into debug mode, I get this:
attempt to call nil
Anyone know why that is and how I could get it not to do that (I'm a bit OCD about esthetics)?
Also, I have been having the same problem with the yielding errors, I've tried using repeat loops, while true loops (with a closing break statement), and I have searched the Lua manual, but I couldn't find anything about passEvent(). Can you do a tutorial on it?
EDIT: After looking in the CC wiki I found my answers (derp)! So the error is caused by calling a variable or function not defined, which makes sense, a variable with no value is nil. Also, os.pullEvent() works so that whenever something happens and you call it, it outputs a string which describes the action. They are often used in while loops so they are always checking. Here's some example code:
-- Example use of os.pullEvent() --
while true do --Starts while loop
event = os.pullEvent() -- Assigns the event to variable "event"
if event ~= nil then -- If the even is nil (which is no event) then...
print(event) -- Print the event
sleep(1) -- Sleep 1 second (this keeps down the lag)
end
end
So, if your running this code and nothing is happening to the computer, it won't print anything. If you plug in a disk drive, it will print
key
If you put in a disk it will print
disk
If you take the disk out it will print
disk_eject
If you apply or remove a redstone current to the computer, it will print
redstone
Are there any other events? I just found these through trial and error.
EDIT: If a key is pressed, pullEvent outputs two values, "char" and the character of the key pressed.
Well, I have made a new code! YAY! And new issues! noo... But i don't like to stalk a single person whit my problems so i made a tread [here]. Hope it helps
Next, I need a clarification on some stuff but i'll ask in the link's topic. See you!
I cannot resist so i put the code here: (Note: it's VERY long)
term.clear
term.setCursorPos (1,1)
A=OpenReactorRoom
B=RefillReactor
C=EmergencyReactorStop
D=Done
Print("Reactor room safety protocol 0.01 running...")
sleep(2)
print("Welcome to the RRSP V.0.01")
sleep(1)
Print("What do you whis to do?")
sleep(1)
print("Spell "OpenReactorRoom" To access the reactor room.")
print("Spell "RefillReactor" to send a uranium cell to the reactor.")
print("Spell "EmergencyReactorStop" to stop the reactor and turn on the safety protocol")
write("What do you whant to do? : ")
imput = read()
if imput == A then
term.clear
term.setCursorPos(1,1)
print("Opening the reactor room...")
rs.setOutput("left",true)
sleep(1)
term.clear
ter.setCursorPos (1,1)
print("Door open. When you have done, spell "Done" and the door will close")
write("What do you whant to do? : ")
secondimput = read()
if secondimput == D then
term.clear
term.setCursorPos (1,1)
print("Closing the door...")
sleep(1)
rs.setOutput("left",false)
print("thank you for using the RRSP V. 0.01")
os.shutdown()
else
term.clear
term.setCursorPos (1,1)
print("Command incorrect, shutting down.")
rs.setOutput("right",false)
rs.setOutput("left",false)
rs.setOutput("up",false)
rs.setOutput("down",false)
rs.setOutput("back",false)
sleep(2)
os.shutdown()
end
else
term.clear
term.setCursorPos (1,1)
print("Command incorrect, shutting down.")
rs.setOutput("right",false)
rs.setOutput("left",false)
rs.setOutput("up",false)
rs.setOutput("down",false)
rs.setOutput("back",false)
sleep(2)
os.shutdown()
elseif imput == B
term.clear
term.setCursorPos (1,1)
print (Refilling the reactor whit a new uranium cell..)
rs.setOutput("right",true)
sleep (1)
rs.setOutput("right",false)
print ("the cell is entering the reactor. Tank you for using the RRSP V 0.01")
sleep (2)
os.shutdown()
elseif imput == C
term.clear
term.setCursorPos (1,1)
print ("Shutting down the reactor...)
rs.setOutput("up",true)
sleep (1)
term.clear
term.setCursorPos (1,1)
print ("The reactor is turned off. When you whis to turn it back on, spell "Done"")
write ("What do you whant to do? : ")
tirdimput = read()
if tirdimput == D
term.clear
term.setCursorPos (1,1)
print ("Turinng the reactor on again, please stand by...")
rs.setOutput("up",false)
sleep(2)
term.clear
term.setCursorPos (1,1)
else
term.clear
term.setCursorPos (1,1)
print("Command incorrect, shutting down.")
rs.setOutput("right",false)
rs.setOutput("left",false)
rs.setOutput("up",false)
rs.setOutput("down",false)
rs.setOutput("back",false)
sleep (2)
os.shutdown()
end
else
term.clear
term.setCursorPos (1,1)
print("Command incorrect, shutting down.")
rs.setOutput("right",false)
rs.setOutput("left",false)
rs.setOutput("up",false)
rs.setOutput("down",false)
rs.setOutput("back",false)
sleep (2)
os.shutdown()
end
Those first lines with the A=, B=, etc., those all have to be made into strings. Also, you didn't close a string somewhere, but try finding it yourself as learning to read code and finding its errors is a pretty important skill (hint, check the highlighting in the code's spoiler or in your IDE).
Imma need help editing my startup. It refuses to let me do anything except view the code. I was making a public terminal that I wanted to have say "type door to open door" (doing so will pulse some redstone in front of the computer and shutdown)
i did it, came up with "Please Input Password", i typed in cheese, got "Access Granted, door opened, but it wouldn't close again, and i got:
startup:15:nil:attempt to call nil.
what did i do wrong?
whenever i try to do "rm ../../../startup"
no quotes it says "delete:9: Invalid path
or cp lock.lua ../../../startup
please help i'm a noob i am on tekkit multiplayer server if it helps
Quick question about the way something here works:
At one point in the first post, near where "elseif" is first brought in, it gives a debug password to get past the password program, which should run "exit()", the exact coding being:
elseif input == debug then
exit() --Exits the program
Taken right out of your post.
When I attempt to input the debug password, it gives me an error:
Password.lua:18: attempt to call nil
Is this what "exit()" is supposed to do? For reference, Password.lua is just what I decided to call the file, you told us to call it something else.
Edit: Okay, got another one:
In the "So, how does that help?" section you mention "../../../startup". Are the ".."s meant to be replaced by whatever the file path is? Putting:
rm ../../../startup
into the computer as soon as it boots gives the error "delete:9: Invalid Path
If it's not that the ".." are meant to be replaced, what am I doing wrong? Nevermind, I understand. The ".." means go up one directory.
New question then: I occasionally get an error that say "bios:206:" followed by messages which vary depending on what I've been messing with. Can anyone tell me why I'm getting that error?
Rollback Post to RevisionRollBack
These maps are super hostile, Their creator is evil (that's a good thing), And THE CAKE IS A LIE.---I use Map Generators! Bored of normal Minecraft? Try them!
Quick question about the way something here works:
At one point in the first post, near where "elseif" is first brought in, it gives a debug password to get past the password program, which should run "exit()", the exact coding being:
elseif input == debug then
exit() --Exits the program
Taken right out of your post.
When I attempt to input the debug password, it gives me an error:
Password.lua:18: attempt to call nil
Is this what "exit()" is supposed to do? For reference, Password.lua is just what I decided to call the file, you told us to call it something else.
Edit: Okay, got another one:
In the "So, how does that help?" section you mention "../../../startup". Are the ".."s meant to be replaced by whatever the file path is? Putting:
rm ../../../startup
into the computer as soon as it boots gives the error "delete:9: Invalid Path
If it's not that the ".." are meant to be replaced, what am I doing wrong? Nevermind, I understand. The ".." means go up one directory.
New question then: I occasionally get an error that say "bios:206:" followed by messages which vary depending on what I've been messing with. Can anyone tell me why I'm getting that error?
Yes, actually the exit() is a typo. Yes, it technically exits the script which we want, but not quite the right way.
Right now I can't recall the right command, but there's often a way to just break all loops and just exit. I'll get back on that command.
The BIOS error could be an installation problem. Other than that, I don't know; sorry!
If 'rm' does that, check the directories. I should have mentioned this but when you put '..' when explaining directories it means up one, so '../../rom' means up two and into rom. Also check the server's CC version and make sure you're 'rm'ing the startup (if it's there) in the computer's root (pretty much '..' until you hit "Not a directory").
To detect disks is with the "disk" event in 'os.pullEvent()'. Perhaps I should do a tutorial on pullEvents? It runs like this:
I also believe it is something like this you are wanting to do?
Thanks,
stea1th4
Try using an iron door instead of a wooden?
Thanks, but it still doesn't work. It makes it hard because they need a pressure plate or lever in order to open it, but still.
stea1th4
try placing blocks around of which redstone can't be placed
What do you mean?
The exact video I watched.
EDIT: Also, it's the latest CC and it denies access when I try editing startup too..
Check the 23rd line, the 'print("Entering debug mode..)'. You didn't end the string, make it 'print("Entering debug mode..")'.
Also, check the 12th line and its spelling, something you might want to fix .
Thanks for the comment!
Anyone know why that is and how I could get it not to do that (I'm a bit OCD about esthetics)?
Also, I have been having the same problem with the yielding errors, I've tried using repeat loops, while true loops (with a closing break statement), and I have searched the Lua manual, but I couldn't find anything about passEvent(). Can you do a tutorial on it?
EDIT: After looking in the CC wiki I found my answers (derp)! So the error is caused by calling a variable or function not defined, which makes sense, a variable with no value is nil. Also, os.pullEvent() works so that whenever something happens and you call it, it outputs a string which describes the action. They are often used in while loops so they are always checking. Here's some example code:
So, if your running this code and nothing is happening to the computer, it won't print anything. If you plug in a disk drive, it will print
If you put in a disk it will print
If you take the disk out it will print
If you apply or remove a redstone current to the computer, it will print
Are there any other events? I just found these through trial and error.
EDIT: If a key is pressed, pullEvent outputs two values, "char" and the character of the key pressed.
Those first lines with the A=, B=, etc., those all have to be made into strings. Also, you didn't close a string somewhere, but try finding it yourself as learning to read code and finding its errors is a pretty important skill (hint, check the highlighting in the code's spoiler or in your IDE).
Not necessarily. That doesn't matter because he's just making that a variable.
I am a noob at this so I would appreciate all the help, thanks
startup:15:nil:attempt to call nil.
what did i do wrong?
no quotes it says "delete:9: Invalid path
or cp lock.lua ../../../startup
please help i'm a noob i am on tekkit multiplayer server if it helps
At one point in the first post, near where "elseif" is first brought in, it gives a debug password to get past the password program, which should run "exit()", the exact coding being:
elseif input == debug then
exit() --Exits the program
Taken right out of your post.
When I attempt to input the debug password, it gives me an error:
Password.lua:18: attempt to call nil
Is this what "exit()" is supposed to do? For reference, Password.lua is just what I decided to call the file, you told us to call it something else.
Edit: Okay, got another one:
Nevermind, I understand. The ".." means go up one directory.In the "So, how does that help?" section you mention "../../../startup". Are the ".."s meant to be replaced by whatever the file path is? Putting:
rm ../../../startup
into the computer as soon as it boots gives the error "delete:9: Invalid Path
If it's not that the ".." are meant to be replaced, what am I doing wrong?
New question then: I occasionally get an error that say "bios:206:" followed by messages which vary depending on what I've been messing with. Can anyone tell me why I'm getting that error?
Yes, actually the exit() is a typo. Yes, it technically exits the script which we want, but not quite the right way.
Right now I can't recall the right command, but there's often a way to just break all loops and just exit. I'll get back on that command.
The BIOS error could be an installation problem. Other than that, I don't know; sorry!
PLEAS HELP I HAVE NO IDEA WHAT TO DO!