Sign in to follow this  
Followers 0
Achilles

Picture Puzzle

23 posts in this topic

#1 ·  Posted (edited)

Results of being bored!

Should be very bug free.. Let me know if you find any.

I've beaten it on everything but insane...

Thoughts for things to do... (add if you have any)

  • Add move counter (done - not released yet)
  • Keep track of lowest # of moves minimum for each difficulty (done - not released yet)
  • Use icons of some sort instead of ! and +
  • Prettier win screen
  • Save progress on exit and load it on startup
  • Fix a bug with file's not existing anymore
  • Compile it with a pretty icon (very important)
  • Add some sort of statistics/about button
  • I seem to think better at night... I couldn't think of many improvements during the day

Here are some sample images to run it on:

post-14131-12539246220281_thumb.jpg post-14131-1253924634932_thumb.gif post-14131-12539252094915_thumb.jpg

#region *** INCLUDES, OPTS, GLOBAL VARIABLES, INITIAL SETUP, and LOOP ***
#noTrayIcon
#Include <Array.au3>
#include <ComboConstants.au3>
#Include <File.au3>
#include <GDIPlus.au3>
#Include <GUIComboBox.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

Opt('GUIOnEventMode', 1)
Opt('GUICloseOnESC', 1)

Global Const $MOVE_UP = 1, $MOVE_RIGHT = 2, $MOVE_DOWN = 3, $MOVE_LEFT = 4
Global Const $X_CENTER = @DesktopWidth / 2, $Y_CENTER = @DesktopHeight / 2
Global Const $MIN_WIDTH = 446
Global Const $CHILD_EX_STYLE = BitOr($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW, $WS_EX_MDICHILD)
Global Const $GUI_X_BTN_SIZE = 26
Global Const $FILE_IN_LIST = 2, $FILE_NO_PASS = 0, $FILE_PASSES = 1

Global Const $CLICK_SOUND = @WindowsDir & '\media\Windows Menu Command.wav'
Global Const $WIN_SOUND = @WindowsDir & '\media\tada.wav'

Global Const $IMAGE_DUMP = @ScriptDir & '\dump'
DirCreate($IMAGE_DUMP)

Global $cmbDiff, $cmbFile, $guiMain
Global $idDiff = -1 ; reference to the first pictures CTRL ID
Global $xSqSize, $ySqSize, $xRatio, $yRatio
Global $row, $col
Global $squares, $guiList
Global $difficulty
Global $gameWon
Global $soundEnabled = True

Global $fileList, $fullFileList

_ToolGUI()

While 1 
    Sleep(200) 
WEnd
#endregion
#region *** EVENT TRIGGERED FUNCTIONS ***
Func _Click() ; called only when one of the squares is clicked
    If $gameWon then 
        _Shuffle()
        Return
    EndIf
    
    $pieceClicked = @GUI_CtrLId - $idDiff + 1
    
    $adjBlank = _AdjacentIsBlank($pieceClicked)
    
    If $adjBlank < 0 then Return

    If $soundEnabled then SoundPlay($CLICK_SOUND)

    $moveSpeed = 2
    $cPos = WinGetPos($guiList[$pieceClicked])
    
    Switch $adjBlank 
        Case $MOVE_UP 
            WinMove($guiList[$pieceClicked], '', $cPos[0], $cPos[1] - $cPos[3], $cPos[2], $cPos[3], $moveSpeed)
            $squares[$row][$col] = ''
            $squares[$row - 1][$col] = $pieceClicked
        Case $MOVE_RIGHT 
            WinMove($guiList[$pieceClicked], '', $cPos[0] + $cPos[2], $cPos[1] , $cPos[2], $cPos[3], $moveSpeed)
            $squares[$row][$col] = ''
            $squares[$row][$col + 1] = $pieceClicked
        Case $MOVE_DOWN 
            WinMove($guiList[$pieceClicked], '', $cPos[0], $cPos[1] + $cPos[3], $cPos[2], $cPos[3], $moveSpeed)
            $squares[$row][$col] = ''
            $squares[$row + 1][$col] = $pieceClicked
        Case $MOVE_LEFT 
            WinMove($guiList[$pieceClicked], '', $cPos[0] - $cPos[2], $cPos[1], $cPos[2], $cPos[3], $moveSpeed)
            $squares[$row][$col] = ''
            $squares[$row][$col - 1] = $pieceClicked
    EndSwitch 
    
    If _GameWon() then 
        If $soundEnabled then SoundPlay($WIN_SOUND)
        Msgbox(0, '', 'You won!')
        $i = $difficulty * $difficulty
        $guiList[$i + 1] = GUICreate($i + 1, $xSqSize - 2, $ySqSize - 2, (($difficulty - 1) * $xSqSize + 5), ($difficulty - 1) * $ySqSize + 56, $WS_POPUPWINDOW, $CHILD_EX_STYLE, $guiMain)
        GUICtrlCreatePic($IMAGE_DUMP & '\image clone (' & $i & ').bmp', 0, 0, $xSqSize, $ySqSize) 
            GUICtrlSetOnEvent(-1, '_Shuffle')
        GUISetState()
        $gameWon = True
    EndIf
EndFunc 

Func _Exit() ; called only when the user clicks the Exit (or some other form of exit)
    _FileWriteFromArray($IMAGE_DUMP & '\past.txt', $fullFileList, 1)
    FileDelete($IMAGE_DUMP & '\set.txt')
    FileWriteLine($IMAGE_DUMP & '\set.txt', GUICtrlRead($cmbDiff))
    Exit 
EndFunc 

Func _FileDropped() ; called only when a file is dropped onto the combo box
    _AddFile(@GUI_DragFile)
EndFunc

Func _FileSelect() ; called only when the user clicks the "add file" button
    $file = FileOpenDialog('Select an image...', @MyDocumentsDir, 'Images (*.jpg;*.bmp;*.gif)', 3)
    _AddFile($file)
EndFunc

Func _Shuffle() ; called by WM_COMMAND (user changes difficulty or changes file selection), _AddFile, and by _Click (if game is won)
    $gameWon = False 
    $filePath = _GetActualFile(GUICtrlRead($cmbFile))

    If _FilePasses($filePath) = $FILE_NO_PASS then Return 

    _Clear()

    _GDIPlus_StartUp ()
    $hImage = _GDIPlus_BitmapCreateFromFile ($filePath)
    
    $temp = GUICtrlRead($cmbDiff) 
    Switch $temp 
        Case 'Easy' 
            $difficulty = 3
        Case 'Medium' 
            $difficulty = 4
        Case 'Hard' 
            $difficulty = 5
        Case 'Insane' 
            $difficulty = 6
    EndSwitch

    Dim $squares[$difficulty + 2][$difficulty + 2]
        For $i = 0 to $difficulty + 1 ; creates a buffer
            $squares[0][$i] = -2 
            $squares[$difficulty + 1][$i] = -2 
            $squares [$i][0] = -2
            $squares[$i][$difficulty + 1] = -2
        Next 
    Dim $guiList[$difficulty * $difficulty + 2] ; base 1 array
    $guiList[$difficulty * $difficulty + 1] = -1

    $xWidth = _GDIPlus_ImageGetWidth ($hImage)  
    $yHeight = _GDIPlus_ImageGetHeight ($hImage)
    $xSqSize = Floor($xWidth / $difficulty)
    $ySqSize = Floor($yHeight / $difficulty) 

    If $xWidth >  (7 * @DesktopWidth) / 8 then 
        $xRatio = ((7 * @DesktopWidth) / 8) / $xWidth
        $xWidth = Ceiling((7 * @DesktopWidth) / 8)
    Else 
        $xRatio = 1
    EndIf
    $xSqSize = Ceiling($xRatio * $xSqSize)
    
    If $yHeight > (13 * @DesktopHeight) / 16 then 
        $yRatio = ((13 * @DesktopHeight) / 16) / $yHeight
        $yHeight = Ceiling((13 * @DesktopHeight) / 16)
    Else 
        $yRatio = 1
    EndIf 
    $ySqSize = Ceiling($yRatio * $ySqSize)

    If $xWidth < $MIN_WIDTH then $xWidth = $MIN_WIDTH 
    
    WinMove($guiMain, '',  $X_CENTER - ($xWidth / 2) - 8, $Y_CENTER - ($yHeight / 2) - 70, $xWidth + 16, $yHeight + 62)
    GUICtrlSetPos($cmbDiff, $xWidth - 84, 5, 90, 22)
    GUICtrlSetPos($cmbFile, 12 + 2 * $GUI_X_BTN_SIZE, 5, $xWidth - (9 + 2 * $GUI_X_BTN_SIZE + 92), 22)

    For $i = 0 to ($difficulty * $difficulty) - 1
        $xBase = Mod($i + $difficulty, $difficulty)
        $yBase = Floor($i / $difficulty)
        
        $xStart = $xBase * $xSqSize
        $yStart = $yBase * $ySqSize

        $hClone = _GDIPlus_BitmapCloneArea ($hImage, $xStart, $yStart, $xSqSize, $ySqSize, $GDIP_PXF24RGB)

        _GDIPlus_ImageSaveToFile ($hClone, $IMAGE_DUMP & '\image clone (' & $i + 1 & ').bmp')
        _GDIPlus_ImageDispose ($hClone) 
        
        If $i <> ($difficulty * $difficulty) - 1 then 
            $pass = False 
            $xR = -1
            $yR = -1
            Do 
                $xR = Random(1, $difficulty, 1)
                $yR = Random(1, $difficulty, 1)
                $temp = $squares[$xR][$yR] 
                If $temp = '' then $pass = True 
            Until $pass
            
            $squares[$xR][$yR] = $i + 1
            
            $guiList[$i + 1] = GUICreate($i + 1, $xSqSize - 2, $ySqSize - 2, ($yR - 1) * $xSqSize + 5, ($xR - 1) * $ySqSize + 56, $WS_POPUPWINDOW, $CHILD_EX_STYLE, $guiMain)
        
            If $i = 0 then 
                $idDiff = GUICtrlCreatePic($IMAGE_DUMP & '\image clone (' & $i + 1 & ').bmp', 0, 0, $xSqSize, $ySqSize) 
            Else 
                GUICtrlCreatePic($IMAGE_DUMP & '\image clone (' & $i + 1 & ').bmp', 0, 0, $xSqSize, $ySqSize) 
            EndIf 
            
            GUICtrlSetOnEvent(-1, '_Click')
            
            GUISetState()
            
        EndIf 
    Next
    
    _GDIPlus_ImageDispose ($hImage)
    _GDIPlus_ShutDown ()
    
EndFunc

Func _ToggleSound() ; called only when the user click the "toggle sound" button
    $soundEnabled = Not $soundEnabled 
    
    If $soundEnabled then 
        GUICtrlSetData(@GUI_CtrlId, '!') 
        GUICtrlSetTip(@GUI_CtrlId, 'Disable sound') 
    Else 
        GUICtrlSetData(@GUI_CtrlId, '') 
        GUICtrlSetTip(@GUI_CtrlId, 'Enable sound') 
    EndIf 
    
EndFunc 
#endregion
#region *** GAME SETUP FUNCTIONS ****
Func _PopulateFileList() ; called only by _ToolGUI when the game is first loading
    If Not FileExists($IMAGE_DUMP & '\past.txt') then 
        Dim $fileList[1]
        Dim $fullFileList[1]
        $fileList[0] = 0
        $fullFileList[0] = 0
        Return
    EndIf 
    
    _FileReadToArray($IMAGE_DUMP & '\past.txt', $fileList)
    If Not IsArray($fileList) then
        Dim $fileList[1]
        Dim $fullFileList[1]
        $fileList[0] = 0
        $fullFileList[0] = 0
        Return
    EndIf
        
    Dim $fullFileList[$fileList[0] + 1]
    $fullFileList[0] = $fileList[0]

    $tempSub = 0
    For $i = 1 to $fileList[0] 
        If Not (_FilePasses($fileList[$i]) = $FILE_PASSES) then 
            $tempSub += 1
            _ArrayDelete($fileList, $i) 
            _ArrayDelete($fullFileList, $i)
        Else 
            $fullFileList[$i] = $fileList[$i]
            $fileList[$i] = _GetFileName($fileList[$i])
        EndIf 
    Next 
    $fileList[0] -= $tempSub
    $fullFileList[0] -= $tempSub 
    
    _ResetComboData()
EndFunc 

Func _ToolGUI() ; called only once at startup
    $guiMain = GUICreate('Picture Puzzle', $MIN_WIDTH + 10, $GUI_X_BTN_SIZE + 8, $X_CENTER - ($MIN_WIDTH / 2) - 5, -1, -1,  $WS_EX_ACCEPTFILES)
        GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
        GUISetOnEvent($GUI_EVENT_DROPPED, '_FileDropped')
    
    GUISetFont(10)
    
    GUICtrlCreateButton('!', 4, 4, $GUI_X_BTN_SIZE, $GUI_X_BTN_SIZE)
        GUICtrlSetTip(-1, 'Disable sound') 
        GUICtrlSetOnEvent(-1, '_ToggleSound') 
        GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) 
        
    GUICtrlCreateButton('+', 7 + $GUI_X_BTN_SIZE, 4, $GUI_X_BTN_SIZE, $GUI_X_BTN_SIZE)
        GUICtrlSetTip(-1, 'Select a file') 
        GUICtrlSetOnEvent(-1, '_FileSelect') 
        GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) 

    $temp = FileReadLine($IMAGE_DUMP & '\set.txt', 1)
    If Not ($temp = 'Easy' or $temp = 'Medium' or $temp = 'Hard' or $temp = 'Insane') then $temp = 'Easy'

    $cmbDiff = GUICtrlCreateCombo('', $MIN_WIDTH - 84, 5, 90, 22, $CBS_DROPDOWNLIST) 
        GUICtrlSetData(-1, 'Easy|Medium|Hard|Insane', $temp)
        GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
        GUICtrlSetTip(-1, 'Change difficulty')

    $cmbFile = GUICtrlCreateCombo('', 12 + 2 * $GUI_X_BTN_SIZE, 5, 292, 22, BitOR($CBS_SORT, $CBS_DROPDOWNLIST))
        GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
        GUICtrlSetTip(-1, 'Drag files here to start a puzzle...')
        GUICtrlSetState(-1, $GUI_DROPACCEPTED)
        
    GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
    
    _PopulateFileList()
    
    GUISetState()
EndFunc
#endregion
#region *** CHECKS ***
Func _AdjacentIsBlank($num) ; called only by _Click
    ;get the row and column that $num is in 
    For $i = 1 to $difficulty
        For $j = 1 to $difficulty
            If $squares[$i][$j] = $num then 
                $row = $i
                $col = $j
                ExitLoop 2
            EndIf 
        Next 
    Next
    
    If $squares[$row - 1][$col] = '' then Return $MOVE_UP 
    If $squares[$row + 1][$col] = '' then Return $MOVE_DOWN 
    If $squares[$row][$col - 1] = '' then Return $MOVE_LEFT
    If $squares[$row][$col + 1] = '' then Return $MOVE_RIGHT
    Return -1
EndFunc

