Jump to content




[Solved]--Help please!


  • You cannot reply to this topic
8 replies to this topic

#1 sabian8

  • New Members
  • 51 posts
  • LocationEngland

Posted 29 March 2012 - 06: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


#2 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 29 March 2012 - 06: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

#3 EatenAlive3

  • New Members
  • 53 posts

Posted 29 March 2012 - 06: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


#4 Advert

    Custom Title

  • Moderators
  • 459 posts
  • LocationLondon

Posted 29 March 2012 - 07:00 PM

View Postsabian8, on 29 March 2012 - 06:15 PM, said:

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.

#5 sabian8

  • New Members
  • 51 posts
  • LocationEngland

Posted 30 March 2012 - 06:27 AM

Ok thanks!

#6 sabian8

  • New Members
  • 51 posts
  • LocationEngland

Posted 30 March 2012 - 06:34 AM

View PostAdvert, on 29 March 2012 - 07:00 PM, said:

View Postsabian8, on 29 March 2012 - 06:15 PM, said:

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.

#7 sabian8

  • New Members
  • 51 posts
  • LocationEngland

Posted 31 March 2012 - 02:27 PM

Please help.I added some new code to the post.

#8 EatenAlive3

  • New Members
  • 53 posts

Posted 31 March 2012 - 02:50 PM

Fixed:
Spoiler

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.

#9 sabian8

  • New Members
  • 51 posts
  • LocationEngland

Posted 31 March 2012 - 05:00 PM

Thanks everyone! :o/> especially EatenAlive3





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users