Advertisement
Nik333

PDA: music

Jan 12th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. count=8
  2. chosen=1
  3. recordName={"back to menu","stop current","13","Cat","Far","Mall","Stal","Strad"}
  4. records={"","","13","cat","far","mall","stal","strad"}
  5. while true do
  6.   term.clear()
  7.   term.setCursorPos(2,1+chosen)
  8.   term.write(">")
  9.   for i=1,count,1 do
  10.     term.setCursorPos(3,1+i)
  11.     term.write(recordName[i])
  12.   end
  13.   event, arg = os.pullEvent()
  14.   if event=="key" then
  15.     if arg==keys.down then
  16.       if chosen<count then
  17.         chosen=chosen+1
  18.       end
  19.     elseif arg==keys.up then
  20.       if chosen>1 then
  21.         chosen=chosen-1
  22.       end
  23.     elseif arg==keys.enter then
  24.       if chosen>0 then
  25.         modem = peripheral.wrap("back")
  26.         modem.transmit(50,65,records[chosen])
  27.       end
  28.       break
  29.     end
  30.   end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement