Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("left")
- local diskDrive = peripheral.wrap("right")
- modem.open(420)
- function getName()
- shell.execute("clear")
- print("Name of new card user:")
- local name = read()
- print("Checking if card name already exists...")
- modem.transmit(420, 420, name)
- local _, side, freq, rfreq, message = os.pullEvent('modem_message')
- if message[1] == "Found" then
- print("Card already exists, please use a different name. Stopping program.")
- print("Current balance: "..message[2])
- diskDrive.setDiskLabel(name.." $"..message[2].." - GraviCard")
- sleep(2)
- return
- elseif message[1] == "Not Found" then
- print("Card created.")
- print("Name: "..name.." Current balance: 0")
- diskDrive.setDiskLabel(name.." $"..message[2].." - GraviCard")
- sleep(2)
- end
- end
- shell.execute("clear")
- print("Welcome to the GraviCard card setup!")
- sleep(2)
- if diskDrive.isDiskPresent() then
- getName()
- else
- print("Please insert a disk in the disk drive.")
- sleep(2)
- end
- shell.execute("clear")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement