Feature - Rejected User-Defined Buffbots

Saklad5

Member
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.
 

Darzil

Developer
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.
 

Veracity

Developer
Staff member
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:

Saklad5

Member
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.
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.
 
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.
 

Veracity

Developer
Staff member
You have to change buffbots.txt then recompile to make the changes take effect. I call that hardcoded.
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.
 

Saklad5

Member
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?
 
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:
9aad4d1619.png
 
Last edited:

fronobulax

Developer
Staff member
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.
 
Top