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

[Lua][Error]When trying to start a program I only get back a number

Started by sebbeviper, 29 June 2012 - 12:41 AM
sebbeviper #1
Posted 29 June 2012 - 02:41 AM
Hey again! I'm trying to make a password protected door lock but can't get any of the programs i found to work.

Here is the script from the wiki that i just copied straight out. when i start the program I get a random number between 58-70.

local side = "left" -- Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though
local password = "bacon" -- Change bacon to what you want your password to be. Be sure to leave the "s around it, though
local opentime = 5 -- Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it, though
term.clear() -- Clears the screen
term.setCursorPos(1,1) -- Fixes the cursor position
write("Password: ") -- Prints 'Password: ' to the screen
local input = read("*") -- Makes the variable 'input' have the contents of what the user types in, the "*" part sensors out the password
if input == password then -- Checks if the user inputted the correct password
term.clear() -- Already explained up top
term.setCursorPos(1,1)
print("Password correct!") -- Prints 'Password correct!' to the screen
rs.setOutput(side,true) -- Output a redstone current to the side you specified
sleep(opentime) -- Wait the amount of seconds you specifed, then..
rs.setOutput(side,false) -- Stop outputting a redstone current
os.reboot() -- Reboot the computer, reopening the lock
else -- Checks if the user didn't input the correct password
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!") -- Prints 'Password incorrect!' to the screen
sleep(2) -- Waits 2 seconds
os.reboot() -- Reboot the computer, reopening the lock
end
MysticT #2
Posted 29 June 2012 - 02:47 AM
The code is fine, what do you get exactly? is it an error message (like bios:<somenumber>:[string "programname"]:<somenumber>:<Error Message>)?
sebbeviper #3
Posted 29 June 2012 - 03:16 AM
When I type in "lock" all I get back is a random number each time, like "66" and when i try it again i get like "59" and so on. Its wierd because it doesnt notify me about what the problem is.
sebbeviper #4
Posted 29 June 2012 - 03:18 AM
Accidental double post…
Luanub #5
Posted 29 June 2012 - 03:22 AM
Do a ctrl+r on the terminal to reboot it and then try again, that might help you to get the real error message instead of the number.
sebbeviper #6
Posted 29 June 2012 - 10:18 PM
I've tried on 2 different computers, and ive also tried to reboot it several times with several scripts. Nothing seems to work.