Func _FilePasses($file) ; called by _PopulateFileList, _AddFile, and _Shuffle
    If Not FileExists($file) then Return $FILE_NO_PASS
        
    $ext = StringRight($file, 3) 
    If $ext <> 'bmp' and $ext <> 'jpg' and $ext <> 'gif' then Return $FILE_NO_PASS 
        
    If _ArraySearch($fileList, _GetFileName($file), 1) <> -1 then Return $FILE_IN_LIST
    
    Return $FILE_PASSES 
EndFunc 

Func _GameWon() ; called only by _Click
    $count = 1
    For $i = 1 to $difficulty
        For $j = 1 to $difficulty 
            If $count = $difficulty * $difficulty then Return True
            If $squares[$i][$j] <> $count then 
                Return False 
            EndIf 
            $count += 1
        Next 
    Next 
    
    Return True 
EndFunc
#endregion 
#region *** HELPERS *** 
Func _AddFile($file) ; called only by _FileDropped and _FileSelect
    $pass = _FilePasses($file)
    
    If $pass = $FILE_NO_PASS then Return
    
    If $pass = $FILE_PASSES then 
        _AddFileToArray($file)
    Else ;else the item will be activated but not added to the list because it's already there
        $index = _GUICtrlComboBox_FindString($cmbFile, _GetFileName($file)) 
        _GUICtrlComboBox_SetCurSel($cmbFile, $index)
    EndIf 
    
    _Shuffle()
EndFunc 

Func _AddFileToArray($file) ; called only by _AddFile
    _ArrayAdd($fullFileList, $file)
    $file = _GetFileName($file)
    _ArrayAdd($fileList, $file) 
    
    $fileList[0] += 1
    $fullFileList[0] += 1

    
    $string = ''
    For $i = 1 to $fileList[0] 
        $string &= $fileList[$i] & '|' 
    Next 
    $string = StringTrimRight($string, 1) 
    
    GUICtrlSetData($cmbFile, '')
    GUICtrlSetData($cmbFile, $string, $file)
EndFunc     

Func _Clear() ; called only by _Shuffle
    If IsArray($guiList) then 
        For $i = 1 to $difficulty * $difficulty - 1
            GUIDelete($guiList[$i]) 
        Next

        If $guiList[$difficulty * $difficulty + 1] <> -1 then 
            GUIDelete($guiList[$difficulty * $difficulty + 1]) 
        EndIf 
    EndIf 
EndFunc

Func _GetActualFile($disp) ; called only by _Shuffle
    For $i = 1 to $fullFileList[0] 
        If _GetFileName($fullFileList[$i]) = $disp then 
            Return $fullFileList[$i] 
        EndIf 
    Next
    Return ''
EndFunc 

Func _GetFileName($file) ; assumes file exists
    $split = StringSplit($file, '\')
    Return $split[$split[0]]
EndFunc

Func _ResetComboData() ; called only by _PopulateFileList
    $string = ''
    For $i = 1 to $fileList[0] 
        $string &= $fileList[$i] & '|' 
    Next 
    $string = StringTrimRight($string, 1) 

    GUICtrlSetData($cmbFile, $string)   
EndFunc

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) ; checks for combo box activity
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    If $iCode = $CBN_SELCHANGE then 
        Switch $hWndFrom
            Case GUICtrlGetHandle($cmbDiff)
                _Shuffle() 
            Case GUICtrlGetHandle($cmbFile) 
                _Shuffle()
        EndSwitch
    EndIf 
            
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
#endregion
Edited by Achilles

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



@Achilles

Nice :D

I would replace the blank part by the missing picture part with some transparency, so when you have won, you can see the entire picture :D

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

A few things...

1) Droppings a pain, any chance of a fileopendialog in there?

2) changing the info whilst ingame doesn't change anything, to be able to change the difficulty instantly would be a nice touch

Other than that... Very nice! I managed to complete easy pretty fast, i'll try the others sometime.

Mat

Share this post


Link to post
Share on other sites

I played with some time, and say that it is well done. And it was not boring. :D

Thanks.

Thanks!

@Achilles

