Jump to content

Making a Puzzle ?!?!


Recommended Posts

Hi ,

Here is my Code

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Form1" , 300 , 300 )

$Pic0x0 = GUICtrlCreatePic("Some image 0x0", (0 *  150), (0 * 150) , 150, 150  )
$Pic0x1 = GUICtrlCreatePic("Some image 0x1", (0 *  150), (1 * 150) , 150, 150  )
$Pic1x0 = GUICtrlCreatePic("Some image 1x0", (1 *  150) ,(0 * 150) , 150, 150  )
$Pic1x1 = GUICtrlCreatePic("Some image 1x1", (1 *  150), (1 * 150) , 150, 150  )

GUISetState()

 While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

As you can see, its like a puzzle ... That code works fine as long as it contains few images ( 4 in that Code ) ... However , I need to put about 100 images there ... so it will reach $Pic10x10 ... I tried and Scripted until 50x50 in the same pattern you can see above ... However , when I ran the Script I found that some pics were overlapped each other slightly ( about 1 to 5 pixels ) .... that was vertically in some images and Horizontally in others images .... Dont doubt that I have missed entered a value as I Checked millions of times before I try and post this thread ...

you might ask what kind of resolution you have that can hold that number of images ? ... will Iam just using those Scroll bars in the Gui :) ... and thats very important to my matter ... I need those Scrolls and cant afford to remove them ... you might suspect those Scroll bars then ? ... no Iam sure they are not the problem ...

I have concluded that AutoIt Cant handle to organize many images like 100 or even more ... I mean to put each in its right position ... not even a slightly pixel is spotted ... :)

Please , Correct if Iam wrong :o

Also , I need a ToolTip to appear wherever the mouse goes ... I need that ToolTip to show the CURRENT Position of the cursor ONLY related to the Gui window ... well I know about how to make it related only to the window ... to set Coordmode to 2 ... My problem with that ToolTip is that it wont Change When mouse changes its position ... I mean it only shows the first time it locates the mouse position ... and then that ToolTip will hang in that place forever !! ... again , I need it to be a Tooltip ... not a TrayTip or Status bar or anything like that ... :)

Any Suggestion ? :pirate:

Thanx in advance :P

P.S. : about the long code with the Scroll bars and until 10x10 image ... its just that its too messy and have delete some private lines inside ... so I have showed you whats was working and I hope that you got the idea about how that long would possibly look like :( ... I just need to know what is causing that slightly buggy pixels change .. :(

Edited by hussert
Link to comment
Share on other sites

Hi ,

Here is my Code

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Form1" , 300 , 300 )

$Pic0x0 = GUICtrlCreatePic("Some image 0x0", (0 *  150), (0 * 150) , 150, 150  )
$Pic0x1 = GUICtrlCreatePic("Some image 0x1", (0 *  150), (1 * 150) , 150, 150  )
$Pic1x0 = GUICtrlCreatePic("Some image 1x0", (1 *  150) ,(0 * 150) , 150, 150  )
$Pic1x1 = GUICtrlCreatePic("Some image 1x1", (1 *  150), (1 * 150) , 150, 150  )

GUISetState()

 While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

As you can see, its like a puzzle ... That code works fine as long as it contains few images ( 4 in that Code ) ... However , I need to put about 100 images there ... so it will reach $Pic10x10 ... I tried and Scripted until 50x50 in the same pattern you can see above ... However , when I ran the Script I found that some pics were overlapped each other slightly ( about 1 to 5 pixels ) .... that was vertically in some images and Horizontally in others images .... Dont doubt that I have missed entered a value as I Checked millions of times before I try and post this thread ...

you might ask what kind of resolution you have that can hold that number of images ? ... will Iam just using those Scroll bars in the Gui :) ... and thats very important to my matter ... I need those Scrolls and cant afford to remove them ... you might suspect those Scroll bars then ? ... no Iam sure they are not the problem ...

I have concluded that AutoIt Cant handle to organize many images like 100 or even more ... I mean to put each in its right position ... not even a slightly pixel is spotted ... :)

Please , Correct if Iam wrong :o

Also , I need a ToolTip to appear wherever the mouse goes ... I need that ToolTip to show the CURRENT Position of the cursor ONLY related to the Gui window ... well I know about how to make it related only to the window ... to set Coordmode to 2 ... My problem with that ToolTip is that it wont Change When mouse changes its position ... I mean it only shows the first time it locates the mouse position ... and then that ToolTip will hang in that place forever !! ... again , I need it to be a Tooltip ... not a TrayTip or Status bar or anything like that ... :)

Any Suggestion ? :pirate:

Thanx in advance :P

