Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("left")
- local sens = peripheral.wrap("top")
- local w, h = mon.getSize()
- local tmpPlayerTable = {}
- local islName = 0
- function printPlayersTable(tab)
- for playerNumber,playerTable in pairs(tab) do
- print("Player:" .. playerNumber)
- for k,v in pairs(playerTable) do
- print(k .. ": " .. v)
- end
- end
- end
- function printTable(tab)
- for k,v in pairs(tab) do
- print(k,v)
- end
- end
- function displayMainScreen()
- mon.clear()
- mon.setCursorPos(3,5)
- mon.setTextColor(colors.purple)
- mon.write("Welcome to Umbra Skyblocks")
- mon.setCursorPos(4,10)
- mon.setTextColor(colors.orange)
- mon.write("Right click this screen")
- mon.setCursorPos(6,11)
- mon.setTextColor(colors.orange)
- mon.write("to create a base or")
- mon.setCursorPos(8,12)
- mon.setTextColor(colors.orange)
- mon.write("check base name")
- end
- function displayCheckingScreen()
- mon.clear()
- mon.setCursorPos(4,9)
- mon.setTextColor(colors.orange)
- mon.write("Checking players nearby")
- mon.setCursorPos(8,10)
- mon.setTextColor(colors.orange)
- mon.write("Please wait...")
- end
- function displaySuccessScreen()
- mon.clear()
- mon.setCursorPos(4,9)
- mon.setTextColor(colors.orange)
- mon.write("Bases created, player's")
- mon.setCursorPos(4,10)
- mon.setTextColor(colors.orange)
- mon.write("messaged with base name")
- end
- function getPlayers()
- local tmpPlayers = sens.getPlayers()
- local tmpLn = islName.readLine()
- local i = 1
- while (tmpLn ~= nil) do
- tmpPlayerTable[i] = {}
- tmpPlayerTable[i]["uuid"] = string.sub(tmpLn, 1, 36)
- tmpPlayerTable[i]["name"] = string.sub(tmpLn, 37)
- i = i + 1
- tmpLn = islName.readLine()
- print(tmpPlayerTable[i-1]["uuid"])
- print(tmpPlayerTable[i-1]["name"])
- end
- --check if file was read correctly
- --can comment this out once verified
- --that the file is being read correctly
- local i = 1
- while (tmpPlayers[i] ~= nil) do
- local playUUID = tostring(tmpPlayers[i]["uuid"])
- local playName = tostring(tmpPlayers[i]["name"])
- local hasBase = false
- local tmpLn = islName.readLine()
- print(playUUID, playName)
- i = i + 1
- end
- end
- function checkBases()
- end
- function createBases()
- end
- function main()
- while true do
- displayMainScreen()
- local event, side, xPos, yPos = os.pullEvent("monitor_touch")
- displayCheckingScreen()
- sleep(5)
- islName = fs.open("createIsland/islandNames", "r")
- getPlayers()
- checkBases()
- createBases()
- displaySuccessScreen()
- sleep(5)
- islName.close()
- tmpPlayerTable = {}
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement