AutoIT : Auto Inject

This is a discussion on AutoIT : Auto Inject within the Starcraft 2 Hacks board part of the Starcraft 2 forum category; Here is my version of auto-inject. Works in combination with camera positions. Once you start it, it will warn you ...

Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1
    bysorynyos is offline Wannabe Member
    Array
    Join Date
    Dec 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    4
    Reputation
    9

    Post AutoIT : Auto Inject

    Here is my version of auto-inject.
    Works in combination with camera positions.
    Once you start it, it will warn you if you have to inject, you can make it auto to, but i prefer using the key.

    How to use ?
    Start any game, set your camera position with F1 - F7 as you normally do.
    If you want to inject 3 bases press the 3 number on NumKey - NUM3
    (you have to press this only once, or when you decide to take another base or lose one).
    Then start the script by pressing TAB, and anytime you hear the beep you can press the TAB key again to do it for you.
    To kill it press DELETE key.


    #include <Misc.au3>
    #include <AutoItConstants.au3>


    HotKeySet("{TAB}", "start")
    HotKeySet("{DELETE}", "quit")


    ; will not bip at the start of the game until you actually start the script
    Local $timer = -35000


    ; default number of base
    Local $bases = 1
    Local $hDLL = DllOpen("user32.dll")


    While 1
    ; every 30 seconds beep to notify the need to inject
    Sleep(100)
    $timer += 1


    ; update the number of bases, by pressing the NUM key with the number (ex: 3 bases to inject, then pres NUM3)
    If _IsPressed("62", $hDLL) Then
    $bases = 2
    ElseIf _IsPressed("63", $hDLL) Then
    $bases = 3
    ElseIf _IsPressed("64", $hDLL) Then
    $bases = 4
    ElseIf _IsPressed("65", $hDLL) Then
    $bases = 5
    ElseIf _IsPressed("66", $hDLL) Then
    $bases = 6
    ElseIf _IsPressed("67", $hDLL) Then
    $bases = 7
    EndIf


    if $timer >= 250 Then
    Beep(500, 1000)
    $timer = 0
    EndIf
    WEnd


    Func quit()
    Exit 0
    EndFunc


    Func start()
    inject()
    EndFunc


    Func inject()
    ; save mouse location
    Local $aPos = MouseGetPos()


    ; save screen location
    Send("^{F8}")


    ; save what you had selected
    Send("^0")


    ;
    ;;
    ;;; F1 - F7
    ;;
    ;


    ; Mergem la F1
    Send("{F1}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F1
    Send("^{F1}")




    If $bases < 2 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F2
    Send("{F2}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F2
    Send("^{F2}")




    If $bases < 3 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F3
    Send("{F3}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)




    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F3
    Send("^{F3}")




    If $bases < 4 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F4
    Send("{F4}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F4
    Send("^{F4}")




    If $bases < 5 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F5
    Send("{F5}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F5
    Send("^{F5}")




    If $bases < 6 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F6
    Send("{F6}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F6
    Send("^{F6}")




    If $bases < 7 Then
    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0


    Return
    EndIf




    ; Mergem la F7
    Send("{F7}")


    ; Selectam zona de langa Hatch (ar trebui sa avem un queen selectat primul)
    MouseClickDrag($MOUSE_CLICK_LEFT, 275, 130, 1550, 800, 0)


    ; slectez inject
    Send("{V}")


    ; tin SHIFT
    Send("{SHIFTDOWN}")


    ; mut mouse la mijlocul ecranului
    MouseMove(@DesktopWidth/2, @DesktopHeight/2 - 100, 0)


    For $i = 1 to 3 Step 1
    MouseClick("left")
    Next


    ; eliberez SHIFT
    Send("{SHIFTUP}")


    ; recentrare
    MouseClick("left")


    ; save to 9
    Send("^9")


    ; dublu click 9
    Send("9")
    Send("9")


    ; rememorare pe F7
    Send("^{F7}")


    ; revin pozitie initiala
    Send("{F8}")


    ; reselectez unitati
    Send("{0}")


    ; mouse unde era, instant
    MouseMove($aPos[0], $aPos[1], 0)


    $timer = 0
    EndFunc

    Last edited by bysorynyos; 01-12-2017 at 07:28 PM. Reason: Updated the script [CODE] tag broken

  2. #2
    anamel is offline Newbie
    Array
    Join Date
    Nov 2016
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    nice work instructions pls..

  3. #3
    bysorynyos is offline Wannabe Member
    Array
    Join Date
    Dec 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    4
    Reputation
    9
    Ok,
    here is it how it works,
    You play the game as normaly you would.
    Setting throw the camera positions as well.
    When you want to inject you press TAB
    (what it does, it goes to every camera location you have set, drag boxes, selects the queen and injects the hatch)
    (to do: auto center to center of the hatch and rebind the camera position, when you hit the numKey of how many hatches you want to inject).
    Also it saves you location on screen and what you had selected priviously.
    It does not (auto inject but it does notify you to inject), i like it this way since i might be in a middle of the battle and i dont want the screen moving around. Also it avoids the problem of wandering Queens. If you dont have either a hatch or a queen at that location it will not inject, other than that nothing happens.

    So, what to do ?
    Start the game, set you camera location, hit anytime you want to number of haches you want injected (1-7) from the NumKey.
    Press Tab to inject, every 30s, you'll hear a bip notifying you to inject.

    This is what I use and works wonders.
    Will update it soon with and auto-center on the hatch, so you can set the camera location fast and dont worry about the position again

    If you need help with it, just let me know.

  4. #4
    SC2Zerg is offline Newbie
    Array
    Join Date
    Nov 2015
    Location
    France
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    I think he was asking for a tutorial since we doesn't know, us plebs, how to use it

    But good work !

  5. #5
    Disturbance is offline Wannabe Member
    Array
    Join Date
    Feb 2016
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    So...What where do we add the code?

  6. #6
    yxvv is offline Wannabe Member
    Array
    Join Date
    Mar 2012
    Posts
    18
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    can't run code error

  7. #7
    bysorynyos is offline Wannabe Member
    Array
    Join Date
    Dec 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    4
    Reputation
    9
    It's AutoIt not ahk
    save the file as 'something'.au3 then run it.
    Or convert it to ahk, you have the idea

  8. #8
    TXKOKOKO is offline Member
    Array
    Join Date
    Aug 2016
    Posts
    48
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    Quote Originally Posted by bysorynyos View Post
    It's AutoIt not ahk
    save the file as 'something'.au3 then run it.
    Or convert it to ahk, you have the idea
    still gives me a run code error

  9. #9
    bysorynyos is offline Wannabe Member
    Array
    Join Date
    Dec 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    4
    Reputation
    9
    Quote Originally Posted by TXKOKOKO View Post
    still gives me a run code error
    What does it say ? maybe I can help.

  10. #10
    TXKOKOKO is offline Member
    Array
    Join Date
    Aug 2016
    Posts
    48
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    Quote Originally Posted by bysorynyos View Post
    What does it say ? maybe I can help.
    it says MouseMove@ desktopWidth/2, @desktopHeight/2 - 100, -)
    MouseMove^ERROR

    Error. Badly formatted variable or macro

    Quote Originally Posted by bysorynyos View Post
    What does it say ? maybe I can help.
    it says MouseMove@ desktopWidth/2, @desktopHeight/2 - 100, -)
    MouseMove^ERROR

    Error. Badly formatted variable or macro

Page 1 of 3 123 LastLast

Similar Threads

  1. Autohotkey: Auto Inject Script
    By GanjaRoach in forum Starcraft 2 Hacks
    Replies: 34
    Last Post: 01-03-2017, 02:59 PM
  2. [Release] Auto inject larva....with hotkey to make lings mutas ETC
    By marduk12 in forum Starcraft 2 Hacks
    Replies: 22
    Last Post: 08-02-2012, 11:15 AM
  3. Auto WoW Login,AutoIt v3 Script.
    By Flying Panda in forum Development
    Replies: 10
    Last Post: 12-24-2009, 02:37 PM
  4. [AutoIt] Auto-Auctioneer
    By metalfan666 in forum WoW Bots
    Replies: 1
    Last Post: 01-16-2008, 09:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •