LBPHacker, on 24 April 2013 - 04:20 AM, said:
local oldCurBlink = term.setCursorBlink term.setCursorBlink = function() oldCurBlink(false) end local user = read()
Then where you want to have it blink use oldCurBlink(true)
There have been 469 items by remiX (Search limited from 10-February 22)
Posted by
remiX
on 24 April 2013 - 04:29 AM
in
Ask a Pro
LBPHacker, on 24 April 2013 - 04:20 AM, said:
local oldCurBlink = term.setCursorBlink term.setCursorBlink = function() oldCurBlink(false) end local user = read()
Posted by
remiX
on 24 April 2013 - 03:10 AM
in
Ask a Pro
Mackan90096, on 24 April 2013 - 03:04 AM, said:
function decrypt(str) local temp = "" for i = 1, str:len() do local char = str:sub(i,i) for i, v in pairs(lookup) do if v == char then temp = temp .. char break end end end return str end
Posted by
remiX
on 23 April 2013 - 09:26 AM
in
Ask a Pro
Posted by
remiX
on 23 April 2013 - 06:49 AM
in
Ask a Pro
local f = fs.open("startup","w")
w.write([[print"Starting...."
sleep(1)]]
)
w.close()
Posted by
remiX
on 23 April 2013 - 02:57 AM
in
Ask a Pro
LBPHacker, on 23 April 2013 - 02:44 AM, said:
local file2 = fs.open("users/"..usrName.."/bg", "r") local logoPath = file2.readLine() logo = paintutils.loadImage(logoPath) file2.close()
Therefor answers my question... Add some debug lines, try this: function login()
term.clear()
term.setCursorPos(math.floor(w-string.len("Logging in")/2), 1) -- was checking the length of Username: :?
write("Logging in")
term.setCursorPos(math.floor(w-string.len("Username:")/2), 4) -- you had the brackets wrong. you were using math.floor on an integer all the time, the /2 needs to be inside
write("Username: ")
local usrName = read()
term.setCursorPos(math.floor(w-string.len("Password:")/2), 6)
write("Password: ")
local pass = read("*")
if not fs.exists("users/"..usrName.."/"..usrName) then
term.clear()
term.setCursorPos(math.floor(w-string.len("Login failed"))/2, 2)
print("Login failed")
elseif fs.exists("users/"..usrName.."/"..usrName) then
-- if the username exists, shouldn't the bg file exist too?
local file2 = fs.open("users/"..usrName.."/bg", "r")
local logoPath = file2.readLine()
logo = paintutils.loadImage(logoPath)
file2.close()
local file = fs.open("users/"..usrName.."/"..usrName,"r") -- Only open if it exists..
local fileData = {} -- if the file has only the password, there is no point of this :P/>
for line in file.readLine do -- cleaner way, i think this is right. If not try adding the () after readLine
table.insert(fileData,line)
end
file.close()
local passFromFile = fileData[1]
if pass == passFromFile then
term.clear()
term.setCursorPos(math.floor(w-string.len("Login succeded!"))/2, 2)
print("Login succeded!")
else
term.clear()
term.setCursorPos(math.floor(w-string.len("Login failed!"))/2, 2)
print("Login failed!")
error( pass .. " - " .. passFromFile ) -- debug line, if it reaches here, check what the variables are
end
end
-- put this here so you don't have to repeat it all the time
sleep(1)
term.clear()
drawDesktop()
end
Posted by
remiX
on 22 April 2013 - 02:08 AM
in
Ask a Pro
local option1 = "1"
local describe1 = "1*"
local exit = "exit"
print("Welcome, customer.")
print("Please pick a card type to be burned: ")
print("")
print("1. Door Combo")
print("")
print("Add a '*' after your order to view product description.")
print("Example: '1*'")
print("")
term.write(">")
local input = read()
if input == option1 then
term.clear()
term.setCursorPos(1,1)
print("Burning Disk...")
sleep(5)
print("")
print("Please collect your disk at the door.")
disk.eject("back")
sleep(5)
os.shutdown()
elseif input == describe1 then
term.clear()
term.setCursorPos(1,1)
print("Door Combination Lock")
print("Censors input characters with stars.")
print("Program termination locked without password.")
print("Automatic shutdown to reset program")
print("")
print("Type 'exit' to return to the main menu")
print("")
term.write(">")
local input = read()
if input == exit then
os.reboot()
end
end -- missing an end here
Posted by
remiX
on 21 April 2013 - 03:29 PM
in
Forum Discussion
Posted by
remiX
on 21 April 2013 - 12:47 PM
in
Ask a Pro
SuicidalSTDz, on 21 April 2013 - 12:00 PM, said:
Freack100, on 21 April 2013 - 09:37 AM, said:
SuicidalSTDz, on 21 April 2013 - 08:35 AM, said:
Posted by
remiX
on 21 April 2013 - 10:04 AM
in
Ask a Pro
local var = "sup" moo = true if moo then local ifvalue = "what?" print(ifvalue) -- "what?" for i = 1, 2 do local test = "yeah!" print(test) -- "yeah!" end print(tostring(test)) -- nil! end print(tostring(ifvalue) -- nil!
