Jump to content

Recommended Posts

Posted

I'm having some difficulty debugging this.

Global $empty = "404040" ;Color of an empty bar in HEX
Global $Paused


HotKeySet("^!p", "TogglePause")
HotKeySet("^!z", "Start") 
ToolTip('Ctrl-Alt-P = TogglePause    |    ESC - Quit    |    Ctrl-Alt-Z = Start',0,0)

Func CheckStam()
     While $conts = 1
      $checkstam = PixelGetColor( 891 , 12 ) ;Gets color of bar
       If Hex($checkstam, 6) = $empty Then  ; Converts $checkstam into Hex 6 chars long and compares to $empty.
          Call("TogglePause") ; If both variables match the Func is called.
      Else
           Sleep(5000)  ; Pauses and sends key and mouse commands until Variables above match.
           Send("Q")
           Sleep (500)
           Send ("8")
           Sleep(1000)
           MouseClick ( "left" )
     EndIf
  WEnd
EndFunc


Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip('Shift-Alt-S - TogglePause | Shift-Alt-D - Start',0,0)
EndFunc   ;==>TogglePause

The func runs when called, however when it hits the Else segment its only doing the mouse click and wont send the keys. Without a means to step through running code to see where it breaks I'm at a loss.

Any help would be greatly appreciated.

Posted

What's this for?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Its for a game window, for a game I'm trying to debug and I'd like to take some of the repetitiveness out of some of the lengthy actions.

Simple watch a color and if color changes then call func, however while color is still the same cycle through the ELSE statement. I'm new to programming in general and I'm trying to teach myself.

So any help would be greatly appreciated.

Posted

Please have a look at the forum rules (link is in the lower right corner of this page)!

Game automation of any kind is definitely not allowed here :naughty:

My UDFs and Tutorials:

  Reveal hidden contents

 

  • Moderators
Posted

KiwiGuy,

Please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...