Advertisement
Guest User

Rhythm Heaven - No Touching Alpha

a guest
Dec 27th, 2013
2,480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.52 KB | None | 0 0
  1. --Suggested settings:
  2. --DeSmuME_0.9.10_x86.exe
  3. --lua51.dll in same folder (MD5 hash: bbcc1690fe636fa08c30504b511b4901 )
  4. --"Install desmume 0.9.9 and then download lua51.dll and lua5.1.dll from the
  5. --"LuaBinaries 5.1.4 -Release 2" package at http://luabinaries.sourceforge.net/download.html
  6. --Rotation 270 degrees (so it looks normal)
  7. --Magnification filter: Nearest 2x (for a double-size, pixel-perfect screen) or just "normal" (for 1x)
  8. --Sound settings: Synchronous (Synch Method "N"), Interpolation: Cosine
  9. --Start the script with tools->LUA scripting
  10. --Tested on Right Handed mode only
  11. --
  12. --Normal Rhythm Heaven inputs:
  13. --[Start Button] and [Touch Screen]
  14. --Setting up our variables
  15. --lowest value for the main swipe motion
  16. f=f or 32
  17. framecounter=framecounter or 0
  18. --assorted values for the swipe
  19. g=g or 0
  20. i=i or 0
  21. m=m or 0
  22. selectheld=selectheld or 0
  23. startpressed=startpressed or 0
  24. showquittingtext=showquittingtext or 0
  25. --x and y of the cursor
  26. xx=xx or 96
  27. yy=yy or 96
  28. while true do
  29.     emu.frameadvance()
  30.     --framecounter3 is a timer used in the select to quit statements
  31.     framecounter3=framecounter3 or 0
  32.     framecounter3=framecounter3+1
  33.     if framecounter3 >=300 then
  34.         framecounter3=300
  35.         end
  36.     --gui.text(0,0, string.format(framecounter3))
  37.     --gui.text(0,0, string.format(framecounter))
  38.     --gui.text(20,0, string.format(g))
  39.     --gui.text(40,0, string.format(i))
  40.     --gui.text(60,0, string.format(m))
  41.     --gui.text(0,10, string.format(selectheld))
  42.     --gui.text(0,0, string.format(startpressed))
  43.     --gui.text(0,20, string.format(xx))
  44.     --gui.text(0,30, string.format(yy))
  45. --Drawing a cursor for d-pad stylus control.
  46.     if drawcursor==1 then
  47.         --Bigger box
  48.         boxsizeconstant=4
  49.         gui.box(xx-boxsizeconstant, yy-boxsizeconstant, xx+boxsizeconstant, yy+boxsizeconstant, {r = 0x255, g = 0x255, b = 0x255, a = 0x75}, {r = 0x255, g = 0x255, b = 0x255, a = 0x75})
  50.         --Crosshair
  51.         gui.line(xx-boxsizeconstant, yy, xx+boxsizeconstant, yy, {r = 0x000, g = 0x000, b = 0x000, a = 0x225})
  52.         gui.line(xx, yy-boxsizeconstant, xx, yy+boxsizeconstant, {r = 0x000, g = 0x000, b = 0x000, a = 0x225})
  53.         --Smaller box
  54.         gui.box(xx-(boxsizeconstant/2), yy-(boxsizeconstant/2), xx+(boxsizeconstant/2), yy+(boxsizeconstant/2), {r = 0x99, g = 0x169, b = 0x255, a = 0x225}, {r = 0x99, g = 0x169, b = 0x255, a = 0x225})
  55.         end
  56. --setting our screen borders for the dpad movement. Nothing happens in the outer edges so we leave them off limits unless the L button (slower movement) is held.
  57. border=7
  58. xmin=border
  59. xmax=256-border
  60. ymin=border
  61. ymax=192-border
  62. --dpadmovespeed determines how many pixels to move in one frame with the d-pad
  63. --slow down dpad speed while L button is held
  64. if joypad.get().L then
  65.     dpadmovespeed=1
  66.     drawcursor=1
  67.     framecounter3=0
  68.     xmin=0
  69.     xmax=256
  70.     ymin=0
  71.     ymax=192
  72. else
  73.     dpadmovespeed=5
  74.     end
  75. if joypad.get().up then
  76.     xx=xx+dpadmovespeed
  77.     drawcursor=1
  78.     framecounter3=0
  79.     if xx>=xmax then
  80.         xx=xmax
  81.         end
  82.     end
  83. if joypad.get().down then
  84.     xx=xx-dpadmovespeed
  85.     drawcursor=1
  86.     framecounter3=0
  87.     if xx<=xmin then
  88.         xx=xmin
  89.         end
  90.     end
  91. if joypad.get().left then
  92.     yy=yy-dpadmovespeed
  93.     drawcursor=1
  94.     framecounter3=0
  95.     if yy<=ymin then
  96.         yy=ymin
  97.         end
  98.     end
  99. if joypad.get().right then
  100.     yy=yy+dpadmovespeed
  101.     drawcursor=1
  102.     framecounter3=0
  103.     if yy>=ymax then
  104.         yy=ymax
  105.         end
  106.     end
  107. --While held, touch the screen and continue touching. Two buttons to allow you to alternate buttons during fast games.
  108. if joypad.get().A then
  109.     stylus.set{x=xx, y=yy, touch=true}
  110.     framecounter3=0
  111.     end
  112. if joypad.get().X then
  113.     stylus.set{x=xx, y=yy, touch=true}
  114.     framecounter3=0
  115.     end
  116. --Press to hit the skip button and skip practice.
  117. if joypad.get().select then
  118.     if startpressed==0 then
  119.         stylus.set{x=242, y=30, touch=true}
  120.         joypad.set{select=false}
  121.         end
  122.     end
  123. --Press start then hold select for 3/4 second (45 frames) to quit the current game. (In games with a pause menu that have a quit button.)
  124. --Holding select when the pause menu is not open will send one touch event at where the "quit" button would be. It only does this once, so there are minimal potential for errors.
  125. --This was very challenging to get working, so please quit a lot of games!
  126. if joypad.get().start then
  127.     startpressed=1
  128.     end
  129. if startpressed==1 then
  130.     if selectheld>=45 then
  131.         stylus.set{x=130, y=142, touch=true}
  132.         joypad.set{select=false}
  133.         selectheld=0
  134.         joypad.set{start=false}
  135.         startpressed=0
  136.         end
  137.     if joypad.get().select then
  138.         showguitext=1
  139.         selectheld=selectheld+1
  140.         framecounter3=0
  141.         else
  142.         selectheld=0
  143.         end
  144.     end
  145. if showguitext==1 then
  146.     gui.text(0,0, string.format("Quitting... "))
  147.     gui.text(70,0, string.format(selectheld))
  148.     gui.text(83,0, string.format("/45"))
  149.     end
  150. --Clean up GUI text and cursor after 1 second (60 frames)
  151. if framecounter3>=60 then
  152.     showguitext=0
  153.     drawcursor=0
  154.     end
  155.     --startpressed=0
  156.     --end
  157. --Flick controls. Note that the main menu of Rhythm Heaven requires a more vigorous (3 frames?) flick than the rest of the game (2 frames). This is set up for as little lag as possible, so it doesn't work on the main menu.
  158. if joypad.get().B then
  159. --if B is being held, ignore inputs. Script should detect a single B button press (or hold), do one single flick, then wait for B to stop being held. If, after the flick, B stops being held, script allows another flick.
  160.     g=1
  161.     i=0
  162.     framecounter2=0
  163.     end
  164. if g==1 then
  165.     joypad.set{B=false}
  166.     joypad.set{A=false}
  167.     joypad.set{Y=false}
  168.     if framecounter>=2 then
  169.         stylus.set{x=f, y=96, touch=false}
  170.         f=32
  171.         --no clue what I am doing - I guess setting up variables to kill the original variables but I don't know if this is needed. I think I was having problems with
  172.         --the script exiting certain "if then" statements because within them I was cancelling the statements that "if" required.
  173.         --g=0
  174.         i=1
  175.         --framecounter=0
  176.         framecounter2=1
  177.         end
  178.     if f>=256 then
  179.         f=f
  180.         f=32
  181.         end
  182.     if framecounter>=0 then
  183.         stylus.set{x=f, y=96, touch=true}
  184.         framecounter=framecounter+1
  185.         f=f+63
  186.         end
  187.     end
  188. if i==1 then
  189.     g=0
  190.     end
  191. if framecounter2==1 then
  192.     framecounter=0
  193.     end
  194. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement