Jump to content

Some Help


Recommended Posts

I am trying to get this so that when you go on the white area surrounding the dark path that it will pop up a message box. The images are attached and the script is below.

#include "GUIConstants.au3"

$gui=GUICreate("Take your dog on a walk", @DesktopWidth + 10, @DesktopHeight + 10, 0, -30, -1, $WS_EX_TOOLWINDOW)

GUICtrlSetBkColor ( $gui, 0xFFFFFF )

$Pic1 = GUICtrlCreatePic(@ScriptDir & "\walk.gif", 0, 0, 1000, 1000)

$pic=GUICreate("", 49, 57, 0, 400,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$guy = GUICtrlCreatePic(@ScriptDir & "\guyfarward.gif",0,0, 0,0)

$pic2=GUICreate("", 361, 142, 209, 447,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$Pic5 = GUICtrlCreatePic(@ScriptDir & "\home.gif", 0, 0, 0, 0)

$pic3=GUICreate("", 59, 86, 530, 505,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$Pic6 = GUICtrlCreatePic(@ScriptDir & "\door2.gif", 0, 0, 0, 0)


GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)
GUISetState(@SW_SHOW,$pic2)
GUISetState(@SW_SHOW,$pic3)


HotKeySet("{LEFT}", "left")
HotKeySet("{RIGHT}", "right")
HotKeySet("{DOWN}", "down")
HotKeySet("{UP}", "up")

$picPos = WinGetPos($pic)
$guiPos = WinGetPos($gui)
$pic2pos = WinGetPos ($pic2)

$LEFTVALUE = 245
$TOPVALUE = 245
$RIGHTVALUE = 318
$BOTVALUE = 381

$LEFTVALU3 = 471
$TOPVALU3 = 475
$RIGHTVALU3 = 530
$BOTVALU3 = 591


While 1
    $msg = GuiGetMsg()
    
    $picPos = WinGetPos($pic)
    $pic2pos = WinGetPos($pic2)
    
    If $picPos[0] > $LEFTVALUE And $picPos[1]  > $TOPVALUE And $picPos[0] < $RIGHTVALUE And $picPos[1]  < $BOTVALUE Then
        MsgBox (0,"hi","hi")
    EndIf
    
    If $picPos[0] > $LEFTVALU3 And $picPos[1]  > $TOPVALU3 And $picPos[0] < $RIGHTVALU3 And $picPos[1]  < $BOTVALU3 Then
        MsgBox (0,"hi","hi")
    EndIf
    
    if PixelGetColor ($picPos[1], $picPos[2]) = 0xFFFFFF Then
        MsgBox (0,"Hey", "You cant go off the road!")
    EndIf
        
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit


Func left ()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]-5,$picPos[1])
    GUICtrlSetImage ($guy, @ScriptDir & "\guybackward.gif")
EndFunc

Func right()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]+5,$picPos[1])
    GUICtrlSetImage ($guy, @ScriptDir & "\guyfarward.gif")
EndFunc

Func down()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]+5)
EndFunc

Func up()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]-5)
EndFunc

post-14679-1184878022_thumb.gif

post-14679-1184878036_thumb.gif

Edited by keen

[center]Kesne's Bar & Grill[/center]

Link to comment
Share on other sites

You could use the pixelgetcolor and mousegetpos to get the color of the pixel under the mouse. Then if that pixel was white you could have the corresponding part of the script execute.

While 1
$pos = Mousegetpos ()
$color = Pixelgetcolor ($pos[0], $pos[1], "white")
If $color = "white" Then
Exitloop
Endif
Wend

Edit: i would add a sleep in the loop so you dont slow down ur computer too much.

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