Advertisement
theTANCO

Relaxation Program

Sep 26th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. -- Change log: V1.1: All I did was clean up the code a little to bit to make it look nicer and easier to read. The code itself isn't any different at all (Except for changing 10+1-i to 11-i. I don't know what I was thinking when I did that part; I probably wasn't xD).
  2. local sides = {"top","bottom","left","right","front","back"}
  3. local instr = {
  4.   [1]="A note block is required for audio cues.",
  5.   [2]="Make sure the note block is making a sound that is both audible and pleasant to you.",
  6.   [3]="Relax yourself:",
  7.   [4]="Get into a comfortable position.",
  8.   [5]="Close your eyes.",
  9.   [6]="Listen for audio cues.",
  10.   [7]="Inhale through your nose for 5 seconds.",
  11.   [8]="Hold for 3 seconds.",
  12.   [9]="Exhale through your mouth for 8 seconds.",
  13.   [10]="Repeat 10 times.",
  14.   [11]="Press any key when you're ready to begin.",
  15.   [12]="A sound indicating to begin will play in 10 seconds.",
  16.   [13]="A sound will play twice once finished.",
  17.   [14]="If time is a concern, this practice only takes less than 3 minutes.",
  18.   [15]="This session is now finished. I hope you have a relaxing rest of your day."
  19. }
  20. function sound(t)
  21.   sleep(t)
  22.   for s = 1, #sides do
  23.     rs.setOutput(sides[s],true)
  24.   end
  25.   sleep(0.05)
  26.   for s = 1, #sides do
  27.     rs.setOutput(sides[s],false)
  28.   end
  29. end
  30. term.clear() term.setCursorPos(1,1)
  31. for i=1,#instr-1 do
  32.   print(instr[i])
  33. end
  34. os.pullEvent("key")
  35. term.clear() term.setCursorPos(1,1)
  36. print(instr[3]) print(instr[4]) print(instr[5]) print(instr[12]) sound(10)
  37. for i=1,10 do
  38.   term.clear() term.setCursorPos(1,1) print(instr[7]) print(11-i) sound(5)
  39.   term.clear() term.setCursorPos(1,1) print(instr[8]) print(11-i) sound(3)
  40.   term.clear() term.setCursorPos(1,1) print(instr[9]) print(11-i) sound(8)
  41. end
  42. term.clear() term.setCursorPos(1,1)
  43. print(instr[#instr])
  44. sound(0.25)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement