Results 1 to 9 of 9

Thread: User-Defined Buffbots

  1. #1
    Senior Member
    Join Date
    Apr 2018
    Posts
    133

    Default User-Defined Buffbots

    KoLmafia has built-in support for running and using buffbots, but the latter is quite limited. It currently has a hardcoded list of URLs it checks, each of which point to an XML file detailing the buffs available.

    I think it would be much more useful if users could add their own buffbots to KoLmafia without recompiling the entire application. It doesnít even have to have a UI: a designated folder where users could add new XML files would work fine. Alternatively, such files could be distributed like scripts are now, using SVN, or with raw URLs like the hardcoded buffbots.

    I donít think any of the existing code will have to be overhauled, for the most part. You would just need to replace the hardcoded URLs with something that checks the aforementioned sources for XML files.


    I am aware that ASH scripts could be used instead of this, and I am currently doing that myself, but it would be nice to have things like Ode to Booze applied using the clan buffbot when you drink something.

  2. #2
    Developer
    Join Date
    Apr 2010
    Posts
    4,811

    Default

    It isn't a hardcoded list of URLs, it's buffbots.txt.

    So you probably just need to add a extra file of the same format that can also be checked, and the code to check it.

  3. #3
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,411

    Default

    Or you can stick the (modified) file with that name in your "data" directory.
    If we check in a new version of buffbots.txt, you'll have to manually merge in the changes.

    (I assume we still allow you to "override" build in data files. We long since deprecated using such as a "standard" way of getting acess to new content before we roll out a new release on sourceforge, since we aree much much better of automatically learning about new items and effects and such and making them usable within a session, and since many people simply use daily builds now.)
    Last edited by Veracity; 06-01-2018 at 11:21 AM.

  4. #4
    Senior Member
    Join Date
    Apr 2018
    Posts
    133

    Default

    It isn't a hardcoded list of URLs, it's buffbots.txt.

    So you probably just need to add a extra file of the same format that can also be checked, and the code to check it.
    Originally Posted by Darzil View Post
    buffbots.txt is where it is stored in the source, but once you compile it that is no longer editable. You have to change buffbots.txt then recompile to make the changes take effect. I call that hardcoded.

  5. #5
    Senior Member
    Join Date
    Jun 2016
    Posts
    232

    Default

    Last I checked (granted, that's a few months ago), a file in the data folder still overwrote one inside the .jar, in this case it was a mallprices.txt that was messing with my calculations as a result.

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,411

    Default

    You have to change buffbots.txt then recompile to make the changes take effect. I call that hardcoded.
    Originally Posted by Saklad5 View Post
    Unless you do what I told you about in the post directly above your post.
    Thirteen+ hours before you posted.

    I notice that the dictator confirmed that my advice was (still) sound in the post directly after your post.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #7
    Senior Member
    Join Date
    Apr 2018
    Posts
    133

    Default

    Sorry, I didn’t realize that was what you meant. It was unclear.

    So as long as the code is modified to accept file paths in addition to URLs, that will work?

  8. #8
    Senior Member
    Join Date
    Jun 2016
    Posts
    232

    Default

    Nobody needs to modify file paths, any file stored in the data folder inside your mafia folder will overwrite a file of the same name inside the the data folder in the jar. So all you'll have to do is write your own buffbots.txt and stick it inside the data folder inside whatever folder you run mafia from.

    In other words: the file highlighted in the middle means the file included inside the jar (below) is ignored:
    Last edited by the dictator; 06-02-2018 at 01:47 PM.

  9. #9
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,144

    Default

    To address the other point if you use file:// as the protocol then I am reasonably certain that the buffbot code will try and open a local file. I am not certain of that but you could test it faster than I could dissect the code to confirm it. You probably do want to have the file in the mafia data directory so you don't run afoul of mafia restrictions on access to the local file system.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •