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

[Solved]--Help please!

Started by sabian8, 29 March 2012 - 05:15 PM
sabian8 #1
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
Liraal #2
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
EatenAlive3 #3
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
Advert #4
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.
sabian8 #5
Posted 30 March 2012 - 07:27 AM
Ok thanks!
sabian8 #6
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.
sabian8 #7
Posted 31 March 2012 - 03:27 PM
Please help.I added some new code to the post.
EatenAlive3 #8
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.
sabian8 #9
Posted 31 March 2012 - 06:00 PM
Thanks everyone! :o/>/> especially EatenAlive3