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

Clean Boot (Disk)

Started by TyDoesMC, 30 July 2013 - 05:44 PM
TyDoesMC #1
Posted 30 July 2013 - 07:44 PM
Hello, Toxic_Herobrine Here, I Made a Program (For a Disk) It Make's a Menu Pop Up When Executed, There Is: Clean Boot (Use After Recompiling), Recompile, Exit. Recompiling Delete's All Startup File's and then after You Recompile, Use Clean Boot To Start The Computer/Turtle Safely.

INFO:

I Will Not Be Updating This Code
Because It Will Work Even In MC 1.7.8 ( << Example)
And I Want To Make Other Program's.


local termWidth, termHeight = term.getSize()
local selectedItem = 1
local onMainMenu = true

function CleanBoot()
term.clear()
term.setCursorPos(1,1)
print("Clean Boot Selected")
print("Starting a Clean Startup File")
textutils.slowPrint("All Threat's Are 
Successfuly Gone!")
sleep(2)
onMainMenu = false
end 
function load()
print("Recompiling File's.")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's..")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's...")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's..")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's.")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's..")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's...")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's..")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("Recompiling File's.")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
fs.delete("startup")
print("All Modified Startup's Are Gone")
sleep(2)
end
function checkFiles()
term.clear()
term.setCursorPos(1,1)
load()
end
function Exit()
onMainMenu = false
end

mainMenu = {
[1] = { text = "Clean Boot (Use After 
Recompiling)", handler = CleanBoot },
[2] = { text = "Recompile", handler = checkFiles 
},
[3] = { text = "Exit", handler = Exit }
}

function printMenu( menu )
for i=1,#menu do
  if i == selectedItem then
   print(">> "..menu[i].text)
  else
   print("   "..menu[i].text)
  end
end
end

function onKeyPressed( key, menu )
if key == keys.enter then
  onItemSelected(menu)
elseif key == keys.up then
  if selectedItem > 1 then
   selectedItem = selectedItem - 1
  end
elseif key == keys.down then
  if selectedItem < #menu then
   selectedItem = selectedItem + 1
  end
end
end

function onItemSelected( menu )
menu[selectedItem].handler()
end

function main()
while onMainMenu do
  term.clear()
  term.setCursorPos(1,1)
  printMenu(mainMenu)
  event, key = os.pullEvent("key")
  onKeyPressed(key,mainMenu)
end
end

main()

Thank You! :D/>
TyDoesMC #2
Posted 30 July 2013 - 07:45 PM
Sorry About The Diffrant Font Size's I Dident Notice (My First Program)
TyDoesMC #3
Posted 30 July 2013 - 11:39 PM
Hello Every One! I Will Update This Program 3 Time's 1 (Done) 2 (add a Write/Print Only) 3 (Clickable Button's)!!!!!
Dave-ee Jones #4
Posted 31 July 2013 - 03:10 AM
I recognised this menu as FunShineX's menu tutorial…It's a useful menu, the first one I learnt.
TyDoesMC #5
Posted 31 July 2013 - 03:18 AM
Yes It Is, FunshineX Is An Awesome Coder…. Wanna Start a Coding Team That Makes CC Codes? Im Really Good ^ First One ^
jesusthekiller #6
Posted 31 July 2013 - 04:26 AM
You program is in 90% bunch of pointless sleeps!

People hate pointless sleeps.
svdragster #7
Posted 31 July 2013 - 04:51 AM
13 Seconds of waiting ._.
Nice program though
jesusthekiller #8
Posted 31 July 2013 - 05:00 AM
Also, he could not just do sleep(13)?

He cleans and rewrites text in same place every second…
TheOddByte #9
Posted 31 July 2013 - 10:33 AM
And why did you not use a for loop or something instead? .-.

Example

function clear()
  term.clear()
  term.setCursorPos(1,1)
end

for i = 1, 13 do
 clear()
 write("Recompiling files.")
 sleep(.8)
 clear()
 write("Recompiling files..")
 sleep(.8)
 clear()
 write("Recompiling files...")
 sleep(.8)
end
Just that would shorten the code alot ;)/>

But ofcourse noone wants to wait so long so you should probably shorten the sleep times.
TyDoesMC #10
Posted 31 July 2013 - 01:44 PM
Sorry, Im a Newbie And I Dont Know Loops That Good And No I Wanted The Thing To Go "Example." "Example,." "Example…"

Ok Thank You For The Help @hellkid98
TyDoesMC #11
Posted 03 August 2013 - 05:04 PM
Hello Every One The Update Will Not Be Out Untill My Computer Is Fixed Or i Goto My friends… Sorry.
TyDoesMC #12
Posted 05 August 2013 - 04:57 PM
Hello, This Is My Clean Boot Update For Terminal Only (AKA) Write Only, Not a GUI, It Adds New Feature's.

I Am Currently On a Ubuntu Boot Disk Meaning I Cant download Or Play MC So Please Test This For Me, I Am Updating This Version To Have Better User Friendlyness Lol Thank You.



--[[ Clean Boot ]]--
-- Terminal Version
--[[ Functions ]]--
function rLoad()
for i=4 do
print("Recompiling.")
sleep(1)
print("Recompiling..")
sleep(1)
print("Recompiling...")
sleep(1)
print("Recompiling..")
sleep(1)
print("Recompiling.")
sleep(1)
end
function rDo()
fs.delete("startup")
end
function mkNew()
print("Deleting startup...")
sleep(2)
fs.delete("startup")
sleep(1)
print("Making a New startup")
sleep(2)
fs.makeDir("startup")
sleep(1)
print("Finished!")
sleep(1)
end
function mvTo()
print("Moving Startup To a Disk...")
sleep(2)
fs.move("startup disk/startup")
sleep(2)
print("Finished!")
sleep(1)
end
function exit()
print("Shutting Down!")
sleep(3)
os.reboot()
end
end
--[[ Code ]]--
N = "Clean Boot"
NV = "Terminal V1.0"
OS = "Computercraft OS"
O = "Boot, Recompile, Make New, Move To, Exit"
print(N)
print(NV)
print(OS)
input = read()
write("Clean Boot: ")
if input == "Option's" then
print(O)
elseif input == "Boot" then
print("Booting Computer")
os.reboot()
elseif input == "Recompile" then
rLoad()
rDo()
elseif input == "Make New" then
mkNew()
elseif input == "Move To" then
mvTo()
elseif input == "Exit" then
exit()
end



I Am Updating This Version As You Read This And As I Type This!!! :)/> :D/> :D/> :)/> :lol:/> :lol:/>
TyDoesMC #13
Posted 05 August 2013 - 04:59 PM
UPDATED!!!!!

Link: http://www.computercraft.info/forums2/index.php?/topic/14569-clean-boot-terminal-update/
immibis #14
Posted 05 August 2013 - 05:20 PM
startup:5: ',' expected

Here's a better one:

if fs.exists("/startup") then
  if fs.exists("/oldstartup") then fs.delete("/oldstartup") end
  fs.move("/startup", "/oldstartup")
  print("Startup file disabled")
else
  print("No startup file")
end
TyDoesMC #15
Posted 05 August 2013 - 05:31 PM
Ok Thank You!!! :D/> :D/> :D/>

I Cant Test These And Ive Been Promising To Update So If You Could Redo It So It Works Then PM Me Some How Or Email Me It Ill Post It And Give You Credit!

Email: tyler_seymour@hotmail.co.uk

Thank You Again! :P/>
TyDoesMC #16
Posted 05 August 2013 - 06:07 PM
Official First CB With GUI!

Link: http://www.computercraft.info/forums2/index.php?/topic/14458-clean-boot-disk/
Lyqyd #17
Posted 05 August 2013 - 06:52 PM
Threads merged.
TheOddByte #18
Posted 06 August 2013 - 08:42 AM
Looked at your for loop where it prints 'Recompiling'
You put:

for i = 4 do

The loop needs a "Start value" and a "Finish value"

for i = 1, 4 do
jesusthekiller #19
Posted 06 August 2013 - 10:49 AM
Looked at your for loop where it prints 'Recompiling'
You put:

for i = 4 do

The loop needs a "Start value" and a "Finish value"

for i = 1, 4 do

And optional step value as 3rd arg.
TyDoesMC #20
Posted 06 August 2013 - 08:29 PM
Ok Thank You, I Just Learned About The for Loop Today/Last Night
TheOddByte #21
Posted 07 August 2013 - 08:38 AM
Looked at your for loop where it prints 'Recompiling'
You put:

for i = 4 do

The loop needs a "Start value" and a "Finish value"

for i = 1, 4 do

And optional step value as 3rd arg.
Yeah.. If he needs some examples for that here it is
Increasing:

for i = 1,20,5 do -- This would increase by 5 every time

Decreasing:

for i = 10, 0, -1 do -- This would decrease by 1 every time

Hope this was of any use! ;)/>
svdragster #22
Posted 07 August 2013 - 09:39 AM
I never ever understood how for worked, but now suddenly I'm almost only using it.
You just have to try around with it and see what it exactly does!
TyDoesMC #23
Posted 01 November 2013 - 12:59 PM
Hello, Im Sorry To Say That This Is For Anyone To Upate/Keep Because I Can No Longer Find The Time To Update Or Make New Prorgrams As Long As This One So Anyone Who Would Like To Update It Feel Free, I Curretly Have 1 Computer Availabel For Playing Minecraft To Make Code's But Sadly Most Of The New Programs I Make Get Locked Because Of 2 Programs I Made Were Not Tested And Now The Admins Think All Programs I Post Are Not Tested, I Want To Thank Them For Doing There Job I Know What Could Go Wrong If I Post Untested Code And People Use It, But The Last 1 Or 2 Programs I Made Were In fact Tested But Got Locked, So Now Ill Only Be Posting Smaller Coded Programs That Are Easy To See That They Were Tested.

ps:

Admins Feel Free To Lock This For Some Reason IDC But For The Person Who Will Take This Program Into There Own Hands Please PM Me To Let Me Know Who You Are.

– Toxic_Herobrine
TyDoesMC #24
Posted 04 November 2013 - 05:54 PM
startup:5: ',' expected

Here's a better one:

if fs.exists("/startup") then
  if fs.exists("/oldstartup") then fs.delete("/oldstartup") end
  fs.move("/startup", "/oldstartup")
  print("Startup file disabled")
else
  print("No startup file")
end

Oh My God, I Am Blind… Immibis *Has a seizure* Omg You Made The Best Peripheral Ever!!!!!! :D/> You Commented On My Program! *Rolls Over And Dies*