Posted 25 July 2012 - 06:46 PM
I have a script with a create account function and when i select that one option i get a blank screen and a number at the end. Can any one help?
Code:
Code:
function os.pullEvent()
local cEvent, p1, p2, p3, p4, p5 = os.pullEventRaw()
if cEvent == "terminate" then
end
return cEvent, p1, p2, p3, p4, p5
end
function getCenterX(sText)
local nWidth = term.getSize()
local x = math.floor(nWidth / 2) - math.floor(string.len(sText) / 2)
return x
end
function getCenterY()
local nWidth, nHeight = term.getSize()
local y = math.floor(nHeight / 2)
return y
end
function getRight(sText)
local nWidth = term.getSize()
local x = nWidth - string.len(sText)
return x + 1
end
function runMenu(mChoices, sMenuTitle)
local nSelection = 0
local bLoop = true
while bLoop do
term.clear()
term.setCursorPos(1, 1)
print(sMenuTitle)
print()
for nLine = 0, #mChoices do
local sLine = " "
if nSelection == nLine then
sLine = "> "
end
sLine = sLine .. mChoices[nLine]
print(sLine)
end
local nWidth, nHeight = term.getSize()
local y = nHeight
local x = getRight("LNET Technologies")
term.setCursorPos(x, y)
term.write("LNET Technologies")
local sEvent, nKey = os.pullEvent("key")
if nKey == 200 then
if mChoices[nSelection - 2] then
nSelection = nSelection - 2
end
elseif nKey == 208 then
if mChoices[nSelection + 2] then
nSelection = nSelection + 2
end
elseif nKey == 28 then
if mChoices[nSelection] then
bLoop = false
return nSelection
end
end
end
end
function menu()
repeat
if nMenuNum == 0 then
mChoices = {}
mActions = {}
mChoices[0] = "Login"
mChoices[1] = " "
if not fs.exists("/LNEX/data/retrieve/passuid") == true then
mChoices[2] = "Create Account"
mChoices[3] = " "
mChoices[4] = "Shutdown"
mChoices[5] = " "
mChoices[6] = "Reboot"
mActions[0] = function()
bMenuLoop = false
term.clear()
shell.run("/LNEX/Client/LNEX")
end
mActions[2] = function() nMenuNum = 1 end
mActions[4] = function()
term.clear()
os.shutdown()
end
mActions[6] = function()
term.clear()
os.reboot()
end
local nSelection = runMenu(mChoices, "LNEX Security Preface")
mActions[nSelection]()
else
mChoices[2] = "Shutdown"
mChoices[3] = " "
mChoices[4] = "Reboot"
mActions[0] = function() shell.run("/LNEX/Client/LNEX") end
mActions[2] = function()
term.clear()
os.shutdown()
end
mActions[4] = function()
term.clear()
os.reboot()
end
local nSelection = runMenu(mChoices, "LNEX Security Preface")
mActions[nSelection]()
end
elseif nMenuNum == 1 then
term.clear()
term.write("Hello")
end
until bMenuLoop == false
end
sleep(.5)
bMenuLoop = true
nMenuNum = 0
tChoices = {}
tActions = {}
menu()