Sign in to follow this  
Followers 0
Minikori

Don't see why this isn't working

6 posts in this topic

Just trying to make the icon go to the mouse position whenever it left button is clicked, but every time I click, it disappears. Help please? Here's the code:

#include <GUIConstants.au3>
#include <Misc.au3>

$Main = GUICreate("TestGame", 400, 400)
$Player = GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 20, 20)

GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
    If _IsPressed(01) Then
        Go()
    EndIf
WEnd
Exit

Func Go()
    $MousePos = MouseGetPos()
    GUICtrlSetPos($Player, $MousePos[1], $MousePos[0])
EndFunc

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites



You have the $MousePos indexes switched. Fix that first and see if it works.

Share this post


Link to post
Share on other sites

You have the $MousePos indexes switched. Fix that first and see if it works.

Tried that. Didn't work.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

Whether you tried it or no, [0] = x and [1] = y. You need to get them correctly.

You also need Opt("MouseCoordMode", 2).

Share this post


Link to post
Share on other sites

Whether you tried it or no, [0] = x and [1] = y. You need to get them correctly.

You also need Opt("MouseCoordMode", 2).

Alright it's fixed, thank you!

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

Minikori

Easy way:

#include <GUIConstants.au3>

$Main = GUICreate("TestGame", 400, 400)
$Player = GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 20, 20)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $GUI_EVENT_PRIMARYDOWN
            Go()
    EndSwitch
WEnd

Func Go()
    $MousePos = GUIGetCursorInfo()
    GUICtrlSetPos($Player, $MousePos[0], $MousePos[1])
EndFunc

;)

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