Posted 20 September 2012 - 03:48 PM
The following is a code I designed for my FangCo. Computer Company. My "company" on the server I play on sells Home Computers with multiple abilities and applications. That said, I decided to make up some games that could be popped in and played.
*Notice*
I named the File "Disk" because the user will type Disk in the Computer's Menu and that will load the startup from the disk.(Not Restarting the computer!)
I understand that restarting the computer will load the startup from the disk anyways, but I don't want my disks to be accessible to every computer… only the people who have knowledge of Computecraft could possibly figure out how to hack into a game…
That said, here's the coding:
Please keep in mind that this is untested and made in less than 15 minutes.(Any problems? Put it in the comments!) It contains 2 files you may not have on your game and also contains some pleasing aesthetic features meant only to notify/please the user of this program.
I'm fairly new to coding the "if then" stuff so i just based mine off of a Door Lock that had passcodes and usernames :)/>/>
Enjoy the Free Code!
*Notice*
I named the File "Disk" because the user will type Disk in the Computer's Menu and that will load the startup from the disk.(Not Restarting the computer!)
I understand that restarting the computer will load the startup from the disk anyways, but I don't want my disks to be accessible to every computer… only the people who have knowledge of Computecraft could possibly figure out how to hack into a game…
That said, here's the coding:
term.clear() --Clears the Screen
term.setCursorPos(1,1) --Sets the Cursor at the Beginning
print("Is there a disk in the Disk Drive?") -- Asks whether there is a disk in the drive
print("Yes/No")
local pass = "Yes"
local stop = "No"
read()
if input == pass then
term.clear()
term.setCursorPos(1,1)
print("Starting Disk Drive") --aesthetics/progress (Has to look pleasing for a user/consumer of my fangco. computer
sleep(1)
print("Loading Disk") --Same as above
sleep(1)
print("Starting Application") --Same as above
sleep(1)
shell.run("disk/diskmenu") --starts up the Menu file on the disk (make one with the game on the disk)
end
if input == stop then
shell.run("Exit") -- A program that just sends the user back to the Computer Menu (A program that I made)
end
Please keep in mind that this is untested and made in less than 15 minutes.(Any problems? Put it in the comments!) It contains 2 files you may not have on your game and also contains some pleasing aesthetic features meant only to notify/please the user of this program.
I'm fairly new to coding the "if then" stuff so i just based mine off of a Door Lock that had passcodes and usernames :)/>/>
Enjoy the Free Code!