Jump to content

Guitar Hero - in a GUI


_Kurt
 Share

Recommended Posts

I get that error too!

I've gotten it before on other things, so I just reinstalled AutoIt3... do I have to use beta 3.2.9.14 for it to work? is the current release (3.2.10.0) not backwards compatible?

C:\Users\Nathan\Desktop\GUItarHero\Prospeed.au3(13,32) : ERROR: $WM_PAINT previously declared as a 'Const'
Global Const $WM_PAINT = 0x000F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Nathan\Desktop\GUItarHero\Prospeed.au3(14,30) : ERROR: $GWL_STYLE previously declared as a 'Const'
Global Const $GWL_STYLE = -16
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Nathan\Desktop\GUItarHero\GUItar Hero.au3(25,10) : ERROR: can't open include file <GUIList.au3>
#include <GUIList.au3>
~~~~~~~~~^
C:\Users\Nathan\Desktop\GUItarHero\GUItar Hero.au3(511,52) : ERROR: _GUICtrlListSelectedIndex(): undefined function.
                            $Index = _GUICtrlListSelectedIndex($SongList)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Nathan\Desktop\GUItarHero\GUItar Hero.au3(512,54) : ERROR: _GUICtrlListGetText(): undefined function.
                            $Song  = _GUICtrlListGetText($SongList, $Index)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Nathan\Desktop\GUItarHero\GUItar Hero.au3 - 5 error(s), 0 warning(s)

EDIT: just uninstalled 3.2.10.0, 3.2.9.14, and SciTe. Then downloaded new installers for all three. Then reinstalled to a new location. Same result with Run and Beta Run...

Edited by crzftx
Link to comment
Share on other sites

Replace the errors with

$Index = _GUICtrlListBox_GetCurSel($SongList)
$Song  = _GUICtrlListBox_GetText($SongList, $Index)

Then remove the other 2 lines causing problems

Now the only problems I encountered is some of the time it shows the pictures then some of the time it just shows up as a black box.

Edited by Thatsgreat2345
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

i get this error message: sprite functon doesn't have the correct number of args

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

fixed the bug that causes black icon/pictures

prospeed can only handle 32 bitmaps in memory

in the function CreateF1Note() every time a new picture is loaded and does not free up the memory.

;;; GUItar Hero ;;;
;How To Play (if you don't already know)
;  Play the scrolling notes by pressing the corresponding
;  fret button on the guitar neck and simultaneously pressing
;  the strum bar.

;Controls:
;  Use 1,2,3,4 to hold down Green,Red,Yellow,Blue fret buttons.
;  Press {ENTER} to hit notes (enter is the strum bar).
;  There are currently no Hammer-on and Pull-offs.
;  There's also no Whammy Bar.

;HotStreaks:
;  -- Hit 1 Note = Earn 50 Points --
;  Hit >10 Notes in a row - x1 Multiplier + Black Text
;  Hit  10 Notes in a row - x2 Multiplier + Red Text
;  Hit  20 Notes in a row - x3 Multiplier + Green Text
;  Hit  30 Notes in a row - x4 Multiplier + Blue Text

; -- PRESS ESC TO PAUSE -- ;
;;;;;;;;;;;;;;;;;;;
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Misc.au3>
#include <String.au3>
#include <Prospeed.au3>
#include <GUIListBox.au3>

If NOT FileExists("Songs.au3") Then MsgBox(0,"","No Songs will work unless Songs.au3 is in the current directory" & @CRLF & "(" & @ScriptDir & ")")
HotKeySet("{ESC}", "Pause")
HotKeySet("{ENTER}", "HitNote")
HotKeySet("1", "_1")
HotKeySet("2", "_2")
HotKeySet("3", "_3")
HotKeySet("4", "_4")
Global $F1Pressed = 0, $F2Pressed = 0, $F3Pressed = 0, $F4Pressed = 0, $NoteStreak = 0
Global $F1Buttons[5], $F2Buttons[5], $F3Buttons[5], $F4Buttons[5]
Global $LOADED_SONG = "", $SONG_PLAYING = 0, $PAUSED = 0, $SCORE = 0, $MULTIPLIER = 1
Global $CheckMissed1 = 0, $CheckMissed2 = 0, $CheckMissed3 = 0, $CheckMissed4 = 0
$GUI = GUICreate("GUItar Hero", 607, 507)
GUISetBkColor(0xFFFFFF)
GuiCtrlCreatePic("Data\logo.gif", 505, 10, 90, 60)
$CreateF1  = GUICtrlCreateLabel("0", -100, -100, 10, 10)
$CreateF2  = GUICtrlCreateLabel("0", -110, -110, 10, 10)
$CreateF3  = GUICtrlCreateLabel("0", -120, -120, 10, 10)
$CreateF4  = GUICtrlCreateLabel("0", -130, -130, 10, 10)
$SongPlay  = GUICtrlCreateLabel("0", -140, -140, 10, 10)
$SongExit  = GUICtrlCreateLabel("0", -150, -150, 10, 10)
$LabelScore = GUICtrlCreateLabel("    Score:               0", 500, 90, 100, 50)
GUICtrlSetFont(-1,15, 500, 0, "Harlow Solid Italic")
$LabelNoteStreak = GUICtrlCreateLabel("Note Streak:          0", 500, 145, 100, 50)
GUICtrlSetFont(-1,14, 500, 0, "Harlow Solid Italic")
$LabelMultiplier = GUICtrlCreateLabel(" Multiplier:          x 1", 500, 200, 100, 50)
GUICtrlSetFont(-1,14, 500, 0, "Harlow Solid Italic")
$LoadSong = GUICtrlCreateButton("Load Song", 498, 420, 100, 20)
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$StartSong = GUICtrlCreateButton("Start Song", 498, 440, 100, 20)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
GUICtrlCreateLabel("_______________________",498,460,100,20)
$Exit = GUICtrlCreateButton("Exit", 498, 480, 100, 20)
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$GUI2 = GUICreate("PAUSED", 585, 508, -1, -1, $WS_POPUP)
GUISetBkColor(0x000000)
GUICtrlCreateLabel("PAUSED", 100, 10, 200)
GUICtrlSetFont(-1, 14, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$pos1 = WinGetPos($GUI)
$hwnd = GUICreate("",400,400,$pos1[0]+($pos1[2]/4),$pos1[1]+($pos1[3]/3),$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetBkColor(0xFF0000)
WinSetTrans($hwnd, "", 0)
$rgn = CreateTextRgn($hwnd,"GUItar Hero",75,"Arial Bold",1000)
SetWindowRgn($hwnd,$rgn)
GUISetState()
For $i = 0 To 255 Step 10
    WinSetTrans($hwnd, "", $i)
Next
Sleep(900)
For $i = 0 To 255 Step 10
    WinSetTrans($hwnd, "", 255-$i)
Next
GUIDelete($hwnd)
GUISetState(@SW_SHOW, $GUI)
Background(@ScriptDir & "\Data\backround.bmp", 1, -2, 497, 510)
;;1;;
$Pic1 = @ScriptDir & "\Data\F1.jpg"
$Pic_1 = loadsprite($Pic1)
$F1key = sprite($Pic_1, $hdc, 0, 0, 90, 60, 1, 1, 0, 50, 430)
SetSpriteSpeed($F1key, 0, 170)
$Pic1a = @ScriptDir & "\Data\F1pressed.jpg"
$Pic_1a = loadsprite($Pic1a)
$F1keya = sprite($Pic_1a, $hdc, 0, 0, 90, 60, 1, 1, 0, 50, 600)
SetSpriteSpeed($F1keya, 0, 170)
;;2;;
$Pic2 = @ScriptDir & "\Data\F2.jpg"
$Pic_2 = loadsprite($Pic2)
$F2key = sprite($Pic_2, $hdc, 0, 0, 90, 60, 1, 1, 0, 160, 430)
SetSpriteSpeed($F2key, 0, 170)
$Pic2a = @ScriptDir & "\Data\F2pressed.jpg"
$Pic_2a = loadsprite($Pic2a)
$F2keya = sprite($Pic_2a, $hdc, 0, 0, 90, 60, 1, 1, 0, 160, 600)
SetSpriteSpeed($F2keya, 0, 170)
;;3;;
$Pic3 = @ScriptDir & "\Data\F3.jpg"
$Pic_3 = loadsprite($Pic3)
$F3key = sprite($Pic_3, $hdc, 0, 0, 90, 60, 1, 1, 0, 270, 430)
SetSpriteSpeed($F3key, 0, 170)
$Pic3a = @ScriptDir & "\Data\F3pressed.jpg"
$Pic_3a = loadsprite($Pic3a)
$F3keya = sprite($Pic_3a, $hdc, 0, 0, 90, 60, 1, 1, 0, 270, 600)
SetSpriteSpeed($F3keya, 0, 170)
;;4;;
$Pic4 = @ScriptDir & "\Data\F4.jpg"
$Pic_4 = loadsprite($Pic4)
$F4key = sprite($Pic_4, $hdc, 0, 0, 90, 60, 1, 1, 0, 380, 430)
SetSpriteSpeed($F4key, 0, 170)
$Pic4a = @ScriptDir & "\Data\F4pressed.jpg"
$Pic_4a = loadsprite($Pic4a)
$F4keya = sprite($Pic_4a, $hdc, 0, 0, 90, 60, 1, 1, 0, 380, 600)
SetSpriteSpeed($F4keya, 0, 170)

$Spr1     = @ScriptDir & "\Data\F1Note.jpg"
$Sprite1  = loadsprite($Spr1)
$Spr2     = @ScriptDir & "\Data\F2Note.jpg"
$Sprite2  = loadsprite($Spr2)
$Spr3     = @ScriptDir & "\Data\F3Note.jpg"
$Sprite3  = loadsprite($Spr3)
$Spr4     = @ScriptDir & "\Data\F4Note.jpg"
$Sprite4  = loadsprite($Spr4)

While 1
    Sleep(15)
    If GUICtrlRead($CreateF1) = "1" Then
        CreateF1Note()
        GUICtrlSetData($CreateF1, "0")
    EndIf
    If GUICtrlRead($CreateF2) = "1" Then
        CreateF2Note()
        GUICtrlSetData($CreateF2, "0")
    EndIf
    If GUICtrlRead($CreateF3) = "1" Then
        CreateF3Note()
        GUICtrlSetData($CreateF3, "0")
    EndIf
    If GUICtrlRead($CreateF4) = "1" Then
        CreateF4Note()
        GUICtrlSetData($CreateF4, "0")
    EndIf
    If GUICtrlRead($SongPlay) = "1" AND AllSpritesAreDeleted() = 1 Then
        GUICtrlSetData($SongPlay, "0")
        GUICtrlSetData($LoadSong, "Load Song")
        $SONG_PLAYING = 0
        $pos1 = WinGetPos($GUI)
        $hwnd = GUICreate("",400,400,$pos1[0]+($pos1[2]/4),$pos1[1]+($pos1[3]/2),$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
        GUISetBkColor(0x00FF00)
        WinSetTrans($hwnd, "", 0)
        For $i = 0 To UBound($F1Buttons)-1
            $F1Buttons[$i] = ""
            $F2Buttons[$i] = ""
            $F3Buttons[$i] = ""
            $F4Buttons[$i] = ""
        Next
        $rgn = CreateTextRgn($hwnd,"Song Completed",50,"Arial",1000)
        SetWindowRgn($hwnd,$rgn)
        GUISetState()
        For $i = 0 To 255 Step 10
            WinSetTrans($hwnd, "", $i)
        Next
        Sleep(900)
        GUIDelete($hwnd)
    EndIf
    For $i = 0 To UBound($F1Buttons)-1
        If $F1Buttons[$i] <> "" Then
            $CheckMissed1 = HasSpriteArrived($F1Buttons[$i])
            If $CheckMissed1 = 1 Then
                $NoteStreak = 0
                DeleteSprite($F1Buttons[$i])
                $F1Buttons[$i] = ""
            EndIf
        EndIf
        If $F2Buttons[$i] <> "" Then
            $CheckMissed2 = HasSpriteArrived($F2Buttons[$i])
            If $CheckMissed2 = 1 Then
                $NoteStreak = 0
                DeleteSprite($F2Buttons[$i])
                $F2Buttons[$i] = ""
            EndIf
        EndIf
        If $F3Buttons[$i] <> "" Then
            $CheckMissed3 = HasSpriteArrived($F3Buttons[$i])
            If $CheckMissed3 = 1 Then
                $NoteStreak = 0
                DeleteSprite($F3Buttons[$i])
                $F3Buttons[$i] = ""
            EndIf
        EndIf
        If $F4Buttons[$i] <> "" Then
            $CheckMissed4 = HasSpriteArrived($F4Buttons[$i])
            If $CheckMissed4 = 1 Then
                $NoteStreak = 0
                DeleteSprite($F4Buttons[$i])
                $F4Buttons[$i] = ""
            EndIf
        EndIf
        If $CheckMissed1 = 1 OR $CheckMissed2 = 1 OR $CheckMissed3 = 1 OR $CheckMissed4 = 1 Then CheckNoteStreak()
        $CheckMissed1 = 0
        $CheckMissed2 = 0
        $CheckMissed3 = 0
        $CheckMissed4 = 0
    Next
    If WinActive($GUI) Then
        If _IsPressed("31") Then
            If $F1Pressed = 0 Then
                movesprite($F1keya, 50, 430)
                movesprite($F1key, 50, 600)
                $F1Pressed = 1
            EndIf
        Else
            If $F1Pressed = 1 Then
                movesprite($F1key, 50, 430)
                movesprite($F1keya, 50, 600)
                $F1Pressed = 0
            EndIf
        EndIf
        If _IsPressed("32") Then
            If $F2Pressed = 0 Then
                movesprite($F2keya, 50, 430)
                movesprite($F2key, 50, 600)
                $F2Pressed = 1
            EndIf
        Else
            If $F2Pressed = 1 Then
                movesprite($F2key, 50, 430)
                movesprite($F2keya, 50, 600)
                $F2Pressed = 0
            EndIf
        EndIf
        If _IsPressed("33") Then
            If $F3Pressed = 0 Then
                movesprite($F3keya, 270, 430)
                movesprite($F3key, 270, 600)
                $F3Pressed = 1
            EndIf
        Else
            If $F3Pressed = 1 Then
                movesprite($F3key, 270, 430)
                movesprite($F3keya, 270, 600)
                $F3Pressed = 0
            EndIf
        EndIf
        If _IsPressed("34") Then
            If $F4Pressed = 0 Then
                movesprite($F4keya, 380, 430)
                movesprite($F4key, 380, 600)
                $F4Pressed = 1
            EndIf
        Else
            If $F4Pressed = 1 Then
                movesprite($F4key, 380, 430)
                movesprite($F4keya, 380, 600)
                $F4Pressed = 0
            EndIf
        EndIf
    EndIf
    GUImsgs()
WEnd
Func _1()
    If WinActive($GUI) Then
    Else
        HotKeySet("1")
        Send("1")
        HotKeySet("1", "_1")
    EndIf
EndFunc
Func _2()
    If WinActive($GUI) Then
    Else
        HotKeySet("2")
        Send("2")
        HotKeySet("2", "_2")
    EndIf
EndFunc
Func _3()
    If WinActive($GUI) Then
    Else
        HotKeySet("3")
        Send("3")
        HotKeySet("3", "_3")
    EndIf
EndFunc
Func _4()
    If WinActive($GUI) Then
    Else
        HotKeySet("4")
        Send("4")
        HotKeySet("4", "_4")
    EndIf
EndFunc

Func CreateF1Note()
    $Smallest = GetSmallest($F1Buttons)
    $F1Buttons[$Smallest] = sprite($Sprite1, $hdc, 0, 0, 90, 60, 1, 1, 0, 50, -5)
    SetSpriteSpeed($F1Buttons[$Smallest], 0, 5)
    movesprite($F1Buttons[$Smallest], 50, 509)
EndFunc

Func CreateF2Note()
    $Smallest = GetSmallest($F2Buttons)
    $F2Buttons[$Smallest] = sprite($Sprite2, $hdc, 0, 0, 90, 60, 1, 1, 0, 160, -5)
    SetSpriteSpeed($F2Buttons[$Smallest], 0, 5)
    movesprite($F2Buttons[$Smallest], 160, 509)
EndFunc

Func CreateF3Note()
    $Smallest = GetSmallest($F3Buttons)
    $F3Buttons[$Smallest] = sprite($Sprite3, $hdc, 0, 0, 90, 60, 1, 1, 0, 270, -5)
    SetSpriteSpeed($F3Buttons[$Smallest], 0, 5)
    movesprite($F3Buttons[$Smallest], 270, 509)
EndFunc

Func CreateF4Note()
    $Smallest = GetSmallest($F4Buttons)
    $F4Buttons[$Smallest] = sprite($Sprite4, $hdc, 0, 0, 90, 60, 1, 1, 0, 380, -5)
    SetSpriteSpeed($F4Buttons[$Smallest], 0, 5)
    movesprite($F4Buttons[$Smallest], 380, 509)
EndFunc

Func GetSmallest($array)
    If IsArray($array) Then
        For $i = 0 To UBound($array)-1
            If $array[$i] = "" Then Return $i
        Next
    EndIf
EndFunc

Func HitNote()
    Local $NoteStreakCheck = 0
    If WinActive($GUI) Then
        If $PAUSED = 0 AND $SONG_PLAYING = 1 Then
            $1 = _IsPressed("31")
            $2 = _IsPressed("32")
            $3 = _IsPressed("33")
            $4 = _IsPressed("34")
            If $1 = 1 OR $2 = 1 OR $3 = 1 OR $4 = 1 Then
                Local $Check[4] = [-2,-2,-2,-2]
                For $i = 0 To UBound($F1Buttons)-1
                    If $F1Buttons[$i] <> "" Then
                        $GetY = GetSpriteY($F1Buttons[$i])
                        If $GetY > 410 AND $GetY < 500 Then $Check[0] = $i
                    EndIf
                    If $F2Buttons[$i] <> "" Then
                        $GetY = GetSpriteY($F2Buttons[$i])
                        If $GetY > 410 AND $GetY < 500 Then $Check[1] = $i
                    EndIf
                    If $F3Buttons[$i] <> "" Then
                        $GetY = GetSpriteY($F3Buttons[$i])
                        If $GetY > 410 AND $GetY < 500 Then $Check[2] = $i
                    EndIf
                    If $F4Buttons[$i] <> "" Then
                        $GetY = GetSpriteY($F4Buttons[$i])
                        If $GetY > 410 AND $GetY < 500 Then $Check[3] = $i
                    EndIf
                Next
                If $Check[0] = -2 AND $1 = 1 Then $Check[0] = -1
                If $Check[1] = -2 AND $2 = 1 Then $Check[1] = -1
                If $Check[2] = -2 AND $3 = 1 Then $Check[2] = -1
                If $Check[3] = -2 AND $4 = 1 Then $Check[3] = -1
                If $Check[0] = -1 OR $Check[1] = -1 OR $Check[2] = -1 OR $Check[3] = -1 Then
                Else
                    If $Check[0] <> -2 Then
                        DeleteSprite($F1Buttons[$Check[0]])
                        $F1Buttons[$Check[0]] = ""
                        $NoteStreakCheck = $NoteStreakCheck+1
                        $NoteStreak = $NoteStreak+1
                    EndIf
                    If $Check[1] <> -2 Then
                        DeleteSprite($F2Buttons[$Check[1]])
                        $F2Buttons[$Check[1]] = ""
                        $NoteStreakCheck = $NoteStreakCheck+1
                        $NoteStreak = $NoteStreak+1
                    EndIf
                    If $Check[2] <> -2 Then
                        DeleteSprite($F3Buttons[$Check[2]])
                        $F3Buttons[$Check[2]] = ""
                        $NoteStreakCheck = $NoteStreakCheck+1
                        $NoteStreak = $NoteStreak+1
                    EndIf
                    If $Check[3] <> -2 Then
                        DeleteSprite($F4Buttons[$Check[3]])
                        $F4Buttons[$Check[3]] = ""
                        $NoteStreakCheck = $NoteStreakCheck+1
                        $NoteStreak = $NoteStreak+1
                    EndIf
                EndIf
            EndIf
            If $NoteStreakCheck = 0 Then
                $NoteStreak = 0
            Else
                $SCORE = $SCORE+(($NoteStreakCheck*50)*$MULTIPLIER)
                GUICtrlSetData($LabelScore, "    Score:               " & $SCORE)
            EndIf
            CheckNoteStreak()
        EndIf
    Else
        HotKeySet("{ENTER}")
        Send("{ENTER}")
        HotKeySet("{ENTER}", "HitNote")
    EndIf
EndFunc

Func CheckNoteStreak()
    If $NoteStreak = 0 Then
        $MULTIPLIER = 1
        GUICtrlSetData($LabelMultiplier, " Multiplier:          x 1")
        GUICtrlSetColor($LabelMultiplier, 0x000000)
        GUICtrlSetColor($LabelNoteStreak, 0x000000)
        GUICtrlSetColor($LabelScore, 0x000000)
    EndIf
    If $NoteStreak = 10 Then
        $MULTIPLIER = 2
        GUICtrlSetData($LabelMultiplier, " Multiplier:          x 2")
        GUICtrlSetColor($LabelMultiplier, 0xAA0000)
        GUICtrlSetColor($LabelNoteStreak, 0xAA0000)
        GUICtrlSetColor($LabelScore, 0xAA0000)
    EndIf
    If $NoteStreak = 20 Then
        $MULTIPLIER = 3
        GUICtrlSetData($LabelMultiplier, " Multiplier:          x 3")
        GUICtrlSetColor($LabelMultiplier, 0x1CD900)
        GUICtrlSetColor($LabelNoteStreak, 0x1CD900)
        GUICtrlSetColor($LabelScore, 0x1CD900)
    EndIf
    If $NoteStreak = 30 Then
        $MULTIPLIER = 4
        GUICtrlSetData($LabelMultiplier, " Multiplier:          x 4")
        GUICtrlSetColor($LabelMultiplier, 0x0000FF)
        GUICtrlSetColor($LabelNoteStreak, 0x0000FF)
        GUICtrlSetColor($LabelScore, 0x0000FF)
    EndIf
    GUICtrlSetData($LabelNoteStreak, "Note Streak:          " & $NoteStreak)
EndFunc

Func Pause()
    If WinActive($GUI) OR WinActive($GUI2) Then
        If $SONG_PLAYING = 1 Then
            If $PAUSED = 0 Then
                PauseSprites(0)
                $PAUSED = 1
                Local $WinPos = WinGetPos($GUI)
                WinMove($GUI2, "", $WinPos[0], $WinPos[1], $WinPos[2], $WinPos[3])
                GUISetState(@SW_SHOW, $GUI2)
                GUISetState(@SW_HIDE, $GUI)
                While $PAUSED = 1
                    Sleep(50)
                WEnd
                PauseSprites(1)
                GUISetState(@SW_HIDE, $GUI2)
                GUISetState(@SW_SHOW, $GUI)
            Else
                $PAUSED = 0
            EndIf
        EndIf
    Else
        HotKeySet("{ESC}")
        Send("{ESC}")
        HotKeySet("{ESC}", "Pause")
    EndIf
EndFunc

Func PauseSprites($A)
    If $A = 0 Then
        For $i = 0 To UBound($F1Buttons)-1
            If $F1Buttons[$i] <> "" Then SetSpriteSpeed($F1Buttons[$i], 0, 0)
            If $F2Buttons[$i] <> "" Then SetSpriteSpeed($F2Buttons[$i], 0, 0)
            If $F3Buttons[$i] <> "" Then SetSpriteSpeed($F3Buttons[$i], 0, 0)
            If $F4Buttons[$i] <> "" Then SetSpriteSpeed($F4Buttons[$i], 0, 0)
        Next
    Else
        For $i = 0 To UBound($F1Buttons)-1
            If $F1Buttons[$i] <> "" Then SetSpriteSpeed($F1Buttons[$i], 0, 4)
            If $F2Buttons[$i] <> "" Then SetSpriteSpeed($F2Buttons[$i], 0, 4)
            If $F3Buttons[$i] <> "" Then SetSpriteSpeed($F3Buttons[$i], 0, 4)
            If $F4Buttons[$i] <> "" Then SetSpriteSpeed($F4Buttons[$i], 0, 4)
        Next
    EndIf
EndFunc

Func GUImsgs()
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE OR $msg = $Exit
            Exit
        Case $msg = $StartSong
            $SCORE = 0
            $NoteStreak = 0
            CheckNoteStreak()
            GUICtrlSetData($LabelScore, "    Score:               " & $SCORE)
            Run(@AutoItExe & " Songs.au3 " & $LOADED_SONG)
            GUICtrlSetState($StartSong, $GUI_DISABLE)
            GUICtrlSetData($LoadSong, "End Song")
            $SONG_PLAYING = 1
        Case $msg = $LoadSong
            If GUICtrlRead($LoadSong) = "Load Song" Then
                $SongGUI = GuiCreate("Load Song..", 212, 205,-1, -1, "", "", $GUI)
                WinSetState($GUI, "", @SW_DISABLE)
                $SongList = GuiCtrlCreateList("", 20, 10, 170, 123)
                $OK = GuiCtrlCreateButton("OK", 20, 150, 80, 20)
                $Cancel = GuiCtrlCreateButton("Cancel", 110, 150, 80, 20)
                ListAllSongs($SongList)
                GuiSetState()
                While 1
                    $msg = GuiGetMsg()
                    Select
                        Case $msg = $GUI_EVENT_CLOSE OR $msg = $Cancel
                            WinSetState($GUI, "", @SW_ENABLE)
                            GUIDelete($SongGUI)
                            ExitLoop
                        Case $msg = $OK
                            GUICtrlSetState($StartSong, $GUI_ENABLE)
                            $Index = _GUICtrlListBox_GetCurSel($SongList)
                            $Song  = _GUICtrlListBox_GetText($SongList, $Index)
                            $LOADED_SONG = $Song
                            WinSetState($GUI, "", @SW_ENABLE)
                            GUIDelete($SongGUI)
                            ExitLoop
                    EndSelect
                WEnd
            Else
                GUICtrlSetData($SongExit, "1")
                While GUICtrlRead($SongExit) = "1"
                    Sleep(50)
                WEnd
                DeleteAllNotes()
                GUICtrlSetData($LoadSong, "Load Song")
            EndIf
    EndSelect
EndFunc

Func DeleteAllNotes()
    For $i = 0 To UBound($F1Buttons)-1
        If $F1Buttons[$i] <> "" Then DeleteSprite($F1Buttons[$i])
        If $F2Buttons[$i] <> "" Then DeleteSprite($F2Buttons[$i])
        If $F3Buttons[$i] <> "" Then DeleteSprite($F3Buttons[$i])
        If $F4Buttons[$i] <> "" Then DeleteSprite($F4Buttons[$i])
    Next
EndFunc

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000)
    Local Const $ANSI_CHARSET = 0
    Local Const $OUT_CHARACTER_PRECIS = 2
    Local Const $CLIP_DEFAULT_PRECIS = 0
    Local Const $PROOF_QUALITY = 2
    Local Const $FIXED_PITCH = 1
    Local Const $RGN_XOR = 3
    If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif"
    If $CTR_weight = -1 Then $CTR_weight = 1000
    Local $gdi_dll = DLLOpen("gdi32.dll")
    Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd)
    Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _
                "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _
                "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font )
    Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0])
    DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text))
    DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0])
    Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0])
    Local $CTR_rc = DLLStructCreate("int;int;int;int")
    DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc))
    Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc))
    DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR)
    DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0])
    DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0])
    DLLClose($gdi_dll)
    Return $CTR_hRgn2[0]
