acquireBuff - Get a buff from a buffbot

Yeah i know the feeling, when i was working on the same problem i designed a script to refill the buffs kinda like a between battle script using a improved version of this code. In mine though i just run the buffs from a datafile thats made by a webpage. It would be nice to just be able to grab the buff list from mood management but its not possible currently.
 
I just found a case where the script didn't think I had the four songs modifier when I did so it didn't request a buff, I'll look into fixing it in the next couple days.
 
So I just switched over to using this library for requesting buffs, but I'm running into some wierdness.

This is how I'm calling it:
"acquireBuff2 Carlweather's Cantata of Confrontation"

And I seem to get an infinite loop... I understand waiting for the buff, but it seems to send kmail every 30 seconds.

> Checking for updates (running ZLib ver. : 22)...
> You have a current version of ZLib.
> AcquireBuff.ash made by rinn, updated by oly0015
> So it seems you need Carlweather's Cantata of Confrontation
> Attempting to get the song Carlweather's Cantata of Confrontation
> Carlweather's Cantata of Confrontation
> Refreshing buffbot data...
> Buffbot data refreshed.
> Previous value of acquireBuff_last_update: 20110214
> Changed to 20110215.
> Sending kmail to Noblesse Oblige for 4meat

send a kmail to Noblesse+Oblige: 4 Meat
> Refreshing buffbot data...
> Buffbot data refreshed.
> Previous value of acquireBuff_last_update: 20110215
> Sending kmail to Noblesse Oblige for 4meat

send a kmail to Noblesse+Oblige: 4 Meat
> Refreshing buffbot data...
> Buffbot data refreshed.
> Previous value of acquireBuff_last_update: 20110215
> Sending kmail to Noblesse Oblige for 4meat

send a kmail to Noblesse+Oblige: 4 Meat
> Refreshing buffbot data...
> Buffbot data refreshed.
> Previous value of acquireBuff_last_update: 20110215
> Sending kmail to Noblesse Oblige for 4meat
 
To avoid retrieving the buffbot data at each try, replace line 114
PHP:
cli_execute("zlib acquireBuff_last_update = " + today_to_string());
with
PHP:
vars["acquireBuff_last_update"] = today_to_string();
updatevars();

Another issue is that the script should try a first online bot (as determined by is_online()), and try the next one if you don't get the buff after waiting. The problem is that gather_data() is called at each try, and gather_data() resets the "online" flag that was meant to be switched off to skip the buffbot on the next iteration.

The best way to avoid this would be to only call gather_data() only once, from the top level so it is called even if another script imports acquireBuff.ash. Simply move line 210
PHP:
gather_data();
to the top level (on line 100 for example, right after the function is defined).
 
I fixed an issue that wasn't causing the four songs modifier to get rechecked (because it was in the top level). I'll update it in a second.
 
I just updated to daily build 11180, and now when I use this script I get "Function 'to_skill(skill)' undefined." on this line:
else if ((mp_cost( to_skill( activesong[knownsong] ) )+1)<cost)

Anybody know what changed? I've been using this same script for about a year.
 
Yeah, some meaningless conversions were removed about a month ago during a code tidying binge. For instance what the point of converting a skill to a skill? Get rid of the to_skill() and you'll be fine.

Actually you must be using an old version of the script since it doesn't even seem to have the line you were quoting. Just download the new version.
 
Last edited:
Yeah, I was using a modified version before Rinn's update. I updated and now it works fine.

One more quick question:
does this script check if the user can cast the buff before requesting it? I'm guessing not.
 
Now I'm having a different problem. With acquirebuff 1.6, if I call it from a CLI script using "acquireBuff ode to booze" I end up getting wierd results. I get 100 turns of shanty of superiority immediately, and then it goes into an endless loop, waiting for ode, which never happens, because when I got shanty I already have 3 accordion buffs.

Strange thing is, if I call "acquirebuff ode to booze" directly from the command line, it seems to work fine.

Any ideas?
 
If you're running it from a script, why not do it the 'right' way...
Code:
import <acquireBuff.ash>
acquireBuff($effect[ode to booze]);
 
So how about running
Code:
ashq import <acquireBuff.ash> acquireBuff($effect[ode to booze]);
as a CLI command?
 
I'll try it.

So the way I was calling it is invalid? Because I've been using it that way for over a year and it worked like a champ.
 
Not really... what you were doing by using the main call is this:
Code:
void main(effect e)
{
	acquireBuff(e);
}
Which is almost exactly what I suggested doing... the difference between them is that in your way, it tries to convert the words "ode to booze" to an effect, which should hopefully be $effect[ode to booze]. In the way I suggested, we explicitly say that $effect[ode to booze] is what we want, no conversions needed.

It's also possible that some buffbot changed its prices and hasn't informed mafia... but in that case, acquireBuff should move on to the next buffbot listed available.
 
I checked the acquireBuff_data.txt file in my data folder, and it seems to have the correct lines for those bots:
Ode to Booze 20 25 SevenLances_com true
Ode to Booze 23 20 IocaineBot true

Strangely, it's sending 20 meat to both SevenLances_com and IocaineBot. Shouldn't it be sending 23 meat to IocaineBot?
 
Back
Top