Posted 07 April 2014 - 08:18 PM
Hey everybody out there
I am not new with computercraft as I have been with it since the good old days of tekkit but I haven't actually done much programming on the computers and now I am trying to implement a new ID system for a bank setup I am making.
this is the code
term.setCursorPos(1,1)
print("Please Input ID#")
input = os.pullEvent("char")
if input == ("1") then
ID#1()
elseif input == ("2") then
ID#2()
elseif input == ("3") then
ID#3()
else
print("Please Re-enter Your ID#")
sleep(1)
end
end
function ID#1()
print("Accessing Account Info")
term.clear()
term.setCursorPos(1,1)
print("Hello MB55177")
term.setCursorPos(6,1)
print("Your Account is as follows…")
term.setCursorPos(8,2)
print("Maximum Security Level")
term.setCursorPos(9,3)
print("Crafting Enabled")
end
function Id#2()
print("please contact your system administrator")
sleep(2)
shutdown()
end
function Id#3()
print("please contact your system administrator")
sleep(2)
shutdown()
end
this is as far as I have gotten but every time I try to run it, it just errors : "bios:339: [string "id-system3"]:8: '=' expected"
but I cannot work out what I have done wrong
HELP???
edit: I found that by taking away the #'s in the function name's solved the problem, I then cleaned up the code a bit an after that I thought it was working but it then came up with a different error which I am now working through. here is the new code and the problem
Problem: "bios:339: [string "id-system4"]:5: '' expected"
and the code:
"id
id=function ()
while true do
term.clear()
term.setCursorPos(1,1)
print("Please Input ID#")
r = os.pullEvent("char")
if r == ("1") then
Identification1()
elseif r == ("2") then
Identification2()
elseif r == ("3") then
Identification3()
else
print("Please enter Your ID#")
end
end
function Identification1()
while true do
print("Accessing Account Info")
term.clear()
term.setCursorPos(1,1)
print("Hello MB55177")
term.setCursorPos(6,1)
print("Your Account is as follows…")
term.setCursorPos(8,2)
print("Maximum Security Level")
term.setCursorPos(9,3)
print("Crafting Enabled")
sleep(3)
end
end
function Identification2()
while true do
Print("please contact system administrator")
sleep(2)
shutdown()
end
end
function Identification3()
while true do
Print("please contact you system administrator")
sleep(2)
shutdown()
end
end
end"
and id#1 is still the only one which works
I am not new with computercraft as I have been with it since the good old days of tekkit but I haven't actually done much programming on the computers and now I am trying to implement a new ID system for a bank setup I am making.
this is the code
term.setCursorPos(1,1)
print("Please Input ID#")
input = os.pullEvent("char")
if input == ("1") then
ID#1()
elseif input == ("2") then
ID#2()
elseif input == ("3") then
ID#3()
else
print("Please Re-enter Your ID#")
sleep(1)
end
end
function ID#1()
print("Accessing Account Info")
term.clear()
term.setCursorPos(1,1)
print("Hello MB55177")
term.setCursorPos(6,1)
print("Your Account is as follows…")
term.setCursorPos(8,2)
print("Maximum Security Level")
term.setCursorPos(9,3)
print("Crafting Enabled")
end
function Id#2()
print("please contact your system administrator")
sleep(2)
shutdown()
end
function Id#3()
print("please contact your system administrator")
sleep(2)
shutdown()
end
this is as far as I have gotten but every time I try to run it, it just errors : "bios:339: [string "id-system3"]:8: '=' expected"
but I cannot work out what I have done wrong
HELP???
edit: I found that by taking away the #'s in the function name's solved the problem, I then cleaned up the code a bit an after that I thought it was working but it then came up with a different error which I am now working through. here is the new code and the problem
Problem: "bios:339: [string "id-system4"]:5: '' expected"
and the code:
"id
id=function ()
while true do
term.clear()
term.setCursorPos(1,1)
print("Please Input ID#")
r = os.pullEvent("char")
if r == ("1") then
Identification1()
elseif r == ("2") then
Identification2()
elseif r == ("3") then
Identification3()
else
print("Please enter Your ID#")
end
end
function Identification1()
while true do
print("Accessing Account Info")
term.clear()
term.setCursorPos(1,1)
print("Hello MB55177")
term.setCursorPos(6,1)
print("Your Account is as follows…")
term.setCursorPos(8,2)
print("Maximum Security Level")
term.setCursorPos(9,3)
print("Crafting Enabled")
sleep(3)
end
end
function Identification2()
while true do
Print("please contact system administrator")
sleep(2)
shutdown()
end
end
function Identification3()
while true do
Print("please contact you system administrator")
sleep(2)
shutdown()
end
end
end"
and id#1 is still the only one which works
Edited on 08 April 2014 - 05:09 PM