EndFunc

Func ListAllSongs($ListControl)
    If NOT FileExists("Songs.au3") Then
        MsgBox(0,"","     ERROR: Songs.au3 not found." & @CRLF & "Make sure it's in the same directory.")
        Return
    EndIf
    $Read = FileRead("Songs.au3")
    $Read = StringStripCR($Read)
    $Read = StringReplace($Read, "EndFunc", "")
    $Between = _StringBetween($Read, "Func", "()")
    For $i = 0 To UBound($Between)-7
        GUICtrlSetData($ListControl, $Between[$i], 1)
    Next
EndFunc

Func AllSpritesAreDeleted()
    For $i = 0 To UBound($F1Buttons)-1
        If $F1Buttons[$i] <> "" OR $F2Buttons[$i] <> "" OR $F3Buttons[$i] <> "" OR $F4Buttons[$i] <> "" Then
            Return 0
        EndIf
    Next
    Return 1
EndFunc

Func OnAutoItExit()
    DeleteAllSprites()
    Close_DLL()
EndFunc
Link to comment
Share on other sites

i get this error message: sprite functon doesn't have the correct number of args

the sprite function has a extra parameter "destination"

it is the second para in the sprite function

i made that , so it is easy'er to put sprites on controls

$F4keya = sprite($Pic_4a, $hdc, 0, 0, 90, 60, 1, 1, 0, 380, 600)

download the last prospeed udf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...