Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function OptionPrompt_list(y,Options)
- local n = 1
- while true do
- for i = 1, #Options do
- term.setCursorPos(1,y + (i - 1))
- term.clearLine()
- if n == i then term.write(">> "..Options[i]) else term.write("-"..Options[i]) end
- end
- local a, b = os.pullEvent("key")
- if b == keys.w and n > 1 then n = n - 1 end
- if b == keys.s and n < #Options then n = n + 1 end
- if b == keys.enter then break end
- end
- return n
- end
- function OptionPrompt_box(y,Options)
- local n = 1
- while true do
- local Text = Options[n]
- term.setCursorPos(1,y)
- term.clearLine()
- if n > 1 then Text = "<< "..Text end
- if n < #Options then Text = Text.." >>" end
- term.write(Text)
- local a, b = os.pullEvent("key")
- if b == keys.a and n > 1 then n = n - 1 end
- if b == keys.d and n < #Options then n = n + 1 end
- if b == keys.enter then break end
- end
- return n
- end
- function TextField()
- local input
- repeat
- local a, b = os.pullEvent("key")
- if b ~= keys.enter then input = read() end
- until b == keys.enter
- return input
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement