Jump to content




Clean Boot (Disk)

api computer utility

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

#1 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 30 July 2013 - 06: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

#2 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 30 July 2013 - 06:45 PM

Sorry About The Diffrant Font Size's I Dident Notice (My First Program)

#3 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 30 July 2013 - 10: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)!!!!!

#4 Dave-ee Jones

  • Members
  • 456 posts
  • LocationVan Diemen's Land

Posted 31 July 2013 - 02:10 AM

I recognised this menu as FunShineX's menu tutorial...It's a useful menu, the first one I learnt.

#5 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 31 July 2013 - 02:18 AM

Yes It Is, FunshineX Is An Awesome Coder.... Wanna Start a Coding Team That Makes CC Codes? Im Really Good ^ First One ^

#6 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 31 July 2013 - 03:26 AM

You program is in 90% bunch of pointless sleeps!

People hate pointless sleeps.

#7 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 31 July 2013 - 03:51 AM

13 Seconds of waiting ._.
Nice program though

#8 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 31 July 2013 - 04:00 AM

Also, he could not just do sleep(13)?

He cleans and rewrites text in same place every second...

#9 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 31 July 2013 - 09: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.

#10 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 31 July 2013 - 12: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

#11 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 03 August 2013 - 04:04 PM

Hello Every One The Update Will Not Be Out Untill My Computer Is Fixed Or i Goto My friends... Sorry.

#12 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 05 August 2013 - 03: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:

#13 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 05 August 2013 - 03:59 PM

UPDATED!!!!!

Link: http://www.computerc...erminal-update/

#14 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 05 August 2013 - 04: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


#15 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 05 August 2013 - 04: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: [email protected]

Thank You Again! :P

#16 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 05 August 2013 - 05:07 PM

Official First CB With GUI!

Link: http://www.computerc...lean-boot-disk/

#17 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 August 2013 - 05:52 PM

Threads merged.

#18 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 06 August 2013 - 07: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


#19 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 06 August 2013 - 09:49 AM

View PostHellkid98, on 06 August 2013 - 07:42 AM, said:

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.

#20 TyDoesMC

  • Members
  • 154 posts
  • LocationEarth

Posted 06 August 2013 - 07:29 PM

Ok Thank You, I Just Learned About The for Loop Today/Last Night





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users