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

[Computer][Turtle] BlackRa1n's Programs V1.75 .:. CubicMiner .:. Anti-Virus Restore .:. Password Door Lock .:. More Soon! .:.

Started by BlackRa1n, 24 March 2012 - 01:27 PM
BlackRa1n #1
Posted 24 March 2012 - 02:27 PM
.: BlackRa1n's Programs :.


Program List:
  • Virus [BackUp]
  • Anti-Virus [Restore]
  • Password Door Lock
  • CubicMiner
  • More Soon!*
* = Not yet finished!


Each program has it's own spoiler which includes a brief description and the code for the program. Just follow the easy steps inside the spoiler and you'll be using my programs in no time at all!


VIRUS [BACKUP]:
SpoilerAs explained by the title, this is a virus that backs-up a file. The file it backs-up is the 'startup' file, which is where the virus itself installs on the 'startup' file. It backs-up 'startup' because many people might have a code that they have been working on for awhile in 'startup' only to get ruined whilst they were testing my virus. To restore the backed-up file, however, you will need my ANTI-VIRUS [RESTORE] which is inside the next spoiler!


  1. Insert a Floppy Disk into Disk Drive
  2. Type: cd disk
  3. Type: edit virus
  4. Put in the following code… (I suggest opening up the 'virus' file in 'NotePad++' so much easier)

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("HackedOS 1.3") -- Message that pops up (You can edit it) --
print("error:os.startup:99999: blackra1n has got you") -- Message that pops up (You can edit it) --
sleep(7)
os.shutdown()


5. Save 'virus' and exit it back to cd disk
6. Type: edit install
7. Put in the following code…


term.clear()
term.setCursorPos(1,1)
fs.delete('startupb')
if fs.exists('startup') then
fs.copy('startup','startupb')
print("Installing:")
sleep(2)
print("20% Complete!")
sleep(1)
print("30% Complete!")
sleep(2)
print("50% Complete!")
sleep(3)
print("80% Complete!")
sleep(2)
print("100% Complete!")
fs.delete("startup")
fs.copy("/disk/virus","startup")
textutils.slowPrint("Virus Install Successful!")
sleep(2)
textutils.slowPrint("Terminal will now reboot!")
sleep(2)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Installing:")
sleep(2)
print("20% Complete!")
sleep(1)
print("30% Complete!")
sleep(2)
print("50% Complete!")
sleep(3)
print("80% Complete!")
sleep(2)
print("100% Complete!")
fs.copy("/disk/virus","startup")
textutils.slowPrint("Virus Install Successful!")
sleep(2)
textutils.slowPrint("Terminal will now reboot!")
sleep(2)
os.reboot()
end

You have now created the virus! To install it, type: disk/install
Remember, although it now backsup, you will need the ANTI-VIRUS [RESTORE] on another Floppy Disk to restore it.


ANTI-VIRUS [RESTORE]:
SpoilerAs explained in the title, this is a Anti-Virus that not only gets rid of your virus, it also restores the previous 'startup' file. However, this will only restore the file if you use my VIRUS [BACKUP] program which gives you a virus and backs-up your old 'startup'

	if fs.exists('startupb') then
	   fs.delete("startup")
	   fs.copy("startupb","startup")
	   term.clear()
	   term.setCursorPos(1,1)
	   print("BlackRa1n Anti-Virus 1.0")
	   print("-----------------------------")
	   print("")
	   print("All Infected Files Removed From System!")
	   print("System will now reboot!")
	   disk.eject("right") -- Remember to change this to the direct of your Disk Drive --
	   sleep(7)
	   os.reboot()
	else
	  term.clear()
	  term.setCursorPos(1,1)
	  print("BlackRa1n Anti-Virus 1.0")
	  print("-----------------------------")
	  print("")
	  f = io.open("startup","w")
	  f:write("")
	  f:close()
	  print("All Infected Files Removed From System!")
	  print("System will now reboot!")
	  disk.eject("right") -- Remember to change this to the direction of your Disk Drive --
	  sleep(7)
	  os.reboot()
	end
	

You have created the anti-virus! Now, once you infect your teminal with the VIRUS [BACKUP] and then insert this into the Disk Drive, the computer will be cleaned and restored to it's former glory!

Password Door Lock:
SpoilerAs stated in the title, this is a program that will lock your doors with passwords. The program starts as soon as the computer is turned on and cannot be terminated. Everything the user types into the computer also comes out as ***'s, so nobody can look over your shoulder and see the password!

  1. Insert a Floppy into the Disk Drive
  2. Type: cd disk
  3. Type: edit startup
  4. Input the following code… (I suggest opening up 'disk/startup' in NotePad++, so much easier)
  5. Turn on the Computer/Terminal (Make sure it is next to a door, preferably 'Iron Door')
  6. Type: edit startup
  7. Input the following code… (I'd open 'startup' in NotePad++, so much easier)

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("BlackRa1n Anti-Grief Lock")
print("-----------------------------")
print("")
print("Please Enter Password: ")
p = read("*")
if p == 'lol123' then -- 'lol123' can be changed to whatever you want the password to be! --
print("")
textutils.slowPrint(". . .")
print("")
sleep(3)
print("Password Correct! You may enter!")
rs.setOutput("right", true) -- Change 'right' to whatever side the door is to your computer --
sleep(3)
rs.setOutput("right", false) -- Change 'right' to whatever side the door is to your computer --
else
print("")
textutils.slowPrint(". . .")
sleep(3)
print("")
print("Password Incorrect! Please Try Again!")
sleep(3)
end
os.reboot()

Now reboot the computer and huzzah! You have a password door lock!



CubicMiner V1:
SpoilerAs the title suggests, this is a program the makes a turtle mine in a cube! The program lets you input the width, length and depth of the cube, so it is fuly customizable! This program was designed by Evan and then edited by me! I have full permisison to use his code, as it says in his own thread, I am just putting it under a thread with more view/posts/programs, so people become more aware of him and his programs, if he ever to make any more. I have also added a but more of a instuctional and clearer interface!
  1. Open up a tutle.
  2. Type: edit CubicMiner
  3. Input the following code… (Use NotePad++, so much easier!)

term.clear()
term.setCursorPos(8,6)
print("Loading Cubic Miner...")
sleep(3)
term.clear()
term.setCursorPos(8,6)
textutils.slowPrint(".: Written by Evan :.")
term.setCursorPos(5,7)
textutils.slowPrint(".: Modified by BlackRa1n :.")
sleep(4)
term.clear()
term.setCursorPos(1,1)
print("BlackRa1n Inc. CubicMiner V1")
print("---------------------------------")
sleep(2)
print("")
textutils.slowPrint("Please enter full numbers only!")
sleep(2)
textutils.slowPrint("Zero counts as a full number!")
sleep(2)
textutils.slowPrint("You can also use negative numbers!")
sleep()
term.clear()
term.setCursorPos(1,1)
print("BlackRa1n Inc. CubicMiner V1")
print("---------------------------------")
sleep(2)
print("Desired Blocks Dug Forwards: ")
input = read()
dz = tonumber(input)
if dz==0 then
 dz0 = true
 turned = false
else
 dz0 = false
 turned = false
end
if dz<0 then
 downZ = true
else
 downZ = false
end
if dz<0 then
 dz = dz*-1
end
sleep(2)
textutils.slowPrint("Registered!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
print("BlackRa1n Inc. CubicMiner V1")
print("---------------------------------")
sleep(2)
print("")
print("Desired Blocks Dug Right: ")
input = read()
dx = tonumber(input)
if dx<0 then
 downX = false
elseif dx>0 then
 downX = true
end
if dx<0 then
 dx = dx*-1
end
if dz0 == true then
 dx = dx
else
 dx = dx + 1
end
sleep(2)
textutils.slowPrint("Registered!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
print("BlackRa1n Inc. CubicMiner V1")
print("---------------------------------")
sleep(2)
print("")
print("Desired Blocks Dug Down/Up: ")
input = read()
dy = tonumber(input)
if dy<0 then
 downY = true
 dy = dy
else
 downY = false
 dy = dy
end
if dy<0 then
 dy = dy*-1
end
dy = dy + 1
print("Starting...")
if downZ == true then
 turtle.turnRight()
 turtle.turnRight()
 if downX == true then
  downX = false
 else
  downX = true
 end
end
for y=1,dy do
 for x=1,dx do
  if dz0 == true then
   
   if downX == false then
	if turned == false then
	 turtle.turnLeft()
	 turned = true
	end
	turtle.dig()
	turtle.forward()
   else
	if turned == false then
	 turtle.turnRight()
	 turned = true
	end
	turtle.dig()
	turtle.forward()
   end
  else
   
   
   if (x % 2) == 0 then
	odd = false
   else
	odd = true
   end
   for z=1,dz do
	while turtle.detect() do
	 turtle.dig()
	end
	turtle.forward()
   end
   if odd == false then
	if downX == true then
	  turtle.turnLeft()
	 else
	  turtle.turnRight()
	end
	if  x == dx then
	else
	 while turtle.detect() do
	  turtle.dig()
	 end
	 turtle.forward()
	end
	if downX == true then
	 turtle.turnLeft()
	else
	 turtle.turnRight()
	end
	
   elseif odd == true then
	if downX == true then
	  turtle.turnRight()
	 else turtle.turnLeft()
	end
	if x == dx then
	else
	 while turtle.detect() do
	  turtle.dig()
	 end
	turtle.forward()
	end
	if downX == true then
	  turtle.turnRight()
	 else turtle.turnLeft()
	end
   end
  end
 end 
 if y==dy then
 else
  if downY == true then
   while turtle.detectDown() do
   turtle.digDown()
   end
   turtle.down()
  else
   while turtle.detectUp() do
   turtle.digUp()
   end
   turtle.up()
  end
 end
end

There you go! You now have a fully fuctioning, cube mining Turtle!



Licence:


I could not care less what you did with these, aslong as you don't edit the code and repost it as your own without giving me credit.


Quick Note:


Hey guys,

I would love it if you could reply and give me some feedback on my programs or if that seems to long and boring just click the little green arrow in the bottom right of my post! It would help alot!

Also, if you end up running around with my virus on SMP, I would love it if you installed it on peoples computers and tell me their reactions :(/>/>
xDeathwing #2
Posted 24 March 2012 - 04:14 PM
Cool thanks.
BlackRa1n #3
Posted 24 March 2012 - 04:31 PM
No worries! :(/>/>
Espen #4
Posted 24 March 2012 - 05:25 PM
NOTE: This Virus completely writes over your startup file and will delete any code in it. I am working on a version which backs up the startup code first and then gets restored by the anti-virus.
Lol, a considerate virus. What a gentleman, hehe. :(/>/>
I'm aware it's just for testing purposes, but taken out of context this just made me chuckle.^^
Ian-Moone #5
Posted 24 March 2012 - 05:28 PM
come on!
BlackRa1n #6
Posted 24 March 2012 - 05:28 PM
NOTE: This Virus completely writes over your startup file and will delete any code in it. I am working on a version which backs up the startup code first and then gets restored by the anti-virus.
Lol, a considerate virus. What a gentleman, hehe. :(/>/>
I'm aware it's just for testing purposes, but taken out of context this just made me chuckle.^^

Heh :D/>/>
I might have one that doesn't make a backup so you can really annoy people on SMP :)/>/>
It is just for testing purposes, as you said, but I still think it can be fun to use! :)/>/>

come on!

Come on what?
Espen #7
Posted 24 March 2012 - 05:33 PM
Oh no, I didn't mean to suggest any change at all, just wanted do say how it made my day.^^ Not saying it's ridiculous or something, just amusing. :(/>/>
(Or did I misunderstand your misunderstanding? Bah, words…. so limited. : )
BlackRa1n #8
Posted 24 March 2012 - 05:35 PM
Oh no, I didn't mean to suggest any change at all, just wanted do say how it made my day.^^ Not saying it's ridiculous or something, just amusing. :(/>/>
(Or did I misunderstand your misunderstanding? Bah, words…. so limited. : )

I know you didn't, but I think one that doesn't back-up would also be a good idea as it is more realistic :)/>/>
BlackRa1n #9
Posted 24 March 2012 - 10:21 PM
[VERSION 1.2]
+ Added BackUp &amp; Restore! Read OP for details!
+ Changed Thread title. Will now hold all my programs!
Wired2coffee #10
Posted 25 March 2012 - 09:59 AM
I like it, keep going. Le bump.
BlackRa1n #11
Posted 25 March 2012 - 10:00 AM
I aim to please! :(/>/>
I'll be adding my 'Door Lock' soon…
BlackRa1n #12
Posted 25 March 2012 - 12:09 PM
[VERSION 1.5]

+ Added 'Password Door Lock' (See OP)
- Fixed various typos
glitchdetector #13
Posted 25 March 2012 - 01:49 PM
I must say i like the way you faked the loading in the door lock.
Keep it up!
BlackRa1n #14
Posted 25 March 2012 - 01:51 PM
I must say i like the way you faked the loading in the door lock.
Keep it up!

Thanks! By the loading do you mean the '. . .' part?
Kadecamz #15
Posted 25 March 2012 - 10:24 PM
Can you use the txt to program in multiplayer? And does the password door work on turtles? Because the server I'm on whenever I place a cd drive, it turns into a modem.
BlackRa1n #16
Posted 25 March 2012 - 10:32 PM
Can you use the txt to program in multiplayer? And does the password door work on turtles? Because the server I'm on whenever I place a cd drive, it turns into a modem.

The Disk Drive &amp; Modem bug in Multiplayer has already been reported on the forums and should eventually be looked into.
As for your question, the text can be used on multiplayer yes (As long as you aren't using a CD Drive/Or get CD Drive to work) and it would depend what you wanted to do with the turtle and program…
BlackRa1n #17
Posted 26 March 2012 - 09:02 PM
[VERSION 1.75]:

+ CubicMiner (See OP)
- Fixed various typos
ComputerCraftFan11 #18
Posted 26 March 2012 - 09:06 PM
In your virus code, can you make it copy itself into startup?

So if I save the file in disk/startup, the computer will boot from the disk and not stop (even if you inject it)
BlackRa1n #19
Posted 26 March 2012 - 09:11 PM
I think so, feel free to modify it so it does that :o/>/>
ComputerCraftFan11 #20
Posted 26 March 2012 - 09:19 PM
Done, I merged the installer and the virus:

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("HackedOS 1010101001010101.2") – Message that pops up (You can edit it) –
print("error:os.startup:99999: blackra1n has got you") – Message that pops up (You can edit it) –
fs.delete("startup")
fs.copy("disk/startup", "startup")
sleep(7)
os.shutdown()
BlackRa1n #21
Posted 26 March 2012 - 09:29 PM
Ok, neat! :o/>/>
What you gonna test it on? I would suggest trying it on SMP :o/>/>
ComputerCraftFan11 #22
Posted 26 March 2012 - 09:34 PM
Ok, neat! :o/>/>
What you gonna test it on? I would suggest trying it on SMP :o/>/>

I had this really good SMP server that I played on but its down and I can't find any other creative CC servers
BlackRa1n #23
Posted 26 March 2012 - 09:39 PM
Yeah, I have that problem, it is pretty annoying. This mod has such good multiplayer compatability, but nobody uses it! D:
ComputerCraftFan11 #24
Posted 26 March 2012 - 09:40 PM
Yeah, I have that problem, it is pretty annoying. This mod has such good multiplayer compatability, but nobody uses it! D:

Too bad my router doesn't allow port forwarding :o/>/> (I do have a hamachi server but nobody really likes hamachi)
BlackRa1n #25
Posted 26 March 2012 - 09:43 PM
Well, I have Hamachi!
If you wanna play sometime just say, I only have CC though, no RedPower, IC, BuildCraft etc.
ComputerCraftFan11 #26
Posted 26 March 2012 - 09:47 PM
Well, I have Hamachi!
If you wanna play sometime just say, I only have CC though, no RedPower, IC, BuildCraft etc.

K
BlackRa1n #27
Posted 26 March 2012 - 09:49 PM
Well, I have Hamachi!
If you wanna play sometime just say, I only have CC though, no RedPower, IC, BuildCraft etc.

K

Just out of interest, because I have no intention of doing it now, but would you mind if I added the virus script you edited into my OP?
ComputerCraftFan11 #28
Posted 26 March 2012 - 09:52 PM
Well, I have Hamachi!
If you wanna play sometime just say, I only have CC though, no RedPower, IC, BuildCraft etc.

K

Just out of interest, because I have no intention of doing it now, but would you mind if I added the virus script you edited into my OP?


I'm fine with that, heres a backup version:
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("HackedOS 1010101001010101.2") – Message that pops up (You can edit it) –
print("error:os.startup:99999: blackra1n has got you") – Message that pops up (You can edit it) –s
fs.copy("startup", "disk/startupb")
fs.delete("startup")
fs.copy("disk/startup", "startup")
sleep(7)
os.shutdown()
BlackRa1n #29
Posted 26 March 2012 - 09:55 PM
Well, I have Hamachi!
If you wanna play sometime just say, I only have CC though, no RedPower, IC, BuildCraft etc.

K

Just out of interest, because I have no intention of doing it now, but would you mind if I added the virus script you edited into my OP?


I'm fine with that, heres a backup version:
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("HackedOS 1010101001010101.2") – Message that pops up (You can edit it) –
print("error:os.startup:99999: blackra1n has got you") – Message that pops up (You can edit it) –s
fs.copy("startup", "disk/startupb")
fs.delete("startup")
fs.copy("disk/startup", "startup")
sleep(7)
os.shutdown()

Thanks! :o/>/>
Just to let you know, I might soon be changing the VIRUS [BACKUP] and ANTI-VIRUS [RESTORE] soon, so that they both run off the same floppy and have a menu saying 'Install Virus', 'Remove Virus' and 'Exit'. That way I'll able to have the backup on the same disk as the Anti-Virus, making it more convinient :o/>/>
Turtlemoviesco #30
Posted 28 March 2012 - 02:31 AM
Can someone please tell me, how I would open it in notepad++.
I know this is a noob question but please just me how to do it.
Turtlemoviesco #31
Posted 28 March 2012 - 02:33 AM
I saw people wanting a server with computercraft? My server uses tekknik pack for its client if anyone wants a server.
BlackRa1n #32
Posted 28 March 2012 - 08:35 PM
Can someone please tell me, how I would open it in notepad++.
I know this is a noob question but please just me how to do it.

Too open up a program in NotePad++, go to your '.minecraft' and into your 'saves' folder to select your world. Once in your world's folder, select 'computer' and find the id of your computer (It'll be a number!). Then open the folder with the ID of your computer with the program on and click on the program name.
Because it is a 'FILE' it won't have a program that will automatically open it, probably. It will bring up a list from which you may select NotePad++ from.
If it does automatically open in a program other than NotePad++, then right click on the 'FILE' and select properties. There is an option near the top of the window that'll pop up that'll let you select the program! :o/>/>
Turtlemoviesco #33
Posted 28 March 2012 - 09:11 PM
Can someone please tell me, how I would open it in notepad++.
I know this is a noob question but please just me how to do it.

Too open up a program in NotePad++, go to your '.minecraft' and into your 'saves' folder to select your world. Once in your world's folder, select 'computer' and find the id of your computer (It'll be a number!). Then open the folder with the ID of your computer with the program on and click on the program name.
Because it is a 'FILE' it won't have a program that will automatically open it, probably. It will bring up a list from which you may select NotePad++ from.
If it does automatically open in a program other than NotePad++, then right click on the 'FILE' and select properties. There is an option near the top of the window that'll pop up that'll let you select the program! :o/>/>

THANK YOU!
BlackRa1n #34
Posted 28 March 2012 - 09:16 PM
Can someone please tell me, how I would open it in notepad++.
I know this is a noob question but please just me how to do it.

Too open up a program in NotePad++, go to your '.minecraft' and into your 'saves' folder to select your world. Once in your world's folder, select 'computer' and find the id of your computer (It'll be a number!). Then open the folder with the ID of your computer with the program on and click on the program name.
Because it is a 'FILE' it won't have a program that will automatically open it, probably. It will bring up a list from which you may select NotePad++ from.
If it does automatically open in a program other than NotePad++, then right click on the 'FILE' and select properties. There is an option near the top of the window that'll pop up that'll let you select the program! :o/>/>

THANK YOU!

No worries! :o/>/>
Here to help! Let me know how you get on with my programs! :)/>/>
tjeulink #35
Posted 01 April 2012 - 08:32 AM
awesome job blackrain!
BlackRa1n #36
Posted 01 April 2012 - 06:59 PM
awesome job blackrain!

Thanks! :)/>/>
BlackRa1n #37
Posted 02 April 2012 - 09:25 PM
Sorry for my inactivity on the forums. I am developing more programs, but I cannot develop for the rest of the week as I am on holiday. I hope you all have a fun week and enjoy your Easter! :)/>/>