Jump to content




Run a floppy disk during a while loop?


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

#1 oyasunadev

  • New Members
  • 1 posts

Posted 05 November 2012 - 12:48 PM

Okay, so lets say I have a computer that has a while loop that asks for a password. So I don't want to destroy that computer, but I want to run code from a disk while the other program is up, without having to reboot the computer. Is this possible? Some kind of virus?

#2 Mitchfizz05

  • Members
  • 125 posts
  • LocationAdelaide, Australia

Posted 25 November 2012 - 09:23 PM

I think you would need to look into the parallel API; I don't know much about the parallel API though.

#3 JoshhT

  • New Members
  • 64 posts
  • LocationAustralia

Posted 25 November 2012 - 09:33 PM

You might want to look into the disk API.

Something like this.

driveSide = "left"
while true do
  if disk.isPresent(driveSide) and disk.hasData(driveSide) then
    os.run({}, "program on disk")
    sleep(1)
    disk.eject(driveSide)
  end
sleep(2)
end


#4 Laserman34170

  • New Members
  • 34 posts
  • LocationProgramming Land

Posted 26 November 2012 - 05:31 AM

Use the parallel API.http://computercraft...?title=Parallel
function disk()
  -- do the disk running stuff here
end


function pass()
  -- do the pass stuff here
end

while true do
  parallel.waitForAny(disk, pass)
end


#5 ChunLing

  • Members
  • 2,027 posts

Posted 26 November 2012 - 07:05 AM

Isn't the whole point of having a password loop to prevent the computer from doing anything until the password is entered?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users