Bobbert's LossBot Tutorial

This is a discussion on Bobbert's LossBot Tutorial within the Warcraft 3 forum board part of the Hot Games category; For this tutorial you will need AutoIt . Also, Scite will be useful. Scite is the editor, which make life ...

Results 1 to 7 of 7
  1. #1
    Bobbert is offline Member
    Array
    Join Date
    Jul 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    11
    Reputation
    51

    Bobbert's LossBot Tutorial

    For this tutorial you will need AutoIt.
    Also, Scite will be useful. Scite is the editor, which make life easer.

    Well, we all know that we can search for a game using Alt+Q (when in a chat channel). Also when you are in a game, you can press F10 to bring up the options menu, E for end game and Q for quit mission and finally Enter lets you leave the score screen. With this in mind we can create this:

    Code:
    Send("{!Q") ; to search a game
      Send("{F10}") ; options menu
      Send(“E”) ; end game
      Send(“Q”) ; quit
      Send(“{Enter}”) ; leaves score screen
    The above will send these keys very quickly, and will not do much good. So lets add a loop, which will send these keys over and over again.

    Code:
    While 1
      Send("!Q") ; to search a game
      Send("{F10}") ; options menu
      Send(“E”) ; end game
      Send(“Q”) ; quit
      Send(“{Enter}”) ; leaves score screen
      Sleep(10)
      WEnd
    Sleep(1000) is equal to 1 second so the added sleep will make it wait .001 of a second before it sends the keys again. Although this is a relatively small time, it will reduce your CPU usage greatly.
    Now, we don’t want they keys to be sent all the time without stopping, and it would also be handy to be able to start and stop easily.

    Code:
    Dim $stop = 0 ; We will make this start off, so it doesn’t send keys without being ready.
    
    HotKeySet("{F4}", "toggel") ; Whenever you press F4 it will call the function "toggel" aka turn on and off
    HotKeySet("{F5}", "off") ;when you press F5 it will call the off function and Quit.
    
    While 1
        If $stop = 1 Then
            If WinActive("Warcraft III") Then ; Will make sure the window is acitctive before sending the keys
                Send("!Q") ; to search a game
                Send("{F10}") ; options menu
                Send("!E") ; end game
                Send("!Q") ; quit
                Send("{Enter}") ; leaves the scores screen
                Sleep(10) ; reduces CPU usage
            EndIf
        EndIf
    WEnd
    
    
    Func toggel()
        If $stop = 0 Then
            $stop = 1 ; change the bot to on
            ToolTip("LossBot = ON", 0, 0)
        Else
            $stop = 0 ; change the bot to off
            ToolTip("LossBot = OFF", 0, 0)
        EndIf
    EndFunc
    
    Func off()
        Exit ; will quit the bot
    EndFunc
    Now we have a function lossbot congrats! Notice this lossbot will leave the game automatically. To make this bot leave at different times we can use the pixel search.


    #Important note: The colours used in pixel search could vary between machines, so your bot might not work on someone else’s computer.
    Now, how do we use the pixel search command? Fortunately AutoIt has a handy tool to help us out with this. In the AutoIt folder there is a program called Au3Info.exe. I would suggest familiarizing yourself with the tool. In the summary tab you will find info about the window, as well as info about your mouse. Also you will notice you can freeze the window with a hotkey (under the options menu). So now we go into warcraft, join a chat channel and find a point on you screen that is always the same colour. For this tutorial, I will pick the lions head. Move you mouse there and press the freeze hotkey (for me it is Ctrl+Alt+F). Now minimize, and check the Au3.info tool. You will be able to see a location and colour. Now we can make our first pixel search check. With this information, lets get back to our script.
    We will notice the when we use the PixelSearch() option, there are various requirements to make it work. Basically it will check a square (using given co-ordinates) for the specified colour. With this knowledge we can add this to our script. Notice how we only have 2 points and not 4, also we don’t want to search a square, just a point. To do this we will put the co-ordinates twice, so the top left corner and bottom right corner are the same point. (You will find the co-ordinates that were under you mouse in the summary tab). Now we need a colour. We will also use the colour that was under our mouse (makes sense? ) When you are done it should look something like this. PixelSearch(34, 145, 34, 145, 0xE3E3E3). Note: yours might be different co-ordinates and colour. Now when you are in a game we can use one of the minimap signals. I got 217, 590 and 0x977B10 coming out with PixelSearch(217, 590, 217, 590, 0x977B10). Now we are ready to add this to our script. When done it should look something like this:

    Code:
    Dim $stop = 0 ; We will make this start off, so it doesn’t send keys without being ready.
    
    HotKeySet("{F4}", "toggel") ; Whenever you press F4 it will call the function "toggel" aka turn on and off
    HotKeySet("{F5}", "off") ;when you press F5 it will call the off function and Quit.
    
    While 1
        If $stop = 1 Then
            If WinActive("Warcraft III") Then ; Will make sure the window is acitctive before sending the keys
                $coord = PixelSearch(34, 145, 34, 145, 0xE3E3E3) ; checks to see if in a chat channel
                If Not @error Then
                    Send("!Q") ; to search a game
                EndIf
                $coord = PixelSearch(217, 590, 217, 590, 0x977B10) ; checks to see if in the game
                If Not @error Then
                    Send("{F10}") ; options menu
                    Send("!E") ; end game
                    Send("!Q") ; quit
                    Send("{Enter}") ; leaves the scores screen
                EndIf
                Sleep(10) ; reduces CPU usage
            EndIf
        EndIf
    WEnd
    
    
    Func toggel()
        If $stop = 0 Then
            $stop = 1 ; change the bot to on
            ToolTip("LossBot = ON", 0, 0)
        Else
            $stop = 0 ; change the bot to off
            ToolTip("LossBot = OFF", 0, 0)
        EndIf
    EndFunc
    
    Func off()
        Exit ; will quit the bot
    EndFunc
    What happens if we don’t want to leave right away? What happens if we want to wait 3 mins, to get wins from other lossbotters? Now we can do that! After the bot sees it is in the game, we can just add a sleep(time), which will make the script idol. We also need to make sure that if we want to wait a long time before leaving, and the opponent kills us, we want the bot to keep going. For this we will add another pixel search on the end game screen. I got PixelSearch(199, 497, 199, 497, 0xC19E74). The final product is now below.

    Code:
    Dim $stop = 0 ; We will make this start off, so it doesn’t send keys without being ready.
    
    HotKeySet("{F4}", "toggel") ; Whenever you press F4 it will call the function "toggel" aka turn on and off
    HotKeySet("{F5}", "off") ;when you press F5 it will call the off function and Quit.
    
    While 1
        If $stop = 1 Then
            If WinActive("Warcraft III") Then ; Will make sure the window is acitctive before sending the keys
                $coord = PixelSearch(34, 145, 34, 145, 0xE3E3E3) ; checks to see if in a chat channel
                If Not @error Then
                    Send("!Q") ; to search a game
                EndIf
                $coord = PixelSearch(217, 590, 217, 590, 0x977B10) ; checks to see if in the game
                If Not @error Then
                    Sleep(5000) ; this sleeps 5 seconds. So 60000 is 1 minute. CHANGE THIS TO SET THE DELAY!!!!
                    Send("{F10}") ; options menu
                    Send("!E") ; end game
                    Send("!Q") ; quit
                EndIf
                $coord = PixelSearch(199, 497, 199, 497, 0xC19E74) ; This will make sure that if your opponent kills you before you quit, it will still keep going
                If Not @error Then
                    Send("{Enter}") ; leaves the scores screen
                EndIf
                Sleep(10) ; reduces CPU usage
            EndIf
        EndIf
    WEnd
    
    
    Func toggel()
        If $stop = 0 Then
            $stop = 1 ; change the bot to on
            ToolTip("LossBot = ON", 0, 0)
        Else
            $stop = 0 ; change the bot to off
            ToolTip("LossBot = OFF", 0, 0)
        EndIf
    EndFunc
    
    Func off()
        Exit ; will quit the bot
    EndFunc




    I will add a section later on how to make a minimized lossbot, or a lossbot that works while warcraft is minimized.

  2. #2
    KaMiKaZe is offline Banned User Array
    Join Date
    Jun 2007
    Location
    USA
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    25
    You should add being able to make the hotkeys customizeable since there are many different languages of WC3 with different hotkeys.

  3. #3
    Bobbert is offline Member
    Array
    Join Date
    Jul 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    11
    Reputation
    51
    When you make your own lossbot using the tutorial, you can easily replace them.

  4. #4
    xiN
    xiN is offline Guess who's back ?
    Array
    Join Date
    Feb 2007
    Location
    Six feet under
    Posts
    1,580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    12
    Reputation
    358
    can u make a at lossbot tutorial plz ?

  5. #5
    Bobbert is offline Member
    Array
    Join Date
    Jul 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    11
    Reputation
    51
    Haut-krebs wan'ts to make an at lossbot tutorial, so I will let him
    Last edited by Bobbert; 08-16-2007 at 03:48 PM.

  6. #6
    ZeD's Avatar
    ZeD
    ZeD is offline RoR 0x266E


    Array
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    1,440
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    14
    Reputation
    698
    FreeLoOse, when u have some phantasy u could make it urself, but if u want I can make it

    + Nice tut Phil!

  7. #7
    xiN
    xiN is offline Guess who's back ?
    Array
    Join Date
    Feb 2007
    Location
    Six feet under
    Posts
    1,580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    12
    Reputation
    358
    i dont know something at lossbot making
    Last edited by xiN; 08-16-2007 at 11:31 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
  •