r/ComputerCraft • • Jul 23 '21

I created some evil code :)

just run : pastebin jrauM127 startup

and reboot then enjoy :)

how to calculate password :ComputerID * 1253

you may also get around it in this way LINK

0 Upvotes

4 comments sorted by

View all comments

5

u/fatboychummy Jul 23 '21
  1. If startup exists, copy xyz startup will fail and a reboot will fix it.

  2. You only check for 6 disks, some people may have more than that (not to mention you don't look for startup.lua as well). You can do the following instead:

    local drives = {peripheral.find("drive")} for i = 1, #drives do local drive = drives[i] local mountPath = drive.getMountPath() if mountPath then fs.delete(fs.combine(mountPath, "startup")) fs.delete(fs.combine(mountPath, "startup.lua") end end

  3. os.pullEvent = os.pullEventRaw booring

Use pcall instead and when people try to terminate it print a message saying "haha screw you"

while true do
  pcall(function()
    -- all your code here except the os.pullEvent = os.pullEventRaw
  end
  printError("Ah so you really thought you could try that huh?")

  pcall(sleep, 5)
end

4. You only check for disks once, use disk event to listen for disk insertions.

You may wish to use parallel api to help with this.

...

It is 4am, why am I randomly helping make "evil code" aaaaghh

2

u/fisk1234ost Jul 30 '21
  1. even if it failed it doesn't matter because i run it in a shell.

  2. more then 6 disk drives connected to a computer then you are a try hard.

  3. this is the eazy way, and it doesn't effect the rest of the code like yours do.

  4. that might be a good point.

even if it failed it doesn't matter chat. Michael Reeves