51 posts
Location
England
Posted 29 March 2012 - 07:15 PM
I need help with a antivirus program i am making its probably full of mistakes since i am new to lua but please help.
term.clear
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Anti-Virus 2.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint ("Virus's detected, Do you wish to terminate them?,WARNING will destroy start files!")
local keyword = "yes"
local keyword2 = "no"
ek== io.read()
if
ek==keyword
then
fs.delete startup
else
print("?")
end
end
Please could somebody help with this code? i am having trouble with this also.
term.clear()
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Computer Hacker v1.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint("Initiate Hacking?")
local keyword = "yes"
local ek = io.read()
if ek==keyword then
fs.delete("startup")
print("Login file successfuly terminated")
print("Rebooting in 2 seconds")
sleep(1)
disk.eject("right")
sleep(1)
os.reboot
else
print("?")
sleep(1)
term.clear()
term.setCursorPos(1,1)
end
473 posts
Location
Poland
Posted 29 March 2012 - 07:18 PM
Corrected the code, should work.
term.clear()
term.setCursorPos(1,1)
print("————————————————–")
print(" Anti-Virus 2.1")
print("————————————————–")
print(" ")
print("Loading…")
sleep(2)
print(" ")
textutils.slowPrint("Virus's detected, Do you wish to terminate them?,WARNING will destroy start files!")
local keyword = "yes"
local keyword2 = "no"
ek== io.read()
if ek==keyword then
fs.delete("startup")
else
print("?")
end
53 posts
Posted 29 March 2012 - 07:42 PM
That one won't work, you missed the "ek==io.read()". Code fixed:
term.clear()
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Anti-Virus 2.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint("Virus's detected, Do you wish to terminate them?,WARNING will destroy start files!")
local keyword = "yes"
local keyword2 = "no"
local ek = io.read()
if ek==keyword then
fs.delete("startup")
else
print("?")
end
454 posts
Location
London
Posted 29 March 2012 - 08:00 PM
I need help with a antivirus program i am making its probably full of mistakes since i am new to lua but please help.
term.clear
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Anti-Virus 2.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint ("Virus's detected, Do you wish to terminate them?,WARNING will destroy start files!")
local keyword = "yes"
local keyword2 = "no"
ek== io.read()
if
ek==keyword
then
fs.delete startup
else
print("?")
end
end
In the future, please read the announcement(s), and title your topic appropriately.
51 posts
Location
England
Posted 30 March 2012 - 07:27 AM
Ok thanks!
51 posts
Location
England
Posted 30 March 2012 - 07:34 AM
I need help with a antivirus program i am making its probably full of mistakes since i am new to lua but please help.
term.clear
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Anti-Virus 2.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint ("Virus's detected, Do you wish to terminate them?,WARNING will destroy start files!")
local keyword = "yes"
local keyword2 = "no"
ek== io.read()
if
ek==keyword
then
fs.delete startup
else
print("?")
end
end
In the future, please read the announcement(s), and title your topic appropriately.
Sorry I didn't know what to call it.
51 posts
Location
England
Posted 31 March 2012 - 03:27 PM
Please help.I added some new code to the post.
53 posts
Posted 31 March 2012 - 03:50 PM
Fixed:
Spoiler
term.clear()
term.setCursorPos(1,1)
print("--------------------------------------------------")
print(" Computer Hacker v1.1")
print("--------------------------------------------------")
print(" ")
print("Loading...")
sleep(2)
print(" ")
textutils.slowPrint("Initiate Hacking?")
local keyword = "yes"
local ek = io.read()
if ek==keyword then
fs.delete("/rom/startup")
print("Login file successfuly terminated")
print("Rebooting in 2 seconds")
sleep(1)
disk.eject("right")
sleep(1)
os.reboot()
else
print("?")
sleep(1)
term.clear()
term.setCursorPos(1,1)
end
What you missed:
- "startup" doesn't exist. "/rom/startup" exists.
- os.reboot doesn't mean anything. You have to put os.reboot()
Should work, although I haven't tested it.
51 posts
Location
England
Posted 31 March 2012 - 06:00 PM
Thanks everyone! :o/>/> especially EatenAlive3