Jump to content
News Ticker
  • Minecraft Server 1.19 is Live!
  • Monster Hunter Sunbreak Out Now!
  • WoW Season 4 Starting 8/2/2022

Awesome_Taco

Administrators
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    21

Posts posted by Awesome_Taco

  1. Welcome to coding with Taco.

    Here are the requirements:

    Python 3.7
    pip install opencv-python
    pip install PyAutoGUI

    The code editor I use is VS Code or VS Studio , you can use whatever you like.
     

     

    The goals:

    Open Battle.net

    Select WoW (I will not be going over switching from WoW to WoW Classic, but you should be able to understand how to do that from this tutorial)

    Hit the play button
    Select the Server
    And accept the full warning message if present.

     

    Might seem tough but it is easier than you would expect.

    First, lets go through the process the script will have to go. Take screenshots of every step and save them.
    Open battle net, select the game, hit the play button, wait for connection, select the server, accept the warning.

    Create your new python file.

    Set your imports

    We are going to want to import:

    import os	
    import time
    import pyautogui

     

    Now as a requirement above, I mention opencv-python. PyAutoGUI will use it on its own without you having to import to script.

    So now the easy part. Open Battle.Net. File your file location for Battle.net. You can right click on the icon and open file location.

    Mine is here:

    C:\Program Files (x86)\Battle.net\Battle.net Launcher.exe

    We will use the import os to launch/bring to the front Battle.net

    os.startfile('C:\Program Files (x86)\Battle.net\Battle.net Launcher.exe')

     

    We can run the script to make sure it opens Battle.Net to see if it works.

    Now, we are going to want to wait maybe two seconds to make sure it opens.

    Waiting is also called sleeping.
    So we will put:

    time.sleep(2)

    The script will wait 2 seconds.

    Now, we are going to want to edit our first photo. We want to get the image from the side bar like this:
    image.png.cd7b2cc5d5eb3d73b67261f09ce20c69.png

    Save the image as something understandable like WoWButton.png

    Now back to the script!

    PyAutoGUI is going to be doing all the hard work here.

    PyAutoGUI has a function to find an image on the screen called locationOnScreen, simple right?

    # Gray Scale to remove colors to make it easier to match
    # .9 Confidence just because the background color noise
    wowIcon = pyautogui.locateOnScreen('WoWButton.png', grayscale=True, confidence=.9)

    wowIcon will equal the position on screen the image is found.

    If you print it to the console, you will see top, bottom, left, right with the cords on screen.

    We will want to make sure it clicks in the center of the button.
    So we got to center it and then get what those mouseX and mouseY cords will be:

    # Center the mouse
    wowIcon = pyautogui.center(wowIcon)
    wowIconx, wowIcony = wowIcon

    Again, PyAutoGUI is doing all the hard work.

    Now, you just got to click on it:

    #Click!
    pyautogui.click(wowIconx, wowIcony)

     

    Now, not everything will just let you click on it without the mouse moving. I'd imagine it is because they want to make it harder for bots.
    An easy fix and one that was needed when selecting the server is by moving the mouse. This can be done like this:
     

    # Find the server name
    serverName = pyautogui.locateOnScreen('serverIcon.png', grayscale=True, confidence=.9)
     
    # Center it!
    serverName = pyautogui.center(serverName)
     
    # and well click it.
    serverNamex, serverNamey = serverName
    pyautogui.moveTo(serverNamex + 1, serverNamey + 1)
    time.sleep(.5)
    pyautogui.click(serverNamex, serverNamey)

     

    So like before, we created an image of the server name:

    image.png.e66f74cab94726f4fef994abbe477e24.png

    Then we found it, moved the mouse to the location. I made it move 1 pixel higher on the x and y just so there is some more movement when clicking. The delay isn't really needed but makes it seem more human.

     

    Attached is the full script with a batch file. You can use the task scheduler to launch the script at a specific time or just to make it open quicker while you do something else.

     

    I hope you learned something!

     

    Attached is the script to prevent AFK disconnect. 
    Try at your own risk. I am not sure if this will be detected as a bot. 
     

    import time
    import random
    import pyautogui
     
    def Forward():
         return pyautogui.press('w')
     
    def Back():
         return pyautogui.press('s')
     
    def Left():
         return pyautogui.press('a')
     
    def Right():
          return pyautogui.press('d')
     
    switcher = {
              0: Forward,
              1: Back,
              2: Left,
              3: Right
         }
     
    def direction(argument?
         # Get the function from switcher dictionary
         func = switcher.get(argument, "nothing")
         # Execute the function
         return func()
     
    while True:
         time.sleep(random.randint(1,10))
         pyautogui.press('space')
         time.sleep(random.randint(1,10))
         direction(random.randint(0,3))

     

     

    Updated.zip

    Press Space.py

  2. I was bored at work and saw a nice challenge of putting together (a not so hard) puzzle for the new TeamSpeak 5. 

    On their twitter: https://twitter.com/teamspeak
    There are puzzle images of what we are to believe is the next teamspeak UI. 

    I thought it would be fun to have Python do the work for me. 

    So it is quick and dirty but should still make sense. 

     

    from PIL import Image, ImageChops
     
    image_one = Image.open('1.jpg')
    image_two = Image.open('2.jpg')
    image_three = Image.open('3.jpg')
    image_four = Image.open('4.jpg')
    image_five = Image.open('5.jpg')
    image_six = Image.open('6.jpg')
    image_seven = Image.open('7.jpg')
    image_eight = Image.open('8.jpg')
    image_nine = Image.open('9.jpg')
    image_ten = Image.open('10.jpg')
     
    diff = ImageChops.difference(image_one, image_two)
    diff2 = ImageChops.difference(diff, image_three)
    diff3 = ImageChops.difference(diff2, image_four)
    diff4 = ImageChops.difference(diff3, image_five)
    diff5 = ImageChops.difference(diff4, image_six)
    diff6 = ImageChops.difference(diff5, image_seven)
    diff7 = ImageChops.difference(diff6, image_eight)
    diff8 = ImageChops.difference(diff7, image_nine)
    diff9 = ImageChops.difference(diff8, image_ten)
    
    diff10 = ImageChops.invert(diff9)
     
    diff10.save('diff.jpg')

    They have 10 images at the time I wrote this, so we are missing 2 more. I named them in order, not really necessary, you can create an empty folder and just have it open all images in directory with a loop.

     

    Here is the result:

    image.png.60d655fac434f974a07708bb34e980b8.png

  3. Hello!
    This thread is for the server restarter. If there is an issue with a game. Just post the game name from the list. Please don't add anything else to it. 

    Post below is an example, only post the name of the game from the list. 

    Game server list:
    ....

  4. Welcome to coding with Taco!

    Let's start the new project. This project will pull information from https://min-api.cryptocompare.com and get us the information we want on RavenCoin. I have chosen this website because they hold historical information and would be cool to see in the app. (On top of it being free as CoinMarketCap will start charging for use of the API)

    Creating the new Project. 

    Spoiler

    1615425611_ScreenShot2018-05-03at1_49_33PM.thumb.png.6d3e0ec721e6d6d11cb57259215f770f.png

    Not going to be teaching Kotlin today so we just want to name the project to whatever we want. and save it where you want it. 
     

    264303944_ScreenShot2018-05-03at1_49_41PM.thumb.png.c150ee2d312f87ab4e2eeaee79ddc4b9.png

    Focus will be Phone and Tablets. Android Lollipop supports material design which is great and will work for 71.3% of the devices out there. 

    1911119804_ScreenShot2018-05-03at1_49_47PM.thumb.png.afa07e20e4cc0a30877cc2b78a317542.png

    As this will be a pretty simple interface, Basic Activity and Empty Activity will both work fine. Basic will just come with a FAB in the bottom right but you can set that to gone in the layout. 

    299160098_ScreenShot2018-05-03at1_49_51PM.thumb.png.f27862bdcc65fa54aaec5a5970c2e64e.png

    Finally, just setting up the MainActivity. Don't need to rename it. 

    Hit Finish and let the project load to competition.  

    Uses Permissions

    Spoiler

    Find AndroidManifest.xml in the Manifest folder

    1466279823_ScreenShot2018-05-03at1_58_50PM.thumb.png.f8464af5023cc581f2fe950e8cae18a3.png

    Double click on it and add some space below 

    
    package="me.jcrystal.ravencointut">

    Enter this:

    
    <uses-permission android:name="android.permission.INTERNET"/>
    

    It should look like this in the end

     

    84469705_ScreenShot2018-05-03at1_59_07PM.thumb.png.5a2daeb6802a4c00a7c3870bcb97d628.png

     

Popular Topics

About us

Warpigs is a semi-hardcore multi game community, for both MMOs and other genres. Our core, which has largely remained the same, started back in 2014. Warpigs first got started in Wildstar and has since branched out to several other game including, Black Desert Online, Overwatch, Heroes of the Storm as some of our most active games. We also have a strong internal following for both Dauntless and Ashes of Creation.
 

Warpigs function as a tight knit family-esque guild, which is not to say that our conversations are G-rated. Quite the opposite, but when you're one of us, we've got your back. Words fly pretty freely, and I'm always of the opinion that if you play an MMO, or any game with a social player base, you need thick skin and know not to take things personally. With that being said, we are a well organised and have a fairly mature membership, and as such we offer a very stable guild that we hope will be here for many more years to come.
 

Warpigs are dedicated to a friendly, team focused, fun-loving gaming environment where every member is important and not just a number on a roster. We seek to foster long term friendships among members and enhance the online gaming experience by virtue of those friendships.

×
×
  • Create New...