Nice :D

I would replace the blank part by the missing picture part with some transparency, so when you have won, you can see the entire picture :D

Cheers, FireFox.

Hmm, I'll try it out.. I think it will look confusing but we'll see. I was kind of thinking of adding the last piece in when you complete the puzzle.

A few things...

1) Droppings a pain, any chance of a fileopendialog in there?

2) changing the info whilst ingame doesn't change anything, to be able to change the difficulty instantly would be a nice touch

Other than that... Very nice! I managed to complete easy pretty fast, i'll try the others sometime.

Mat

Sure, I'll add a little button to make adding stuff easier. I didn't have difficulty change immediately, but if you click shuffle it will. I think I will change so that it automatically updates.

@Everyone: Thanks for the comments

I'll be adding a function that automatically resizes pictures so that tiny ones are a bit bigger and huge ones are able to fit reasonably on your desktop.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Updated

Changes that I remember:

-Huge images get resized

-Sound option has been added (if someone could let me know if this works in XP/Vista that would be nice)

-Image is automatically shuffled when difficulty is changed or an image is selected

-Image select button added

-When the game is won, the last piece will be displayed with the rest of the puzzle

-Toolbar GUI doesn't get messed up when it shrinks (because it doesn't get smaller than a set size)


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Updated

Changes that I remember:

-Huge images get resized

-Sound option has been added (if someone could let me know if this works in XP/Vista that would be nice)

-Image is automatically shuffled when difficulty is changed or an image is selected

-Image select button added

-When the game is won, the last piece will be displayed with the rest of the puzzle

-Toolbar GUI doesn't get messed up when it shrinks (because it doesn't get smaller than a set size)

Marvelous program. Reminds me of why I didn't like that game as a kid. :D

Sound works on Vista - provided the sound is click.

Share this post


Link to post
Share on other sites

No sound in xp, but I may have disabled it myself... :D

Those other additions are very nice though, I like it so much it's now on my start menu as my new "Play when bored" game!

Next on your list of things to do:

1) Write to ini the list of pictures used and turn the edit into a combo box where you can select previous items.

2) Picture button for the sound, the "!" is cool, but for such a dynamic program with images etc, it looks a bit out of place

3) changing difficulty before selecting the file brings up a msgbox, just change your "Case $CBN_SELCHANGE" and then "Shuffle" to have an extra if test: "If GUICtrlRead ($txtpath) <> "Drop a picture here..." Then _Shuffle".

Other than that, its getting close to perfection!

Mat

Share this post


Link to post
Share on other sites

No sound in xp, but I may have disabled it myself... :D

Those other additions are very nice though, I like it so much it's now on my start menu as my new "Play when bored" game!

Next on your list of things to do:

1) Write to ini the list of pictures used and turn the edit into a combo box where you can select previous items.

2) Picture button for the sound, the "!" is cool, but for such a dynamic program with images etc, it looks a bit out of place

3) changing difficulty before selecting the file brings up a msgbox, just change your "Case $CBN_SELCHANGE" and then "Shuffle" to have an extra if test: "If GUICtrlRead ($txtpath) <> "Drop a picture here..." Then _Shuffle".

Other than that, its getting close to perfection!

Mat

About the sound, could you check if those files actually exist on XP? The clicksound is @WindowsDir & '\media\Windows Menu Command.wav' and the win sound is same dir but tada.wav

I'll do numbers 1 & 2 later tonight probably.

Changed number 3. Thanks for that suggestion.

I also fixed a bug where if you win, then change difficulty you're next click would shuffle the already shuffled picture.

I added a limitation to only .gif, .bmp, and .jpg image types. Are there any others I should add?


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

They're both in there... Tada.wav works in program (I won!!), but the menu command doesn't.

I can't wait to see this completely done!

Mat

Share this post


Link to post
Share on other sites

Updated

There is probably a bug with choosing files in different directories with the same file name... I'm still thinking about what to do with those.

Changes:

  • Now remembers what difficulty you were at
  • Now remembers the files you've used
  • A few size things were fixed

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Updated

- Organized the code for the most part (added regions and functions are in alphabetical order)

- Added a few functions to reduce repetitive code

- Fixed the bug with same file being dropped on the combo


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

>"H:\Programme\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "H:\AutoIt\Puzzle\puzzle.au3" /autoit3dir "h:\Programme\AutoIt3" /UserParams

+>04:08:15 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0407 Keyboard:00000407 OS:WIN_XP/Service Pack 3 CPU:X86 ANSI)

>Running AU3Check (1.54.19.0) from:h:\Programme\AutoIt3

+>04:08:15 AU3Check ended.rc:0

>Running:(3.3.0.0):h:\Programme\AutoIt3\autoit3.exe "H:\AutoIt\Puzzle\puzzle.au3"

!>04:08:20 AutoIT3.exe ended.rc:-1073741819

+>04:08:22 AutoIt3Wrapper Finished

>Exit code: -1073741819 Time: 6.904

I used one of your pictures.

Share this post


Link to post
Share on other sites

>"H:\Programme\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "H:\AutoIt\Puzzle\puzzle.au3" /autoit3dir "h:\Programme\AutoIt3" /UserParams

+>04:08:15 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0407 Keyboard:00000407 OS:WIN_XP/Service Pack 3 CPU:X86 ANSI)

>Running AU3Check (1.54.19.0) from:h:\Programme\AutoIt3

+>04:08:15 AU3Check ended.rc:0

>Running:(3.3.0.0):h:\Programme\AutoIt3\autoit3.exe "H:\AutoIt\Puzzle\puzzle.au3"

!>04:08:20 AutoIT3.exe ended.rc:-1073741819

+>04:08:22 AutoIt3Wrapper Finished

>Exit code: -1073741819 Time: 6.904

I used one of your pictures.

I'm having problems reproducing this error. Does the program start? Or does it crash as soon as you try starting it?

If anyone else is getting this problem let me know.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

It starts. I see the GUI. I click on the + Button and add a picture. Then there's the error. GUI closes and no error message.

Share this post


Link to post
Share on other sites

It starts. I see the GUI. I click on the + Button and add a picture. Then there's the error. GUI closes and no error message.

Hmmm.. could you run this code and see what happens:

$file = FileOpenDialog('Select an image...', @MyDocumentsDir, 'Images (*.jpg;*.bmp;*.gif)', 3)
Msgbox(0, '', $file)
I think that this might now work with XP, but I'm not sure.

Under Win7 32-Bit, the puzzle pieces overlap the window at the bottom. Posted Image

I know, I realized that a while ago.. I'll fix it sometime soon. I'm guessing this happens in all operating systems but I'm not sure.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

$file = correct path

Why should this work with XP? It's the same code.

Maybe I missunderstood something, here are the two codes:

Func _FileSelect() ; called only when the user clicks the "add file" button
    $file = FileOpenDialog('Select an image...', @MyDocumentsDir, 'Images (*.jpg;*.bmp;*.gif)', 3)
    _AddFile($file)
EndFunc

Func _FileSelect() ; called only when the user clicks the "add file" button
     $file = FileOpenDialog('Select an image...', @MyDocumentsDir, 'Images (*.jpg;*.bmp;*.gif)', 3) 
     Msgbox(0, '', $file)
    _AddFile($file)
EndFunc
Edited by Franzi

Share this post


Link to post
Share on other sites

$file = correct path

Why should this work with XP? It's the same code.

Maybe I missunderstood something, here are the two codes:

<code>

I was just wondering if that code worked in XP. You said that when you clicked the "+" for add file, it would crash which made me think that the problem was with the code I asked you test.

As of now I don't have any idea what could be going wrong. If anyone else has any ideas to why this might be happening it would be nice to hear them.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
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
Sign in to follow this  
Followers 0