Jump to content

Trying to run ingame


Guest JuMp3r
 Share

Recommended Posts

Guest JuMp3r

Hello, I'm playing a game named GunZ Online: The Duel and I tryed to make a little script for it :

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode

$mainwindow = GUICreate("GunZ Step Bot", 200, 100)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel("Welcome to the GunZ Step Bot", 30, 10)

$bsbutton = GUICtrlCreateButton("Butterfly", 0, 50, 60)

$lhsbutton = GUICtrlCreateButton("<-Half", 70, 50, 60)

$rhsbutton = GUICtrlCreateButton("->Half", 140, 50, 60)

GUICtrlSetOnEvent($bsbutton, "BsButton")

GUICtrlSetOnEvent($lhsbutton, "lHsButton")

HotKeySet("z", "BsButton")

HotKeySet("x", "lHsButton")

HotKeySet("c", "rHsButton")

$dummywindow = GUICreate("Dummy window for testing ", 200, 100)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUISwitch($mainwindow)

GUISetState(@SW_SHOW)

While 1

  Sleep(1000)  ; Idle around

WEnd

Func BsButton()

  WinActivate("Gunz")

  Send("{SPACE}")

  Send("w")

  Send("w")

  MouseClick("Left")

  Send("{SHIFTDOWN}")

  Send("{SHIFTUP}")

EndFunc

Func lHsButton()

  WinActivate("Gunz")

  Send("{SPACE}")

  Send("a")

  Send("a")

  Send("1")

  MouseClick("Left")

  Send("2")

  MouseClick("Left")

  Send("1")

  Send("d")

  Send("d")

EndFunc

Func rHsButton()

  WinActivate("Gunz")

  Send("{SPACE}")

  Send("d")

  Send("d")

  Send("1")

  MouseClick("Left")

  Send("2")

  MouseClick("Left")

  Send("1")

  Send("a")

  Send("a")

EndFunc

Func CLOSEClicked()

  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,

  ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow

  If @GUI_WINHANDLE = $mainwindow Then

    MsgBox(0, "Exit", "Good Bye, have fun =)")

    Exit

  EndIf

EndFunc

This works perfectly if I stay into windows, but if I get into the game( and I get automatically in because of the "WinActivate("Gunz")")

What i'd like to do is to make the hotkeys still work when ingame

Thx for the help

Link to comment
Share on other sites

I had the same problem not sure it works tho never got to try it but im pretty sure it works now but all you need to do really is use _ispressed on none set keys so it dosnt do anything in the game but it probly will make the hotkey work. didn't feel like using .s but anyways heres a example of a _ispressed script

hotkeyset("{F2}", "ON")

func ON()

;put numbers in box bellow

While 1
  If _IsPressed('70') = 1 Then 
Exit
endif
  If _IsPressed('01') = 1 Then 
exit
endif
  Sleep(10)
Wend

Exit

endfunc

Func _IsPressed($hexKey)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc ;==>_IsPressed

#cs
  01 Left mouse button
  02 Right mouse button
  04 Middle mouse button (three-button mouse)
  05 Windows 2000/XP: X1 mouse button
  06 Windows 2000/XP: X2 mouse button
  08 BACKSPACE key
  09 TAB key
  0C CLEAR key
  0D ENTER key
  10 SHIFT key
  11 CTRL key
  12 ALT key
  13 PAUSE key
  14 CAPS LOCK key
  1B ESC key
  20 SPACEBAR
  21 PAGE UP key
  22 PAGE DOWN key
  23 END key
  24 HOME key
  25 LEFT ARROW key
  26 UP ARROW key
  27 RIGHT ARROW key
  28 DOWN ARROW key
  29 SELECT key
  2A PRINT key
  2B EXECUTE key
  2C PRINT SCREEN key
  2D INS key
  2E DEL key
  30 0 key
  31 1 key
  32 2 key
  33 3 key
  34 4 key
  35 5 key
  36 6 key
  37 7 key
  38 8 key
  39 9 key
  41 A key
  42 B key
  43 C key
  44 D key
  45 E key
  46 F key
  47 G key
  48 H key
  49 I key
  4A J key
  4B K key
  4C L key
  4D M key
  4E N key
  4F O key
  50 P key
  51 Q key
  52 R key
  53 S key
  54 T key
  55 U key
  56 V key
  57 W key
  58 X key
  59 Y key
  5A Z key
  5B Left Windows key
  5C Right Windows key
  60 Numeric keypad 0 key
  61 Numeric keypad 1 key
  62 Numeric keypad 2 key
  63 Numeric keypad 3 key
  64 Numeric keypad 4 key
  65 Numeric keypad 5 key
  66 Numeric keypad 6 key
  67 Numeric keypad 7 key
  68 Numeric keypad 8 key
  69 Numeric keypad 9 key
  6A Multiply key
  6B Add key
  6C Separator key
  6D Subtract key
  6E Decimal key
  6F Divide key
  70 F1 key
  71 F2 key
  72 F3 key
  73 F4 key
  74 F5 key
  75 F6 key
  76 F7 key
  77 F8 key
  78 F9 key
  79 F10 key
  7A F11 key
  7B F12 key
  7C-7F F13 key - F16 key
  80H-87H F17 key - F24 key
  90 NUM LOCK key
  91 SCROLL LOCK key
  A0 Left SHIFT key
  A1 Right SHIFT key
  A2 Left CONTROL key
  A3 Right CONTROL key
  A4 Left MENU key
  A5 Right MENU key
#ce

;just put the number befor the key you want in _ispressed box way above this

while 1
wend
exit

If _IsPressed('70') = 1 Then;70 would be F1

Hope this helps you!

Witch Hunter Robin
Link to comment
Share on other sites

  • 1 year later...

how would i make a script where it would press the following keys within a time limit of 1.5 seconds

after i press a certain key say f6

1. up

2. down

3. left

4. right

5. up

6. down

7. left

8. right

9. up

10. down

11. left

12. right

13. up

14. down

15. left

16. right

Link to comment
Share on other sites

HotKeySet('{F6}', '_Start')

While 1
    Sleep(25)
Wend

Func _Start()
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
EndFunc

Im not shur I understand what u mean by "within 1.5sec" ? please elaborate.

Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

HotKeySet('{F6}', '_Start')

While 1
    Sleep(25)
Wend

Func _Start()
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
    Send("{UP}")
    Sleep(10)
    Send("{DOWN}")
    Sleep(10)
    Send("{LEFT}")
    Sleep(10)
    Send("{RIGHT}")
    Sleep(10)
EndFunc

Im not shur I understand what u mean by "within 1.5sec" ? please elaborate.

just that the total time would be under 1.5 seconds

i altered the sleep time to 5 so its only 16 x 0.05

Edited by qwertz111
Link to comment
Share on other sites

There are other ways to speed it up as well, such as adding multiple Keys to each send

Send("{UP}{DOWN}{LEFT}{RIGHT}")
    Sleep(10)

Or you could play with editing the Opt("SendKeyDownDelay", 2) to less than the Default.

However I wouldn't recommend either of those, If you shorten the delays by to much it will start acting inconsistent.

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

There are other ways to speed it up as well, such as adding multiple Keys to each send

Send("{UP}{DOWN}{LEFT}{RIGHT}")
    Sleep(10)

Or you could play with editing the Opt("SendKeyDownDelay", 2) to less than the Default.

However I wouldn't recommend either of those, If you shorten the delays by to much it will start acting inconsistent.

whats the names for pressing the following keys

the ones found above the letters

Send [ ` ]

Send [ 1 ]

Send [ 2 ]

Send [ 3 ]

...

Send [ 0 ]

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...