• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [Bot] PokehBuddy (Conversion of Plugin)

    Discussion in 'Botbases' started by sychotix, Dec 16, 2013.

    1. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      Not really sure what would do it since I assume it is a gradual memory leak. If anyone has any ideas, please let me know. I would assume that it is caused by my LUA statements. I do not know much about LUA, so if people could help me with it... that would be great.
       
    2. LifeCycle

      LifeCycle New Member

      Joined:
      Feb 3, 2011
      Messages:
      32
      Likes Received:
      0
      Trophy Points:
      0
      Quite epic. :D I hated most of the pet systems but it's much more simplistic now.
       
    3. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      Not sure what I'm doing wrong but I have extracted pet logic files into PokehBuddy/PetSettings but it doesn't load them. Each of the logic files is named with the pet name rather than the pet ID and all it does is create a new file named <PetID>.xml - Do I need to change something somewhere to make it look for files based on name rather than ID?

      EDIT: I've deleted all logic files that PokehBuddy has already created, i.e. anything <PetID>.xml thinking it would convert the others but it doesn't appear to.
       
    4. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      It should be converting the species name files to the <PetID>.xml files. If this is not happening, check to make sure the file name of the species is correct, and that it actually contains the logic you think it does.
       
    5. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      I've tried manually renaming the file it the PetID to make sure that the logic works as expected and it does. What should trigger the "converting"?
       
    6. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      Unless I am misremembering, it should work something like this.

      Check if <PetID>.xml exists. If so, load it.
      Else check if <SpeciesName(?)>.xml exists. If so, load it and convert it to <PetID>.xml.
      Otherwise, load default logic and save it as <PetID>.xml
       
    7. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      So I have an xml file - Adder.xml with content as follows:

      <?xml version="1.0" encoding="utf-8"?>
      <PetBattleSettings>
      <Logic>CASTSPELL(1) Health(ENEMYPET) ISLESSTHAN 20@SWAPOUT Health(THISPET) ISLESSTHAN 30@CASTSPELL(2) HASENEMYBUFF(154) EQUALS false $ COOLDOWN(SKILL(2)) EQUALS false@CASTSPELL(3) COOLDOWN(SKILL(3)) EQUALS false@CASTSPELL(1) COOLDOWN(SKILL(1)) EQUALS false</Logic>
      </PetBattleSettings>

      The PetID for Adder is 16621516 and that file does not currently exist. If I enter a battle it creates that file but it only contains the default logic. Am I missing something?
       
    8. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      Try closing the bot, then deleting the <PetID>.xml file.
       
    9. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      Done as requested but there is no change. Do you know where in the source these pet settings files are created? I can try and debug it and understand why for me it is not functioning as intended.
       
    10. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      I think it is in LoadPetSettings within PokehBuddy.cs
       
    11. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      I've found the problem - the speciesID being passed to LoadPetSettings is actually the numeric ID representing the species whereas the .xml logic files I have are the pet name, e.g. Adder.xml

      Having changed the parameter SpeciesID to Name in all LoadPetSetting function calls I can confirm that this is now working as expected. Could I request the logic be changed to check pet name either instead of, if that was the initial intention, or as well as speciesID otherwise?
       
    12. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      Ahh, alright. I pushed your suggestion out to the SVN.
       
    13. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      I think there are a few problems with PvP pet battling:

      - It doesn't accept the pet battle when the window pops up
      - When the window is up the system message: "Pet battle already in progress." is recorded over and over
      - It appears to queue as soon as it gets out of a PvP battle, it doesn't wait based on the time offsets set in the bot config
      - It spams "Queued for PvP match" and "InPetBattleQueue" repeatedly, is this a Logging command left in from development?
       
    14. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      Yeah, probably a logging command that I left in accidentally. I haven't tested PVP battling at all as it didn't interest me, nor did I include the wait timer. I can work on adding this tomorrow if you would like. I am not quite sure about the "Pet battle already in progress" part. I assume it has something to do with the LUA command being incorrect or something. Yet another thing I'll have to look into.
       
    15. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      Sounds good - happy to help with any testing as required.
       
    16. Obliv

      Obliv New Member

      Joined:
      Oct 18, 2011
      Messages:
      636
      Likes Received:
      6
      Trophy Points:
      0
      Getting the exact same thing. I copied the PetSettings from the plug-in to the bot base. Using the PetSettings for the plug-in version works fine. However, when I choose to use the Bot version, it will create #.xml for just about every pet I use. ** This is with the latest version 24 on the SVN.
       
    17. TreeK

      TreeK New Member

      Joined:
      Jul 10, 2012
      Messages:
      170
      Likes Received:
      1
      Trophy Points:
      0
      Hey sychotix, I've been running into another issue here similar to what I reported back on the first page. When I have pet logics that make use of the pet health (my pet health or enemy), they very often will fail to trigger reliably. I uncommented out the line "myPets.updateMyPets();" in PetBattleAttackAction and it cleared up the issue for me. Before this change, it appeared that the logic could be processed before the results of the previous round were read/available. Seems likely a timing issue as sometimes it worked correctly, other times it did not.
       
    18. Grommers

      Grommers New Member

      Joined:
      May 25, 2013
      Messages:
      21
      Likes Received:
      0
      Trophy Points:
      1
      Do the created <PetID>.xml files contain the correct pet logic? The botbase converts the named .xml file into one using the petid as the filename.
       
    19. sychotix

      sychotix New Member

      Joined:
      Dec 13, 2013
      Messages:
      727
      Likes Received:
      5
      Trophy Points:
      0
      What Grommers said. Also, forgot to do all that stuff for PVP =P My GF is visiting, so I haven't done much coding. TreeK, I am not quite sure what else I could do if it is a race condition. That seems more likely to be a problem with how HB is coded. Maybe there is a way to declare that it is a critical section? When exactly are you getting these problems?

      It could also be a problem with the way choose to update the pets. I only update them when an event is fired, and maybe it isn't firing every time I think it will.
       
    20. toliman

      toliman Member

      Joined:
      Jun 20, 2012
      Messages:
      625
      Likes Received:
      10
      Trophy Points:
      18
      The battle pet API often breaks inexplicably, and can return 0 and null data, as well as the wrong indexed pet if you use the LUA function calls. Fundamentally, it works. 99%.

      Obviously it's improved over time, but it was one of the reasons the journal wasn't cached into a table early on by pet addons.

      Many of the pet plugins still have problems caching the journal or finding a good way to detect changes, so they have to poll whenever the character changes status or zone location, sic, using more reliable API's.

      As for everything else, GL. It's going to be a fun experience getting new stuff into a bot, vs syncing up with the plugin changes.
       

    Share This Page