Advertisement
MrHG

MeatCoin

Aug 1st, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. -- CC MeatCoin
  2. -- First Time Setup
  3. fileUserdataName = "userdata"
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. if fs.exists(fileUserdataName) == false then
  7.  file = fs.open(fileUserdataName,"w")
  8.  file.writeLine(os.getComputerID())
  9.  print("Hello! Let's get your account set up.")
  10.  print("Please enter your name: ")
  11.  local name = io.read()
  12.  file.writeLine(name)
  13.  print("Now please enter a new PIN: ")
  14.  local pin = io.read()
  15.  term.clear()
  16.  term.setCursorPos(1,1)
  17.  print("Thank you, "..name.." Your account will now be created.")
  18.  -- Ping to Server for Account Creation
  19.  file.close()
  20. end
  21. local file = fs.open(fileUserdataName,"r")
  22. local id = file.readLine()
  23. local name = file.readLine()
  24.  
  25. options = {"Send","Receive","Balance"}
  26. selected = 1
  27. while true do
  28. print("Welcome back "..name.."\n")
  29.  if selected == 1 then
  30.   print("["..options[1].."]")
  31.  else
  32.   print(options[1])
  33.  end
  34.  if selected == 2 then
  35.   print("["..options[2].."]")
  36.  else
  37.   print(options[2])
  38.  end
  39.  if selected == 3 then
  40.   print("["..options[3].."]")
  41.  else
  42.   print(options[3])
  43.  end
  44.  local event, key = os.pullEvent("key")
  45.  if key == keys.down then
  46.   if selected == 3 then
  47.    selected = 1
  48.   else
  49.    selected = selected + 1
  50.   end
  51.  end
  52.  if key == keys.up then
  53.   if selected == 1 then
  54.    selected = 3
  55.   else
  56.    selected = selected - 1
  57.   end
  58.  end
  59.  term.clear()
  60.  term.setCursorPos(1,1)
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement