• Visit Rebornbuddy
  • [ChocoboRacer]MGP Farming - AFK Plugin

    Discussion in 'Plugins' started by Rhysling, Mar 12, 2015.

    1. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      Hello everyone. I made a plugin for RebornBuddy that continuously enters the Chocobo Race and gets MGP. I am still new to RebornBuddy api, so the code might not be perfect.

      First of all, some important things to note :

      - The plugin uses image recognition to detect the "Race" button and "Leave" button. For this reason it is required that FFXIV always has focus. This means that you can't use this plugin in background. Just use it when you are AFK.
      - It looks like plugins only work when there is a BotBase running. Just start one of the bots (for example fate bot), so that the plugin can work. Of course don't forget to enable the plugin first.
      - There are no settings at the moment, if you want to change anything do it by altering the code.

      How To Use :

      1) Extract the "ChocoboPlugin" folder in "RebornBuddy/Plugins".
      2) Start RebornBuddy and enable the plugin in the "Plugins" tab.
      3) Stand in front of the "Race Chocobo Registrar" and click the "Start" button.
      4) Go AFK

      Other than entering the race, the plugin will hold W key throughout the race. If you are lucky you might finish in 5-6th place but mostly you will finish last :D

      ToDo List :
      - Add settings
      - Use chocobo skills

      This plugin is in Beta stage and it might have some flaws. Please report any problems you encounter so I can try to fix them.

      Important : As some users pointed out the bot might fail to press Race and Leave buttons when they pop up. This happens mainly because of the resolution difference. Best way to solve this is to take your own screenshots and replace them with the ones in the images folder. You can also try changing the code in ImageUtils.cs (line 30). The default tolerance value is 0.4. If you increase it to 0.5 or 0.6 the bot might be able to find the buttons.

      Download :
      View attachment ChocoboPlugin.zip
       
      Last edited: Mar 12, 2015
      tsincaat and RhysG like this.
    2. Carravanquelo

      Carravanquelo Member

      Joined:
      Apr 2, 2010
      Messages:
      112
      Likes Received:
      0
      Trophy Points:
      16
      Thank you so much, I will give this a good try later.
      What I am wondering about: Could you have it scan for "Lathered" so that "W" stops until Lathered is gone +-5 seconds (or less) so it increases stamina mileage?
       
    3. RhysG

      RhysG Member

      Joined:
      May 16, 2010
      Messages:
      246
      Likes Received:
      4
      Trophy Points:
      18
      Character goes through the dialogue with the registrar fine, following that the character turns around and runs into the wall opposite the room.
      The character then attamepted to go elsewhere but kept running into walls
      Did not accept the race when it popped

      Log attached

      --

      Ps - nice name.
       

      Attached Files:

    4. Carravanquelo

      Carravanquelo Member

      Joined:
      Apr 2, 2010
      Messages:
      112
      Likes Received:
      0
      Trophy Points:
      16
      Working fine for me with Combat Assist botbase. Maybe try something without movement?
       
    5. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      It will hold the W key for 8 seconds, then release it and wait 4 seconds so that Lathered is gone.

      Code:
      [21:26:32.921 D] Requesting path to point on 388 from <-2.382154, -2.145767E-06, -64.78986> to <-12.5346, 2.9, -29.9166> within 15
      [21:26:33.185 D] Generated path to <2.439553, 0.02153194, -24.66003> in 00:00:00.2636607 ms
      [21:26:35.883 N] No fates within operational parameters.
      [21:27:12.378 N] No fates within operational parameters.
      [21:27:15.315 D] Moving to next hop: <-1.656896, 0.121532, -32.20001> (Moving to rest location) D: 13.48541
      
      Judging from the log above the bot is trying to move your character to somewhere. It is caused by something other than my plugin (probably fate bot). Try disabling all plugins other than ChocoboRacer and use this settings in Fate bot:
      fatess.png
       
    6. RhysG

      RhysG Member

      Joined:
      May 16, 2010
      Messages:
      246
      Likes Received:
      4
      Trophy Points:
      18
      Things are slightly different now.
      Matched your settings, still using fate bot, but the bot wont make it through the registrar conversation. Will get stuck on selecting a class
       

      Attached Files:

    7. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      The bot will try to select the "Open" class. If it gets stuck, it is probably because there is no "Open" class in selections. It is weird because I thought Open is available from the beginning.

      Anyway try changing this line (line 85) in ChocoboPlugin.cs :
      Code:
       while (ff14bot.RemoteWindows.SelectString.ClickLineContains("Open"))
      to this :
      Code:
      while (ff14bot.RemoteWindows.SelectString.ClickLineContains("Maiden"))
      Basically just change Open to Maiden or to any selection that is available to you. I am planning to add this in settings but for now this should fix your problem.
       
    8. Djdave

      Djdave New Member

      Joined:
      Feb 22, 2015
      Messages:
      166
      Likes Received:
      1
      Trophy Points:
      0
      No errors for me, but wont accept the duty no matter what screen mode i use. Also every 10 sec or so it hangs my game for 1 second.
       
    9. RhysG

      RhysG Member

      Joined:
      May 16, 2010
      Messages:
      246
      Likes Received:
      4
      Trophy Points:
      18
      We are almost there.
      The dialogue is fine now, gets through everything

      It just wont accept the port. And (same as above) it hangs every now and then.
       

      Attached Files:

    10. Djdave

      Djdave New Member

      Joined:
      Feb 22, 2015
      Messages:
      166
      Likes Received:
      1
      Trophy Points:
      0
      As a side note if i have the bot running and go to the images folder my mouse moves and it trys to press them. So its recognizing the image in windows explorer just not in game.
       
    11. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      Yea I kinda expected this to happen. The reason is probably the resolution difference. What you can do is take two screenshots (one with race button and one with leave button) crop them just like the ones in the images folder and replace the images with your own screenshots.

      Alternatively you can open ImageUtils.cs and edit this line (line 30) :
      Code:
       Rectangle matchRect = searchBitmap(button, CaptureScreen(), 0.4f);
      That 0.4f represents the tolerance. It should be between 0 and 1. Try changing that to for example 0.6f and it might find the button. Setting it too high might cause problems. Try 0.5 or 0.6. If it doesn't work try your own screenshots like I mentioned above.

      This happens because the bot takes a screenshot of your screen to see if the button appeared or not. It will stop after you enter the race and it should not cause any problems.
       
    12. Djdave

      Djdave New Member

      Joined:
      Feb 22, 2015
      Messages:
      166
      Likes Received:
      1
      Trophy Points:
      0
      Thanks for the reply. I was just coming back to post that I made my own .png file for start race and it works fine now. Thanks.
       
    13. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      Nice to hear that it works. You might have to do the same for the leave button though.
       
    14. Djdave

      Djdave New Member

      Joined:
      Feb 22, 2015
      Messages:
      166
      Likes Received:
      1
      Trophy Points:
      0
      Nvm got it working! :) thanks again great plugin already.
       
      Last edited: Mar 12, 2015
    15. Dgame

      Dgame Member

      Joined:
      Aug 19, 2014
      Messages:
      320
      Likes Received:
      0
      Trophy Points:
      16
      Great work. I haven't tried it yet but I've been waiting for this, as I see a quite a few people have been. If any of our great developers have time, is it possible we get some help on this to get it solid please?
       
    16. kagepande

      kagepande Community Developer

      Joined:
      Oct 20, 2014
      Messages:
      289
      Likes Received:
      11
      Trophy Points:
      18
      I think alot of developers will be avoiding this, mainly because the method used isnt the greatest, I would personally call this a dirty work around. I think before you see other developers such as Neverdyne and such deciding to bother with MGP will be when/if support is added to actually interact with the menus rather then using recognition. Though it is a pretty creative way to get a sloppy version working for something people want.
       
    17. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      Exactly this.

      It is not really possible to create anything solid using image recognition. Originally I coded this some time ago using pixel detection. Since pixel detection is too sensitive, i decided to replace it with image detection which is kinda better but still causes problems with some machines. Once you have the correct images and image recognition works, there should be much problem left. After all main purpose is to spam chocobo races.

      It is possible to make something better using packets. If you can find the packets that are used to queue race, accept race and leave race you can send those to the server continuously. RebornBuddy itself works like this but I don't think it is possible to send custom packets other than the ones that are currently supported by RebornBuddy. This would require you to create a separate program that hooks to FFXIV process and send the required packets. As you can tell it is like creating a mini-Bot just for chocobo racing. It is doable but I don't think anyone would bother :D
       
    18. Dgame

      Dgame Member

      Joined:
      Aug 19, 2014
      Messages:
      320
      Likes Received:
      0
      Trophy Points:
      16
      Same issue. Not accepting the Duty. I took screenshots and put them in the correct folder and no change.
       
    19. Rhysling

      Rhysling New Member

      Joined:
      Mar 12, 2015
      Messages:
      7
      Likes Received:
      2
      Trophy Points:
      0
      Yep, there are no errors in the log so the problem is the image. There shouldn't be anything wrong with the code of image recognition. It works fine for me and also for some other people.

      You can try increasing the image tolerance (check my first post in this page). Or you can try another screenshot. Just crop the part where it writes "Race" and overwrite the old image.
       
    20. Dgame

      Dgame Member

      Joined:
      Aug 19, 2014
      Messages:
      320
      Likes Received:
      0
      Trophy Points:
      16
      Thank you for the reply. Yup, that was the issue. I just had to crop it better. Also for those that may not know, if you play with a controller make sure you put your UI in Keyboard/Mouse mode. Or else it will just spam "W" in your chat log.
       

    Share This Page