Creating a Pixel Bot in C# from zero  - "kinda" tutorial menu

User Tag List

Page 6 of 9 FirstFirst ... 23456789 LastLast
Results 76 to 90 of 122
  1. #76
    Nagamori's Avatar Member
    Reputation
    1
    Join Date
    Mar 2020
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Olha um portugues!

    Creating a Pixel Bot in C# from zero  - "kinda" tutorial
  2. #77
    someorother's Avatar Member
    Reputation
    3
    Join Date
    Oct 2019
    Posts
    12
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stonebent View Post
    Instead of having actual color codes, use a texture along with SetTexCoord.
    It does the trick.
    Do you mean using hundreds of pictures with different colors in them? And then having the addon to change the picture of the texture instead of just changing the color with SetColorTexture?

  3. #78
    Evildev's Avatar Member
    Reputation
    1
    Join Date
    Apr 2020
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, the weakaura works for me outside of BGs, but in AV it stops working, anyone who has the same issue can help me ?

  4. #79
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *** removed ***
    Last edited by GlittPrizes; 04-29-2020 at 09:35 PM.

  5. #80
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice! I finally got it reading the pixels:

    Player Stats.jpg
    Last edited by GlittPrizes; 05-01-2020 at 07:22 PM. Reason: blah

  6. #81
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Evildev View Post
    Hello, the weakaura works for me outside of BGs, but in AV it stops working, anyone who has the same issue can help me ?
    You have to read memory to do stuff in instances and BG's. Blizzard did that to prevent bots that can farm instances all day, but instance farming is pretty dead now anyways compared to the actual lucrative stuff. I think Interact with target is also disabled in BG's, so that multiboxers can only do their thing in the open world. You have to have pure math based steering if you want to pixel bot in instances. You could in theory use some of the ideas like a target marker being read along lua error messages to do it, but you might as well focus that energy on a memory bot at that point.

  7. #82
    Evildev's Avatar Member
    Reputation
    1
    Join Date
    Apr 2020
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply hycolyte, i will dedicate some months in creating a pixel bot without reading memory to leech av honor but mostly to learn, if anyone has any source code he can share with me i would like to see it for learning purposes only

  8. #83
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Evildev View Post
    Thanks for your reply hycolyte, i will dedicate some months in creating a pixel bot without reading memory to leech av honor but mostly to learn, if anyone has any source code he can share with me i would like to see it for learning purposes only
    On second thought I found there are ways to still face your target in AV. There are several quest items that exist in retail at least (not sure about classic) that will face your target. Certain spells also have this behavior. However, I don't think there is a way to get your coords, so you would be without navigation.

    How should I send keypresses though? I get disconnected from using PostMessage after like 5 minutes. Maybe it's something else, I can't properly diagnose it.

    Update edit: the disconnects seem to be from immediately interacting with a new target while turning with virtual keypresses. Humanized timing/safe randoms didn't matter it was simply turning/interacting together that would disconnect.
    Last edited by GlittPrizes; 06-09-2020 at 05:14 AM. Reason: update

  9. #84
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was able to get it working as a blazor app

    Last edited by GlittPrizes; 05-14-2020 at 12:25 AM. Reason: spacing

  10. #85
    tessier-ashpool's Avatar Member
    Reputation
    2
    Join Date
    May 2020
    Posts
    5
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I stumbled across this post and since i dabble with programming from time to time I decided to see what I could do with the information provided. I actually surprised myself with the progress I have made. I am able to record and follow a route. The bot will check for targets periodically and when it finds one will engage in combat. I did not plan out my code or have any idea what I was getting myself into and its starting to become difficult to make sense of it. I spent far too long writing the algorithm to turn the player the shortest direction especially across the 0/360 degree value. I believe I need to implement some FSM but I still don't understand them. Just wanted to say thanks for the information here and leave my two cents.

  11. #86
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here are some important functions I use you might find helpful for turning:

    Turn
    Code:
    public void Turn(object sender)
    {
        if (!GameData.HasTarget)
        {
            var turnDegrees = GetTurnDegs(DegToTarget(Next));
    
            bool turnRight = GetTurnDir(turnDegrees.Item1, turnDegrees.Item2);
    
            int turnTime;
    
            if (!turnRight)
                turnTime = GetTurnTime(turnDegrees.Item1);
            else
                turnTime = GetTurnTime(turnDegrees.Item2);
    
            KeyWrap turnKey;
    
            if (turnRight)
                turnKey = Keys.TurnRight;
            else
                turnKey = Keys.TurnLeft;
    
            if (turnTime > MIN_TURN_TIME)
            {
                turnKey.PressKey(ID);
                Thread.Sleep(turnTime);
                turnKey.ReleaseKey(ID);
            }
        }
    }
    Turn Functions
    Code:
    int DegToTarget(PointF point)
    {
        var angle = Math.Atan2(Location.X - point.X, Location.Y - point.Y);
    
        var degree = angle * 57.2958;
        degree = degree % 360;
    
        return (int)degree;
    }
    
    Tuple<int, int> GetTurnDegs(int degToTarget)
    {
        int facing = Facing;
    
        int degreesLeft = degToTarget - facing;
        int degreesRight = facing - degToTarget;
    
        if (degreesLeft < 0) degreesLeft += 360;
        if (degreesRight < 0) degreesRight += 360;
    
        return new Tuple<int, int>(degreesLeft, degreesRight);
    }
    
    bool GetTurnDir(float degreesLeft, float degreesRight)
    {
        return degreesRight < degreesLeft ? true : false;
    }
    
    int GetTurnTime(int turnDegrees)
    {
        float radians = (float)(turnDegrees * 0.0174533);
    
        return (int)(1000 * (radians / Math.PI));
    }
    Last edited by GlittPrizes; 06-09-2020 at 05:08 AM. Reason: locks

  12. Thanks tessier-ashpool, Plobbi (2 members gave Thanks to GlittPrizes for this useful post)
  13. #87
    tessier-ashpool's Avatar Member
    Reputation
    2
    Join Date
    May 2020
    Posts
    5
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice, this is what I settled on after a couple hours in bed awake one night after having too much caffeine.

    Code:
                // CALCULATE ANGLE
                double r = Math.Atan2(-target.Y, target.X); // Radians, WoW is Y+ down so invert the Y value
                double a = r * (180 / Math.PI); // Convert radians to degrees
                a = (a < 0) ? a += 360 : a; // Convert to 360 instead of 180-(-179)
    
                double f = player.Facing; // Angle the player is facing in degrees
                double error = f - a;
                if (Math.Abs(error) > 180)
                {
                    f = (f < a) ? player.Facing + 360 : player.Facing - 360;
                    error = f - a; // Recalculate the error for the new angle
                }
    If the error is negative i turn the player left, if its positive i turn the player right instead.

  14. Thanks GlittPrizes (1 members gave Thanks to tessier-ashpool for this useful post)
  15. #88
    Plobbi's Avatar Member
    Reputation
    1
    Join Date
    Aug 2014
    Posts
    11
    Thanks G/R
    6/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the pixel bot idea with c# but i am missing the function that decodes the RGB colour. Anyone who can help me pls?

  16. #89
    GlittPrizes's Avatar Active Member CoreCoins Purchaser Authenticator enabled
    Reputation
    58
    Join Date
    Nov 2019
    Posts
    104
    Thanks G/R
    53/33
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Plobbi View Post
    Thank you for the pixel bot idea with c# but i am missing the function that decodes the RGB colour. Anyone who can help me pls?
    Code:
    int ColorToInt(Color color)
    {
        return (int)(Math.Pow(256, 2) * color.R + 256 * color.G + color.B);
    }
    And this is what I use for the lua code to generate the RGB int
    Code:
    function IntToRGB(n) 
       if n >= (math.pow(256,3)) then -- 16777215 is the MAX_RGB_INT
          error("Can't encode integer (too large)")
       end
       
       local r = math.floor(n / 65536)
       local g = math.floor(math.fmod(n / 256, 256))
       local b  = math.floor(math.fmod(n, 256))
       
       -- RGB percent conversion
       return { r = r / 255, g = g / 255, b = b / 255 }
    end

  17. Thanks Plobbi (1 members gave Thanks to GlittPrizes for this useful post)
  18. #90
    Plobbi's Avatar Member
    Reputation
    1
    Join Date
    Aug 2014
    Posts
    11
    Thanks G/R
    6/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by hycolyte View Post
    Code:
    int ColorToInt(Color color)
    {
        return (int)(Math.Pow(256, 2) * color.R + 256 * color.G + color.B);
    }
    And this is what I use for the lua code to generate the RGB int
    Code:
    function IntToRGB(n) 
       if n >= (math.pow(256,3)) then -- 16777215 is the MAX_RGB_INT
          error("Can't encode integer (too large)")
       end
       
       local r = math.floor(n / 65536)
       local g = math.floor(math.fmod(n / 256, 256))
       local b  = math.floor(math.fmod(n, 256))
       
       -- RGB percent conversion
       return { r = r / 255, g = g / 255, b = b / 255 }
    end
    thank you so much! It works like a charm

Page 6 of 9 FirstFirst ... 23456789 LastLast

Similar Threads

  1. [Question] Has anyone ever made an entire farming-bot with much much pixel-reading in AutoIt?
    By crunk001 in forum WoW Bots Questions & Requests
    Replies: 18
    Last Post: 02-05-2017, 06:34 AM
  2. Gold from botting in MOP
    By 403Forbidden in forum WoW Bots Questions & Requests
    Replies: 3
    Last Post: 01-16-2013, 06:49 AM
  3. Replies: 0
    Last Post: 09-09-2012, 06:38 AM
  4. Replies: 4
    Last Post: 04-18-2010, 12:47 PM
  5. Botting in Barrens 12-20
    By karokekid in forum World of Warcraft Bots and Programs
    Replies: 20
    Last Post: 12-02-2006, 07:21 PM
All times are GMT -5. The time now is 06:42 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search