Jump to content

Recommended Posts

Posted (edited)

Hey, I have this script

Opt("WinTitleMatchMode", 1)

HotKeySet("{NUMPAD1}", "Start")

While 1
    Sleep(10)
WEnd

Func Start()
        $left = PixelChecksum(380, 420, 400, 400)
        $down = PixelChecksum(450, 420, 470, 400)
        $up = PixelChecksum(520, 420, 535, 410)
        $right = PixelChecksum(590, 415, 585, 400)
    While 1     
        If NOT $left = PixelChecksum(380, 420, 400, 400) Then Send("a")
        If NOT $down = PixelChecksum(450, 420, 470, 400) Then Send("b")
        If NOT $up = PixelChecksum(520, 420, 535, 410) Then Send("c")
        If NOT $right = PixelChecksum(590, 415, 585, 400) Then Send("d")
    WEnd
EndFuncoÝ÷ Ù8b²+,ºh±ëhuë^rÜ!z{(ëax©àzȧ¢w¨~Ø^~«¶*'wZ²Ê(«"µÈZ¬Øb¶Æ¤{ nµú+"µÚ²}ý¶­j|¤{+(ëax&ºË[{
èÞeÌ1ÒÊ#ºËm®'¶¬jëh×6$left = PixelGetColor(391, 204)
$down = PixelGetColor(462, 219)
$up = PixelGetColor(529, 204) 
$right = PixelGetColor(601, 210)

While 1 
$left1 = PixelGetColor(391, 204)
$down1 = PixelGetColor(462, 219)
$up1 = PixelGetColor(529, 204) 
$right1 = PixelGetColor(601, 210)
    If NOT $left1 = $left Then Send("a")
    If NOT $down1 =  $down Then Send("b")
    If NOT $up1 =  $up Then Send("c")
    If NOT $right1 = $right Then Send("d")
WEnd

which could also work...but it isn't

Edited by EliTe_ThuT
Posted

Right of the bat I see your syntax is wrong.

Opt("WinTitleMatchMode", 1)

HotKeySet("{NUMPAD1}", "Start")

While 1
    Sleep(10)
WEnd

Func Start()
        MsgBox(0,"","Start() triggered")
        $left = PixelChecksum(380, 420, 400, 400)
        ConsoleWrite($left & @CRLF)
        $down = PixelChecksum(450, 420, 470, 400)
        ConsoleWrite($down & @CRLF)
        $up = PixelChecksum(520, 420, 535, 410)
        ConsoleWrite($up & @CRLF)
        $right = PixelChecksum(590, 415, 585, 400)
        ConsoleWrite($right & @CRLF)
    While 1  
        If $left <> PixelChecksum(380, 420, 400, 400) Then Send("a")
        If $down <> PixelChecksum(450, 420, 470, 400) Then Send("b")
        If $up <> PixelChecksum(520, 420, 535, 410) Then Send("c")
        If $right <> PixelChecksum(590, 415, 585, 400) Then Send("d")
    WEnd
EndFunc

Correct:

If $left <> PixelChecksum(380, 420, 400, 400) Then Send("a")

Incorrect:

If NOT $left = PixelChecksum(380, 420, 400, 400) Then Send("a")

This isn't correct because it is acting as an assignment operator which is always true so no keys will ever be sent.

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
×
×
  • Create New...