Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("pastebin", "get", "cXNuhwXh", "DexPI")
- shell.run("DexPI")
- clear(1,1)
- stargates = listPer("stargate")
- sg = peripheral.wrap(stargates[1])
- sgd = "sgDatabase"
- function dWrite()
- local dbs = textutils.serialize(db)
- local file = fs.open(sgd, "w")
- file.write(dbs)
- file.close()
- end
- function dRead()
- if fs.exists(sgd) then
- local file = fs.open(sgd, "r")
- db = textutils.unserialize(file.readAll())
- return db
- else
- return {}
- end
- end
- x, y = term.getSize()
- paintutils.drawLine(1, 1, 51, 1, colors.gray)
- term.setBackgroundColor(colors.gray)
- function centered(text, l)
- term.setCursorPos((x/2) - (#text/2), l)
- write(text)
- local _,cy = term.getCursorPos()
- term.setCursorPos(1,cy + 1)
- end
- function header(text)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.blue)
- for i = 1, 2 do
- term.setCursorPos(1,i)
- write(string.rep(" ",x))
- end
- centered(text,1)
- term.setCursorPos(1,y)
- write(string.rep(" ",x))
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,3)
- end
- function add()
- header("Addition to Database")
- repeat
- write("Gate Serial: ")
- gser = read()
- until sg.isValidAddress(gser) == true
- repeat
- print("\nDestination Name: ")
- gname = string.upper(read())
- until #gname > 2
- db[gser] = {
- ["name"] = gname,
- }
- dWrite()
- end
- header("Dialing Computer")
- db = dRead()
- add()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement