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

Disk Renamer v1

Started by B1N4RY, 19 July 2014 - 11:37 PM
B1N4RY #1
Posted 20 July 2014 - 01:37 AM
Hello guys, it's #4N0N B1N4RY here and in this thread i want to release my Super Simple Useless :D/> program

It is for renaming disks (Can choose side of drive)


os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Which position is your disk drive with desired disk placed ?\n(left, right, back, front, top, bottom)\n")
textutils.slowPrint("Position: ")
term.setCursorPos(11,5)
input2 = read()
nothin2 = ""
if input2 ~= nothin2 then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Welcome to disk renamer by #4N0N B1N4RY\nPlease type in disk name you want on disk in disk drive on ")
term.setCursorPos(10,3)
textutils.slowPrint(input2)
term.setCursorPos(1,5)
textutils.slowPrint("Name of disk: ")
term.setCursorPos(15,5)
input = read()
nothin = ""
if input ~= nothin then
disk.setLabel(input2,input)
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Disk renamed !")
sleep(1)
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Rebooting Computer and Ejecting disk")
sleep(1)
disk.eject("left")
disk.eject("right")
disk.eject("back")
disk.eject("front")
disk.eject("top")
disk.eject("bottom")
os.reboot()
else
textutils.slowPrint("\nDisk Label cannot be nothing")
sleep(2)
term.clear()
term.setCursorPos(1,1)
os.reboot()
end
end

Please don't hate :D/> It's my first program


Peace, B1N4RY
Have a nice day ^_^/>
sjonky #2
Posted 20 July 2014 - 03:36 PM
A pretty easy suggestion to your program, make the disk drive detection automatic. Hint: rs.getSides() and peripheral.getType(side)

And if you want a little more challenge, if multiple drives is detected. Make it ask which of those the user wants. Skipping all sides where there is nothing, or some other peripheral
Edited on 20 July 2014 - 01:42 PM
B1N4RY #3
Posted 20 July 2014 - 06:21 PM
A pretty easy suggestion to your program, make the disk drive detection automatic. Hint: rs.getSides() and peripheral.getType(side)

And if you want a little more challenge, if multiple drives is detected. Make it ask which of those the user wants. Skipping all sides where there is nothing, or some other peripheral

Thank you much for suggestions, i really appreciate it and i will try :)/> And i am coding in computercraft first time :D/> I started working on another program :)/>
It's instalator for instaling [SECRET THING] easier.
Win7yes #4
Posted 24 July 2014 - 02:45 AM
Suggestion Time:
Try not using too much textutils.slowPrint(string) for other projects/programs. Sometimes it can get annoying and slow.
Instead of rebooting the computer to close the program, you can do:

term.setBackgroundColor( colors.black )
term.clear()
term.setCursorPos( 1, 1 )
return
–SUGGESTION ENDS HERE–
Edited on 24 July 2014 - 12:46 AM