P.S. : about the long code with the Scroll bars and until 10x10 image ... its just that its too messy and have delete some private lines inside ... so I have showed you whats was working and I hope that you got the idea about how that long would possibly look like :( ... I just need to know what is causing that slightly buggy pixels change .. :(

There shouldn't be any problem with 100 images, but it would be much easier to use an array than to write all those lines.

Dim $Pic[10][10]
For $yp = 0 To 9
    For $xp = 0 To 9
        $Pic[$yp][$xp] = GUICtrlCreatePic("Some image" & (10 * $yp + $xp), ($xp * 150), ($yp * 150), 150, 150)
    Next
Next

To get the tooltip to display you just need to include the line which shows the tooltip in your main idle loop.

While 1
    $mp = MouseGetPos()
    ToolTip($mp[0]& ', ' & $mp[1])
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

There shouldn't be any problem with 100 images, but it would be much easier to use an array than to write all those lines.

Dim $Pic[10][10]
For $yp = 0 To 9
    For $xp = 0 To 9
        $Pic[$yp][$xp] = GUICtrlCreatePic("Some image" & (10 * $yp + $xp), ($xp * 150), ($yp * 150), 150, 150)
    Next
Next

To get the tooltip to display you just need to include the line which shows the tooltip in your main idle loop.

While 1
    $mp = MouseGetPos()
    ToolTip($mp[0]& ', ' & $mp[1])
WEnd
About the Tool Tip , Thanx for that ... its working as I wanted it to be :)

About simplifying the the lines to that Dim , its not that as the files name are a little more complicated I have wrote there ... I could have change one by one ... but I cant afford that ... and I can see that Iam talking about something that shouldnt be happen at all ... well , my only choice is to say EXACTLY what Iam trying to make :) ....

Its a map for an online game called Silkroad ... some of you might already know it :) ... NOT AN ILLEGAL BOT or anything similar to that ... just a map that I was always looking for in the sites until I have decided to make it myself as non in the internet would key out what all I want in one ...

So I will show you the codes to it ... However I will Remove it once the matter is solved ... its just that I dont like posting my ideas in its source form very much ... thats all ... :(

Here is the long Code that is currently Bugging with me ... :P

Removed by me hussert ( though the matter is still unsolved :P )

NOTE : we both know that this code wont show an image unless you got them really ...

So here is the file with the images ... unzip it ... put that file named "map" in the same place as the Script is ...

map file <-- Removed by me ,hussert

Scroll around the Gui there and see the pixels bug for yourself ... if that same code worked with you without you changing a thing then please tell me about your AutoIt Version like Sctie .... so I can look for it ...

Thanx for your support ...

.{EDIT}

- Posted the wrong Code ... adjusted now :(

- Removed the code

Edited by hussert
Link to comment
Share on other sites

So .. Any takers ??

btw , just wondering , could a gui be divided into grids ... Each 256x256 ... and then fill each one with a pic ..

Maybe if those grids are possible ... then overlapping wont happen :)

Link to comment
Share on other sites

About the Tool Tip , Thanx for that ... its working as I wanted it to be :)

About simplifying the the lines to that Dim , its not that as the files name are a little more complicated I have wrote there ... I could have change one by one ... but I cant afford that ... and I can see that Iam talking about something that shouldnt be happen at all ... well , my only choice is to say EXACTLY what Iam trying to make :) ....

Replace that Region E.p with something like this. (Tested)

For $n = 0 To 15
    For $j = 110 To 95 Step -1
             ;assuming you don't want to use an array, though I think that would be better.
        Assign(StringFormat("Pic%.2dx%.2d",$n,110 - $j),GUICtrlCreatePic("map\" & ($n + 68) & 'x' & $j & '.jpg', ($n * 256), ((110 - $j) * 256) , 256, 256 ))
    Next
Next

Writing all those lines must take longer than learning how to do it in a simple loop, and if you want to change the sizes or names, or apply the technique to another application you have to write it all out again.

The problem with the joints is probably errors in the images and not errors in positioning them.

If you want to be able to remove code then you have a problem if someone replies and includes a copy of your post. I deleted the copy but others might not.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Replace that Region E.p with something like this. (Tested)

I saw it ... I hope that you would remove it ...;)

Writing all those lines must take longer than learning how to do it in a simple loop, and if you want to change the sizes or names, or apply the technique to another application you have to write it all out again.

The problem with the joints is probably errors in the images and not errors in positioning them.

If you want to be able to remove code then you have a problem if someone replies and includes a copy of your post. I deleted the copy but others might not.

I see ...

well yeah ... I was thinking about that since there is still 1900 images to go ... your general line there is perfect ... thanx for that :) ...

About the images havinh errors themselves , well ... I thought of the same , too ... Because the overlapping is not happening with all the images but with some .... I think there is an command the gives the width and length of an image ... I will use it to make an MsgBox displays a list of all the images with their $SS_REALSIZEIMAGE ... thats an old property that shows the real size of the image ... :)

Thanx for your support ... really appreciated :)

There is a post somewhere which allows you to move controls in a GUI, I am sure that would be useful!

Iam not sire if thats what I want to do ... but I hope you can find it ... Thanx for your reply :P

bonebreaker made a image puzzle in autoit

http://www.autoitscript.com/forum/index.ph...amp;hl=prospeed

Ummm ... its probably that error is with images ... I doubt that all of them are 256x256 ... gonna check and reply back ...

Thanx for the link, anyway ... :(

.

Edited by hussert
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...