Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function yn()
- local position = 1
- while true do
- local x , y = term.getCursorPos()
- term.clearLine()
- if position == 1 then write(" >Yes< No") else write (" Yes >No<") end
- term.setCursorPos(x,y)
- a, b = os.pullEvent("key")
- if b == 203 and position == 2 then position = 1 end
- if b == 205 and position == 1 then position = 2 end
- if b == 57 then print(" ") break end
- end
- if position == 1 then return true end
- if position == 2 then return false end
- end
- function ynTitleTop(title)
- local position = 1
- while true do
- local x , y = term.getCursorPos()
- term.clearLine()
- print(title[1])
- if position == 1 then write(" >Yes< No") else write (" Yes >No<") end
- term.setCursorPos(x,y)
- a, b = os.pullEvent("key")
- if b == 203 and position == 2 then position = 1 end
- if b == 205 and position == 1 then position = 2 end
- if b == 57 then print(" ") break end
- end
- if position == 1 then return true end
- if position == 2 then return false end
- end
- function ynTitleBottom(title)
- local position = 1
- while true do
- local x , y = term.getCursorPos()
- term.clearLine()
- if position == 1 then write(" >Yes< No") else write (" Yes >No<") end
- print(" ")
- write(title[1])
- term.setCursorPos(x,y)
- a, b = os.pullEvent("key")
- if b == 203 and position == 2 then position = 1 end
- if b == 205 and position == 1 then position = 2 end
- if b == 57 then print(" ") break end
- end
- if position == 1 then return true end
- if position == 2 then return false end
- end
- function ynTitleBoth(titleTop, titleBottom)
- local position = 1
- while true do
- local x , y = term.getCursorPos()
- term.clearLine()
- print(titleTop[1])
- if position == 1 then write(" >Yes< No") else write (" Yes >No<") end
- print(" ")
- write(titleBottom[1])
- term.setCursorPos(x,y)
- a, b = os.pullEvent("key")
- if b == 203 and position == 2 then position = 1 end
- if b == 205 and position == 1 then position = 2 end
- if b == 57 then print(" ") break end
- end
- if position == 1 then return true end
- if position == 2 then return false end
- end
- function custom(options)
- position = 1
- while true do
- term.clear()
- term.setCursorPos(1,2)
- for i = 1, #options, 1 do
- if i == position then print(" >"..options[i].."<") else print( " ".. options[i]) end
- end
- a, b = os.pullEvent("key")
- if b == 200 and position > 1 then position = position - 1 end
- if b == 208 and position < #options then position = position + 1 end
- if b == 57 then break end
- end
- term.clear()
- term.setCursorPos(1,2)
- return position
- end
- function customTitleTop(options , title)
- position = 1
- while true do
- term.clear()
- term.setCursorPos(1,2)
- print(title[1])
- for i = 1, #options, 1 do
- if i == position then print(" >"..options[i].."<") else print( " ".. options[i]) end
- end
- a, b = os.pullEvent("key")
- if b == 200 and position > 1 then position = position - 1 end
- if b == 208 and position < #options then position = position + 1 end
- if b == 57 then break end
- end
- term.clear()
- term.setCursorPos(1,2)
- return position
- end
- function customTitleBottom(options, title)
- position = 1
- while true do
- term.clear()
- term.setCursorPos(1,2)
- for i = 1, #options, 1 do
- if i == position then print(" >"..options[i].."<") else print( " ".. options[i]) end
- end
- print(title[1])
- a, b = os.pullEvent("key")
- if b == 200 and position > 1 then position = position - 1 end
- if b == 208 and position < #options then position = position + 1 end
- if b == 57 then break end
- end
- term.clear()
- term.setCursorPos(1,2)
- return position
- end
- function customTitleBoth(options, titleTop,titleBottom)
- position = 1
- while true do
- term.clear()
- term.setCursorPos(1,2)
- print(titleTop[1])
- for i = 1, #options, 1 do
- if i == position then print(" >"..options[i].."<") else print( " ".. options[i]) end
- end
- print(titleBottom[1])
- a, b = os.pullEvent("key")
- if b == 200 and position > 1 then position = position - 1 end
- if b == 208 and position < #options then position = position + 1 end
- if b == 57 then break end
- end
- term.clear()
- term.setCursorPos(1,2)
- return position
- end
Advertisement
Add Comment
Please, Sign In to add comment