Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- books = {"FloorB","Dense","Clickme"}
- names = {"BedrockFloor","Dense Ores World","Click Me!"}
- xes = {}
- function reset()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- end
- function cprint(w,y,text)
- term.setCursorPos((w/2)-(#text/2),y)
- term.write(text)
- end
- function getCenter(w,text,reset)
- if reset == false then
- one = (w/2)-(#text/2)
- two = one+#text
- tbl = {}
- table.insert(tbl,one)
- table.insert(tbl,two)
- table.insert(xes,tbl)
- elseif reset == true then
- xes = {}
- end
- end
- while true do
- reset()
- term.setBackgroundColor(colors.red)
- term.setCursorPos(1,1)
- size = {term.getSize()} --term has already been redirected.
- for i = 1,size[1] do
- term.write(" ")
- end
- term.setCursorPos(1,size[2])
- for i = 1,size[1] do
- term.write(" ")
- end
- cprint(size[1],1,"EBTele Terminal")
- term.setBackgroundColor(colors.white)
- cprint(size[1],3,"Select a Destination")
- for i = 1,#books do
- term.setBackgroundColor(colors.red)
- cpos = {term.getCursorPos()}
- cprint(size[1],cpos[2]+2," "..names[i].." ")
- getCenter(size[1]," "..names[i].." ",false)
- end
- evnt = {os.pullEvent()}
- if evnt[1] == "mouse_click" then
- for i = 1,#books do
- if evnt[4] == 3+(2*i) then
- if evnt[3] >= xes[i][1] and evnt[3] <= xes[i][2] then
- print(names[i])
- sleep(1)
- end
- end
- end
- end
- getCenter(size[1],"na",true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement