Advertisement
Guest User

Untitled

a guest
Apr 8th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 18.58 KB | None | 0 0
  1. #include "misc.au3"
  2. #include "file.au3"
  3. #include "array.au3"
  4. #include "_enableconsole.au3"
  5.  
  6. _enableconsole()
  7.  
  8. ;design
  9. dim $boardlength = 30
  10. dim $fretsline = 5
  11. dim $beepenable = 0
  12. dim $beepfrequencybase = 300
  13. dim $starpowerdrain = 2
  14. dim $starpowerbars = 16
  15.  
  16. ;characters
  17. dim $beatline = "-"
  18. dim $emptychar = "-"
  19. dim $fretoff = "|"
  20. dim $freton = "#"
  21. dim $hammeron = "o"
  22. dim $hold = "="
  23. dim $normalnote = "O"
  24. dim $starnote = "X"
  25. dim $starnotehammer = "x"
  26.  
  27. ;vars
  28. dim $hammeredon[1][6]
  29. dim $char[$boardlength + 1][6]
  30. dim $bpm = 100
  31. dim $delay = 15000 / $bpm
  32. dim $fret[6]
  33. dim $holding[6]
  34. dim $position = 0
  35. dim $song[1][1]
  36. dim $songlength
  37. dim $songname
  38. dim $streak = 0
  39. dim $tick
  40. dim $totalticks
  41. dim $songlist[1]
  42. dim $cursorpos
  43. dim $higheststreak
  44. dim $pressedfrets[6]
  45. dim $currentnotes[6]
  46. dim $requirednotes[6]
  47. dim $playednote
  48. dim $totalnotes
  49. dim $totalnoteshit
  50. dim $score
  51. dim $multiplier
  52. dim $holdscorebase = 5
  53. dim $scorebase = 50
  54. dim $maxmulti
  55. dim $starlines[5]
  56. dim $starpower
  57. dim $starpowerenabled
  58. dim $lightningchars[6]
  59. dim $tick
  60. dim $starstring
  61.  
  62. func _ini()
  63.     $lightningchars[1] = "_"
  64.     $lightningchars[2] = "-"
  65.     $lightningchars[3] = "."
  66.     $lightningchars[4] = "`"
  67.     $lightningchars[5] = "'"
  68.     $cursorpos = 1
  69.     _songselect()
  70. endfunc
  71.  
  72. func _songselect();first real function to be called. reads in filelist, filters out the .txt and masters the songselect
  73.     $fail = hotkeyset( "{ESC}", "_exit")
  74.     if $fail == 0 Then
  75.         consolewrite( "Failed to set hotkeys, you probably have this game open somewhere else. Exiting.")
  76.         sleep(2000)
  77.         exit
  78.     endif
  79.     $songlist = _filelisttoarray( @scriptdir, "*", 1)
  80.    
  81.     $counter = 1
  82.     do
  83.         if StringRight( $songlist[$counter], 4) <> ".txt" Then
  84.             _arraydelete( $songlist, $counter)
  85.             $songlist[0] -= 1
  86.             $counter -= 1
  87.         endif
  88.         $counter += 1
  89.     until $counter > $songlist[0]
  90.        
  91.     hotkeyset( "{UP}" , "_songlistup" )
  92.     hotkeyset( "{DOWN}" , "_songlistdown" )
  93.     hotkeyset( "{ENTER}", "_songload" )
  94.     _drawsonglist()
  95. EndFunc
  96.  
  97. func _drawsonglist();draws the logo and songlist + cursor
  98.     if @compiled then
  99.         $consolestring = @LF & "     ___   _____ ______________   __  __              " & @LF & "    /   | / ___// ____/  _/  _/  / / / /__  _________ " & @LF & "   / /| | \__ \/ /    / / / /   / /_/ / _ \/ ___/ __ \" & @LF & "  / ___ |___/ / /____/ /_/ /   / __  /  __/ /  / /_/ /" & @LF & " /_/  |_/____/\____/___/___/  /_/ /_/\___/_/   \____/ v.whocares" & @LF & "                                                      by Maurice" & @LF & " Select a song with the arrow keys and press Enter!" & @LF & @LF
  100.         if $songlist[0] > 0 then
  101.             for $i = 1 to $songlist[0]
  102.                 if $i < 17 then
  103.                     if $cursorpos == $i then
  104.                         $consolestring = $consolestring & "   -> "
  105.                     Else
  106.                         $consolestring = $consolestring & "      "
  107.                     endif  
  108.                     $consolestring = $consolestring & $songlist[$i] & @LF
  109.                 endif
  110.             next
  111.             for $i = 1 to 16 - $songlist[0]
  112.                 $consolestring = $consolestring & @LF
  113.             next
  114.            
  115.             if $songlist[0] > 16 Then
  116.                 $consolestring = $consolestring & "      [Not showing songs beyond #16, sorry]"
  117.             endif
  118.         Else
  119.             $consolestring = $consolestring & "      No songs found :("
  120.         endif
  121.        
  122.     Else ;only here so I can test it in the IDE
  123.        
  124.         $consolestring = @LF & "Select a song with the arrow keys and press Enter!" & @LF
  125.         if $songlist[0] > 0 then
  126.             for $i = 1 to $songlist[0]
  127.                 if $cursorpos == $i then
  128.                     $consolestring = $consolestring & "   -> "
  129.                 Else
  130.                     $consolestring = $consolestring & "      "
  131.                 endif  
  132.                 $consolestring = $consolestring & $songlist[$i] & @LF
  133.             next
  134.             for $i = 1 to 4 - $songlist[0]
  135.                 $consolestring = $consolestring & @LF
  136.             next
  137.         Else
  138.             $consolestring = $consolestring & "      No songs found :("
  139.         endif
  140.     endif
  141.    
  142.     consolewrite ( $consolestring )
  143. endfunc
  144.  
  145. func _songlistdown();calls _drawsonglist after adjusting $cursorpos
  146.     if $cursorpos < $songlist[0] AND $cursorpos < 16 then
  147.         $cursorpos += 1
  148.         _drawsonglist()
  149.     endif
  150. EndFunc
  151.  
  152. func _songlistup();calls _drawsonglist after adjusting $cursorpos
  153.     if $cursorpos > 1 then
  154.         $cursorpos -= 1
  155.         _drawsonglist()
  156.     endif
  157. endfunc
  158.  
  159. func _songload();is called by ENTER hotkey and calls _start with the songname
  160.     _start($songlist[$cursorpos])
  161. endfunc
  162.  
  163. func _start($name);ini for songload. resets all needed vars and calls _loadsong, then _main
  164.     $songname = $name
  165.     hotkeyset( "{ESC}", "_quitsong")
  166.     $starpower = 0
  167.     $starpowerenabled = 0
  168.     $streak = 0
  169.     $higheststreak = 0
  170.     $totalnoteshit = 0
  171.     $totalnotes = 0
  172.     $multiplier = 1
  173.     $score = 0
  174.     $maxmulti = 1
  175.     $starpower = 0
  176.     _loadsong($name)
  177.     for $y = 1 to 5
  178.         for $x = 1 to $boardlength
  179.             $char[$x][$y] = $emptychar
  180.         Next
  181.        
  182.         $holding[$y] = 0
  183.     next
  184.     $totalticks = 0
  185.     $position = 0
  186.     _enablecontrols()
  187.     _main()
  188. endfunc
  189.  
  190. func _loadsong($name);reads a song from $songname (.txt); NEED CHECKS FOR ERRORS
  191.     $songfile = fileopen( @scriptdir & "\" & $name, 0)
  192.  
  193.     for $y = 1 to 5
  194.         if stringlen(filereadline($songfile, $y)) + 2 > $songlength Then
  195.             $songlength = stringlen(filereadline($songfile, $y)) + 2
  196.         endif
  197.     Next
  198.    
  199.     redim $song[$songlength + 1][6]
  200.     redim $hammeredon[$songlength][6]
  201.     for $y = 1 to 5
  202.         for $x = 1 to $songlength
  203.             $currentchar = stringmid( filereadline( $songfile, $y), $x, 1)
  204.             if $currentchar <> " " Then
  205.                 $song[$x][$y] = $currentchar
  206.             Else
  207.                 $song[$x][$y] = " "
  208.             endif
  209.         Next
  210.     next
  211.    
  212.     for $x = 1 to $songlength
  213.         $hasnote = 0
  214.         for $y = 1 to 5
  215.             if $song[$x][$y] == $normalnote OR $song[$x][$y] == $hammeron OR $song[$x][$y] == $starnote Then
  216.                 $hasnote = 1
  217.             EndIf
  218.         Next
  219.         if $hasnote == 1 Then
  220.             $totalnotes += 1
  221.         EndIf
  222.     next
  223.    
  224.     fileclose( $songfile )
  225. endfunc
  226.  
  227. func _main();game updater function. moves everything to the left, checks for note misses, calls _draw() also checks for holds
  228.    
  229.     while $totalticks <= $songlength + $boardlength - 3
  230.         if $beepenable == 1 then
  231.             $beep = false
  232.             for $y = 1 to 5
  233.                 if ($pressedfrets[$y] == 1) OR ($holding[$y] = 1 AND $song[$position - $boardlength + $fretsline + 1][$y] = $hold) Then
  234.                     $beep = $y * $beepfrequencybase
  235.                 EndIf
  236.                 $pressedfrets[$y] = 0
  237.             next
  238.             if $beep <> false AND $streak > 0 Then
  239.                 beep( $beep, $delay)
  240.             Else
  241.                 sleep($delay)
  242.             endif
  243.         Else
  244.             sleep($delay)
  245.         endif
  246.        
  247.         if $position < $songlength then
  248.             for $y = 1 to 5
  249.                 if $song[$position][$y] == $normalnote OR $song[$position][$y] == $hold OR $song[$position][$y] == $hammeron OR $song[$position][$y] == $starnote Then
  250.                     $char[$boardlength][$y] = $song[$position][$y]
  251.                 else   
  252.                     if $tick = 4 then
  253.                         $char[$boardlength][$y] = $beatline
  254.                     Else
  255.                         $char[$boardlength][$y] = $emptychar
  256.                     endif
  257.                 endif
  258.             next
  259.                
  260.             $position += 1
  261.         endif
  262.            
  263.         for $y = 1 to 5
  264.             for $x = 1 to $boardlength - 1
  265.                 $char[$x][$y] = $char[$x+1][$y]
  266.             next
  267.              
  268.             if $char[$fretsline-2][$y] = $normalnote OR $char[$fretsline-2][$y] = $hammeron OR $song[$position][$y] == $starnote Then
  269.                 $streak = 0
  270.                 $multiplier = 1
  271.             endif
  272.            
  273.             if $holding[$y] = 1 AND $char[$fretsline][$y] = $hold Then
  274.                 $char[$fretsline][$y] = $emptychar
  275.                 $score += $holdscorebase * $multiplier
  276.             endif
  277.            
  278.             if $char[$fretsline+1][$y] == $emptychar Then
  279.                 $holding[$y] = 0
  280.             endif
  281.         next
  282.        
  283.         if $starpowerenabled = 1 Then
  284.             $starpower -= $starpowerdrain
  285.             if $starpower <= 0 Then
  286.                 $starpower = 0
  287.                 $starpowerenabled = 0
  288.             EndIf
  289.         endif
  290.        
  291.         $totalticks += 1
  292.         $tick += 1
  293.         if $tick > 4 then $tick = 1
  294.         _updatefrets()
  295.         _draw()
  296.     wend
  297.    
  298.     _showscores()
  299.    
  300. endfunc
  301.  
  302. func _updatefrets();Turns of frets and $holding when released
  303.     if _ispressed(31) then
  304.        
  305.     Else
  306.         $fret[1] = $fretoff
  307.         $holding[1] = 0
  308.     EndIf
  309.    
  310.     if _ispressed(32) then
  311.        
  312.     Else
  313.         $fret[2] = $fretoff
  314.         $holding[2] = 0
  315.     EndIf
  316.    
  317.     if _ispressed(33) then
  318.        
  319.     Else
  320.         $fret[3] = $fretoff
  321.         $holding[3] = 0
  322.     EndIf
  323.    
  324.     if _ispressed(34) then
  325.        
  326.     Else
  327.         $fret[4] = $fretoff
  328.         $holding[4] = 0
  329.     EndIf
  330.    
  331.     if _ispressed(35) then
  332.        
  333.     Else
  334.         $fret[5] = $fretoff
  335.         $holding[5] = 0
  336.     EndIf
  337. endfunc
  338.  
  339. func _draw();draws the fretboard and streak counter
  340.     $consolestring = @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF
  341.        
  342.     if $starpowerenabled == 1 then
  343.         if $tick == 4 then
  344.             $starstring = ""
  345.             $lastchar = ""
  346.             for $x = 1 to $boardlength + $fretsline - 1
  347.                 do
  348.                     $currentchar = $lightningchars[random( 1, 5 )]
  349.                 until $currentchar <> $lastchar
  350.                 $lastchar = $currentchar
  351.                 $starstring = $starstring & $currentchar
  352.             Next
  353.         endif
  354.         $consolestring = $consolestring & $starstring
  355.     endif
  356.    
  357.     for $y = 1 to 5
  358.     $consolestring = $consolestring & @LF
  359.         for $x = 1 to $boardlength - 1
  360.             if $char[$x][$y] == $normalnote OR $char[$x][$y] == $hammeron OR $char[$x][$y] == $starnote Then ;HAMMERONS, NORMALS AND STARNOTES ARE DRAWN WHERE THEY ARE NO MATTER WHAT
  361.                 $consolestring = $consolestring & $char[$x][$y]
  362.             elseif $x > $fretsline then ;RIGHT OF FRETLINE
  363.                 $consolestring = $consolestring & $char[$x][$y]
  364.             elseif $x == $fretsline then ;ON FRETLINE
  365.                 $consolestring = $consolestring & $fret[$y]
  366.             elseif $x < $fretsline then ;LEFT OF FRETLINE
  367.                 if $char[$x][$y] == $emptychar OR $char[$x][$y] == $beatline then
  368.                     $consolestring = $consolestring & " "
  369.                 Else
  370.                     $consolestring = $consolestring & $char[$x][$y]
  371.                 endif
  372.             endif
  373.         Next
  374.     Next
  375.    
  376.     if $starpowerenabled == 1 then
  377.         $consolestring = $consolestring & @LF &  $starstring
  378.     else
  379.         $consolestring = $consolestring & @LF
  380.     endif
  381.  
  382.     if @compiled then
  383.         $consolestring = $consolestring & @LF & " Starpower: ["
  384.         $starpowerbarstring = ""
  385.         for $i = 1 to round(($starpower / 100 * $starpowerbars))
  386.             $starpowerbarstring = $starpowerbarstring & "#"
  387.         Next
  388.        
  389.         for $i = 1 to ($starpowerbars - round(($starpower / 100 * $starpowerbars)))
  390.             $starpowerbarstring = $starpowerbarstring & " "
  391.         Next
  392.        
  393.         $consolestring = $consolestring & $starpowerbarstring & "]" & @LF & @LF & " Streak: " & $streak & @LF & " Multiplier: " & $multiplier & @LF & " Score: " & $score & @LF & @LF & @LF & @LF & @LF
  394.     Else ;IDE testing
  395.         $consolestring = $consolestring & @LF & "Streak: " & $streak & "  Mult: " & $multiplier & "    Score: " & $score & "    Starpower: " & $starpower & "    starenabled: " & $starpowerenabled
  396.     endif
  397.     consolewrite( $consolestring)
  398. endfunc
  399.  
  400. func _showscores();will show scores
  401.     _disablecontrols()
  402.     hotkeyset( "{ESC}", "_songselect" )
  403.     if $totalticks < $songlength + $boardlength then
  404.         $consolestring = @LF & "                __     __           _____            _    _ " & @LF & "                \ \   / /          |  __ \          | |  | |" & @LF & "                 \ \_/ /__  _   _  | |__) |___   ___| | _| |" & @LF & "                  \   / _ \| | | | |  _  // _ \ / __| |/ / |" & @LF & "                   | | (_) | |_| | | | \ \ (_) | (__|   <|_|" & @LF & "                   |_|\___/ \__,_| |_|  \_\___/ \___|_|\_(_)" & @LF & @LF & @LF
  405.         if $totalnoteshit > 0 then
  406.             $consolestring = $consolestring & "                              Score: " & $score & @LF & @LF & "                         Finished song '" & Stringleft( $songname, stringlen( $songname ) - 4) & "'!" & @LF & "                        " & $totalnoteshit & "/" & $totalnotes & " notes hit. That's " & round( 100 / ($totalnotes / $totalnoteshit), 1) & "%!" & @LF & "                           Highest multiplier: " & $maxmulti & @LF & @LF & @LF & @LF
  407.         Else
  408.             $consolestring = $consolestring & "                              Score: " & $score & @LF & @LF & "                         Finished song '" & Stringleft( $songname, stringlen( $songname ) - 4) & "'!" & @LF & "                          0/" & $totalnotes & " notes hit. That's 0%!" & @LF & "                           Highest multiplier: " & $maxmulti & @LF & @LF & @LF & @LF
  409.         endif
  410.        
  411.         if $totalnoteshit > 0 then
  412.             switch round( 100 / ($totalnotes / $totalnoteshit))
  413.             case 0 to 30
  414.                 $starcount = 0
  415.                
  416.             case 31 to 45
  417.                 $starcount = 1
  418.                
  419.             case 46 to 60
  420.                 $starcount = 2
  421.                
  422.             case 60 to 75
  423.                 $starcount = 3
  424.                
  425.             case 76 to 89
  426.                 $starcount = 4
  427.                
  428.             case 90 to 99
  429.                 $starcount = 5
  430.                
  431.             case 100
  432.                 $starcount = 6
  433.            
  434.             endswitch
  435.         Else
  436.             $starcount = 0
  437.         endif
  438.  
  439.         for $i = 1 to 4
  440.            
  441.             if $starcount < 6 then
  442.                 $starlines[$i] = "          "
  443.             Else
  444.                 $starlines[$i] = "      "
  445.             endif
  446.            
  447.             for $j = 1 to 5 - $starcount
  448.                 $starlines[$i] = $starlines[$i] & "      "
  449.             next
  450.            
  451.             for $j = 1 to $starcount
  452.                 switch $i
  453.                 case 1
  454.                     $starlines[$i] = $starlines[$i] & "   /\       "
  455.                    
  456.                 case 2
  457.                     $starlines[$i] = $starlines[$i] & "--/--\--    "
  458.                
  459.                 case 3
  460.                     $starlines[$i] = $starlines[$i] & "`/_  _\'    "
  461.                    
  462.                 case 4
  463.                     $starlines[$i] = $starlines[$i] & "/_.''._\    "
  464.                
  465.                 endswitch
  466.             next
  467.             $consolestring = $consolestring & $starlines[$i] & @LF
  468.         Next
  469.         $consolestring = $consolestring & @LF & @LF & @LF & "                           Press Enter to continue" & @LF
  470.        
  471.         consolewrite( $consolestring )
  472.         hotkeyset( "{ENTER}", "_songselect")
  473.     Else
  474.         _songselect()
  475.     endif
  476. endfunc
  477.  
  478. func _enablecontrols();enables hotkeys for enter and 1-5
  479.     hotkeyset( "{#}", "_starpower" )
  480.     hotkeyset( "{ENTER}", "_strum" )
  481.  
  482.     hotkeyset( "{1}", "_1")
  483.     hotkeyset( "{2}", "_2")
  484.     hotkeyset( "{3}", "_3")
  485.     hotkeyset( "{4}", "_4")
  486.     hotkeyset( "{5}", "_5")
  487. endfunc
  488.  
  489. func _disablecontrols();disables hotkeys for enter and 1-5
  490.     hotkeyset( "{#}" )
  491.     hotkeyset( "{ENTER}" )
  492.  
  493.     hotkeyset( "{1}" )
  494.     hotkeyset( "{2}" )
  495.     hotkeyset( "{3}" )
  496.     hotkeyset( "{4}" )
  497.     hotkeyset( "{5}" )
  498. endfunc
  499.  
  500. ;;;;;;;;;;;;;;;;;;;;;;
  501. ;; HOTKEY FUNCTIONS ;;
  502. ;;;;;;;;;;;;;;;;;;;;;;
  503.  
  504. func _starpower()
  505.     if $starpower >= 50 AND $starpowerenabled == 0 Then
  506.         $starpowerenabled = 1
  507.     EndIf
  508. endfunc
  509.  
  510. func _1();calls hammeron($y) and sets the fret char
  511.     _hammeron(1)
  512.     $fret[1] = $freton
  513. endfunc
  514.  
  515. func _2();calls hammeron($y) and sets the fret char
  516.     _hammeron(2)
  517.     $fret[2] = $freton
  518. endfunc
  519.  
  520. func _3();calls hammeron($y) and sets the fret char
  521.     _hammeron(3)
  522.     $fret[3] = $freton
  523. endfunc
  524.  
  525. func _4();calls hammeron($y) and sets the fret char
  526.     _hammeron(4)
  527.     $fret[4] = $freton
  528. endfunc
  529.  
  530. func _5();calls hammeron($y) and sets the fret char
  531.     _hammeron(5)
  532.     $fret[5] = $freton
  533. endfunc
  534.  
  535. func _hammeron($y);checks if pressed note is a hammeron; sets streak, holding and sets a hold char if necessary
  536.     _draw()
  537.     $fault = 1
  538.     if $streak > 0 Then
  539.         if $char[$fretsline][$y] == $hammeron Then
  540.             $strumposition = 0
  541.             $fault = 0
  542.             $char[$fretsline][$y] = $emptychar
  543.             if $char[$fretsline + 1][$y] == $hold then
  544.                 $holding[$y] = 1
  545.             endif
  546.             $score += $scorebase * $multiplier
  547.         Elseif $char[$fretsline - 1][$y] == $hammeron Then
  548.             $strumposition = -1
  549.             $fault = 0
  550.             $char[$fretsline - 1][$y] = $emptychar
  551.             if $char[$fretsline][$y] == $hold then
  552.                 $holding[$y] = 1
  553.                 $char[$fretsline][$y] = $emptychar
  554.             endif
  555.             $score += $scorebase * $multiplier
  556.         elseif $char[$fretsline + 1][$y] == $hammeron Then
  557.             $strumposition = 1
  558.             $fault = 0
  559.             $char[$fretsline + 1][$y] = $emptychar
  560.             if $char[$fretsline + 2][$y] == $hold then
  561.                 $holding[$y] = 1
  562.                 $char[$fretsline + 1][$y] = $hold
  563.             endif
  564.             $score += $scorebase * $multiplier
  565.         endif
  566.     endif
  567.    
  568.     if $fault = 0 Then
  569.         $streak += 1
  570.         _updatemultiplier()
  571.         $totalnoteshit += 1
  572.         $pressedfrets[$y] = 1
  573.     endif
  574.    
  575.     if $streak > $higheststreak Then
  576.         $higheststreak = $streak
  577.     endif
  578. endfunc
  579.  
  580. func _strum() ;checks for valid strums, sets some $char and adjusts the streakmeter. Also sets holding.
  581.     if _ispressed(31) OR _ispressed(32) OR _ispressed(33) OR _ispressed(34) OR _ispressed(35) then
  582.         $fault = 0
  583.     else
  584.         $fault = 1
  585.     endif
  586.    
  587.     $strumposition = 0
  588.    
  589.     for $y = 1 to 5
  590.         $pressedfrets[$y] = _ispressed(30 + $y)
  591.         if $char[$fretsline+1][$y] == $normalnote OR $char[$fretsline+1][$y] == $hammeron OR $char[$fretsline+1][$y] == $starnote then
  592.             $strumposition = 1
  593.         endif
  594.     next
  595.        
  596.        
  597.     for $y = 1 to 5
  598.         if $char[$fretsline-1][$y] == $normalnote OR $char[$fretsline-1][$y] == $hammeron OR $char[$fretsline-1][$y] == $starnote then
  599.             $strumposition = -1
  600.         endif
  601.     next
  602.    
  603.    
  604.     for $y = 1 to 5
  605.         if $char[$fretsline][$y] == $normalnote OR $char[$fretsline][$y] == $hammeron OR $char[$fretsline][$y] == $starnote then
  606.             $strumposition = 0
  607.         endif
  608.     next
  609.    
  610.    
  611.     for $y = 1 to 5
  612.         $requirednotes[$y] = 0
  613.         if $char[$fretsline+$strumposition][$y] == $normalnote OR $char[$fretsline+$strumposition][$y] == $hammeron OR $char[$fretsline+$strumposition][$y] == $starnote Then
  614.             $requirednotes[$y] = 1
  615.         EndIf
  616.     next
  617.    
  618.     for $y = 1 to 5
  619.         if $pressedfrets[$y] <> $requirednotes[$y] Then
  620.             $fault = 1
  621.         EndIf
  622.     next
  623.        
  624.     if $fault = 0 then
  625.         $playednote = $totalticks
  626.         $streak += 1
  627.         _updatemultiplier()
  628.         $totalnoteshit += 1
  629.         if $streak > $higheststreak Then
  630.             $higheststreak = $streak
  631.         endif
  632.        
  633.         $star = 0
  634.         for $y = 1 to 5
  635.             if $char[$fretsline+$strumposition][$y] == $starnote Then
  636.                 $star = 1
  637.             EndIf
  638.            
  639.             if $requirednotes[$y] == 1 then
  640.                 $score += $scorebase * $multiplier
  641.                 switch $strumposition
  642.                 Case -1
  643.                     $char[$fretsline - 1][$y] = $emptychar
  644.                     if $char[$fretsline][$y] == $hold then
  645.                         $holding[$y] = 1
  646.                         $char[$fretsline][$y] = $emptychar
  647.                     endif
  648.                
  649.                 case 0
  650.                     $char[$fretsline][$y] = $emptychar
  651.                     if $char[$fretsline + 1][$y] == $hold then
  652.                         $holding[$y] = 1
  653.                     endif
  654.                
  655.                 case 1
  656.                     $char[$fretsline + 1][$y] = $emptychar
  657.                     if $char[$fretsline + 2][$y] == $hold then
  658.                         $holding[$y] = 1
  659.                         $char[$fretsline + 1][$y] = $hold
  660.                     endif
  661.                 endswitch
  662.             endif
  663.         next
  664.        
  665.         if $star == 1 then
  666.             if $starpower <= 75 then
  667.                 $starpower += 25
  668.             Else
  669.                 $starpower = 100
  670.             endif
  671.         endif
  672.        
  673.     Else
  674.         if $playednote > $totalticks - $fretsline Then
  675.             $openstrum = 1
  676.             for $y = 1 to 5
  677.                 if $requirednotes[$y] == 1 then
  678.                     $openstrum = 0
  679.                 EndIf
  680.             Next
  681.             if $openstrum = 1 Then
  682.                 $streak = 0
  683.             endif
  684.         else
  685.             $streak = 0
  686.             $multiplier = 1
  687.         endif
  688.     endif
  689. endfunc
  690.  
  691. func _updatemultiplier() ;checks $streak and sets $multiplier accordingly, also sets $maxmulti
  692.     switch $streak
  693.     case 0 to 9
  694.         $multiplier = 1
  695.     case 10 to 19
  696.         $multiplier = 2
  697.     case 20 to 29
  698.         $multiplier = 3
  699.     case 30 to 39
  700.         $multiplier = 4
  701.     endswitch
  702.    
  703.     if $starpowerenabled = 1 Then
  704.         $multiplier = $multiplier * 2
  705.     endif
  706.    
  707.     if $multiplier > $maxmulti Then
  708.         $maxmulti = $multiplier
  709.     endif
  710. endfunc
  711.  
  712. func _quitsong();quits the song by setting $totalticks over the limit, is called by ESC hotkey
  713.     $totalticks = $songlength + $boardlength
  714. endfunc
  715.  
  716. func _exit() ;exit
  717.     exit
  718. endfunc
  719.  
  720. _ini()
  721.  
  722. while True
  723.     sleep(1000)
  724. wend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement