Jump to content

Pause // End key not working correctly


MirnesC2
 Share

Recommended Posts

I looked at some examples online and looked at some examples around here and attempted to make this myself. It's just a simple bot that spam 1 key into a video game but the pause/end functions I added just don't seem to work. It starts up and everything, the key {z} is sent(spammed) but the -/+ keys I assigned to pause/end the program don't work.

HotKeySet("{NUMPADADD}", "End")
HotKeySet("{NUMPADSUB}", "Pause")

$answer = InputBox("Z Bot","Windows name?")
$Pause = 0

WinWaitActive($answer)

While 1
    Send("z")
WEnd

Func End()
      Exit
EndFunc

Func Pause()
    If $Pause = 0 Then
        $Pause = 1
    Else
        $Pause = 0
    EndIf
    While $Pause = 1
        Sleep(1)
    WEnd
EndFunc

Also I am not sure if it is possible to use anything else besides WinWaitActive($answer), I only want to program to run in that window and not in any other window when I alt tab.

Link to comment
Share on other sites

They did for me. That's what I said the first time.

Edit: Are you using the numpad + and - or the regular one close to backspace?

Sorry, you are right. It does work on Notepad, I haven't tested it on that.

I am using it for a video game and it doesn't seem to be working there.

Posted Image

If you look at the chat box in the screens-shot it shows I pressed the num -/+ with out the program stoping. What do you think might be the problem?

Link to comment
Share on other sites

I had to do it manually

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\lheks\My Documents\Cabal Proj\attackform.kxf

$atkfrm = GUICreate("Attack Skill", 154, 225, 192, 124)
$atkchk1 = GUICtrlCreateCheckbox("1", 24, 32, 33, 17)
$atkchk2 = GUICtrlCreateCheckbox("2", 24, 64, 33, 17)
$atkchk3 = GUICtrlCreateCheckbox("3", 24, 96, 33, 17)
$atkchk4 = GUICtrlCreateCheckbox("4", 24, 128, 33, 17)
$atkbox1 = GUICtrlCreateInput("", 64, 32, 57, 21)
$atkbox2 = GUICtrlCreateInput("", 64, 64, 57, 21)
$atkbox3 = GUICtrlCreateInput("", 64, 96, 57, 21)
$atkbox4 = GUICtrlCreateInput("", 64, 128, 57, 21)
$startbtn = GUICtrlCreateButton("START", 40, 176, 75, 25, $WS_GROUP)
$atkgrp1 = GUICtrlCreateGroup("Attack Skills", 8, 8, 137, 161)
GUICtrlCreateGroup("", -99, -99, 1, 1) G
UISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUICtrlSetOnEvent($startbtn, "Attack")
Global $ct1, $ct2, $ct3, $ct3, $xx1

While 1 $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

HotKeySet("{PGDN}", "attack")
HotKeySet("{PGUP}", "stop") ;
$attack = 0

While 1
    Sleep(100)
WEnd

Func stop()
    $attack = 0
EndFunc   ;==>stop

Func attack()
    Send({F1})
    Opt("GUIOnEventMode", 1)
    GUICtrlSetData($startbtn, "STOP")
    WinActivate("Untitled - Notepad")
    $attack = Not $attack
    $ct1 = GUICtrlRead($atkbox1)
    $ct2 = GUICtrlRead($atkbox2)
    $ct3 = GUICtrlRead($atkbox3)
    $ct4 = GUICtrlRead($atkbox4)
    $xx1 = 1 ;
    If $nMsg = $startbtn Then ;
        If GUICtrlRead($startbtn) = "START" Then ;
            GUICtrlSetData($startbtn, "STOP") ;
            $xx1 = 1 ;
        ElseIf GUICtrlRead($startbtn) = "STOP" Then ;
            GUICtrlSetData($startbtn, "START") ;
            $xx1 = 0 ;
        EndIf ;
    EndIf
    While $xx1 = 1;
        $attack = 1
        ;Press Attack Skill from slot 2-5               ;
        Sleep(5000)
        Send("2", 3)
        Sleep($ct1)
        Send("3", 1)
        Sleep($ct2)
        Send("4", 1)
        Sleep($ct3)
        Send("5", 1)
        Sleep($ct4)
    WEnd
EndFunc   ;==>attack

Func stop()
    $xx1 = False
    GUICtrlSetData($startbtn, "START")
EndFunc   ;==>stop
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...