Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 44

Thread: acquireBuff - Get a buff from a buffbot

  1. #11
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,510

    Default

    If lost is right, and you had a string variable buff, that contained "ode to booze", then you should do:
    PHP Code:
    acquireBuffbuff.to_effect() ); 
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  2. #12

    Default

    Yep, seems i can't cheat to use $effect[] instead of the proper conversions. Anyway this works for now, i'm correcting my code still from last night for the other half atm.

    Code:
    void getbuff (string buff)
    {
    	if (have_skill( to_skill( buff )))
    	{
    		if ((mp_cost( to_skill( buff ) )+1) < my_mp() )
    		{
    			use_skill( 1, to_skill( buff ));
    		}
    		else
    		{
    			mp_heal(mp_cost( to_skill( buff ) )+1);
    			use_skill( 1, to_skill( buff ));
    		}
    	}
    	else
    	{
    		print ("Buying you some "+buff,"green");
    		acquireBuff(to_effect( buff ));
    	}
    }

  3. #13
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,510

    Default

    I think there are skills and effects that don't share the same name, so using to_skill() and to_effect() to the same string might not work in every case.

    You should pass in an effect:
    Code:
    boolean getbuff (effect buff)
    {
    	if ( have_skill(to_skill( buff )) )
    	{
    		if ( (mp_cost( to_skill( buff ) )+1) > my_mp() )
    			mp_heal(mp_cost( to_skill( buff ) )+1);
    		return use_skill( 1, to_skill( buff ));
    	}
    	else
    	{
    		print ("Buying you some "+buff,"green");
    		return acquireBuff(buff);
    	}
    }
    Of course, you could also input a skill, and use have_skill(buff) and acquireBuff(buff.to_effect()).
    Oh, I also changed the return value to a boolean, since Rinn already returns a boolean from acquireBuff().

    EDIT: Another small thing: in most cases, buffbots have access to really cheap MP, so generally it will be cheaper to buy a buff from a buffbot rather than cast it on yourself. Although I guess that when you only want a single shot of Ode, for example, it's not really worth waiting for a bot to buff you.
    Last edited by slyz; 06-17-2010 at 05:04 PM.
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  4. #14

    Default

    Yep, I've got it set for now to use rinns script straight through, unless its ode

  5. #15
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,510

    Default

    Oh. And this:

    Code:
    int current_songs() {
       int total = 0;
       for skill_num from 6001 to 6040
          if(skill_num.to_skill() != $skill[none] && skill_num != 6025 && skill_num.to_effect().have_effect() > 0)
             total = total + 1;
       return total;
    }
    Originally Posted by Bale View Post
    There's a to_skill() missing there:
    Code:
    int current_songs() {
       int total = 0;
       for skill_num from 6001 to 6040
          if(skill_num.to_skill() != $skill[none] && skill_num != 6025 && skill_num.to_skill().to_effect().have_effect() > 0)
             total = total + 1;
       return total;
    }
    EDIT: Rinn - sorry for the huge threadjack!
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  6. #16

    Default

    Oh if it helps for bales code, i had to make a bit of an edit, in his math the hookah buff if its an AT song doesn't get counted. What this does is if the hookah goes beyond your maximum amount of songs this code will take off the song it buffed.

    Code:
    	boolean four_songs = boolean_modifier("four songs");
    	boolean extra_song = boolean_modifier("additional song");
    	int max_songs = 3 + to_int(four_songs) + to_int(extra_song);
    	
    	
    	int total = 0;
    	for skill_num from 6001 to 6040
    	{
    		if(((skill_num.to_skill() != $skill[none]) && (skill_num != 6025)) && (have_effect(to_effect(to_skill(skill_num))) > 0))
    		{
    			total += 1;
    		}
    	}
    	
    	if ((total > max_songs)&&(have_equipped($item[ittah bittah hookah])))
    	{
    		cli_execute("unequip ittah bittah hookah");
    		equip($item[ittah bittah hookah]);
    		total -= 1;
    	}
    Last edited by oly0015; 06-20-2010 at 06:54 PM.

  7. #17
    Developer
    Join Date
    Apr 2006
    Posts
    922

    Default

    Someone attach a script with your updated changes and I'll bump the version number with it.
    Better Basement Automation - Version 1.??? Someone else is maintaining this
    Get an effect from a buffbot
    - Version 1.4

  8. #18
    Senior Member
    Join Date
    Jul 2009
    Location
    Minne-snow-da
    Posts
    262

    Default

    How can I incorporate this in a mood. For example, if I am running a "meat" mood which checks for the Polka of Plenty buff, I would want the solution, when my mood triggers due to the effect running out, to check to see if I can cast the buff myself, or run this script requesting the buff.

    Pseudo code
    mood triggers for a specific buff
    can I cast buff?
    ---yes - cast buff, end check or next mood trigger
    ---no - set zlib value for buff, request buff
    was buff requested?
    ---yes-end check or next mood trigger
    ---no-abort/print message and stop current activity (maybe continue without the buff to the next mood trigger?)

    The reason for the zlib value change is that not all buffs cost the same. It would change the value before the specific buff was requested. Is there a local global data list that can be edited for the value limit? The script would use the list value for the buff as the zlib limit.

  9. #19
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,510

    Default

    There are several ways to do this: you could write a betweenBattleScript that handles your moods instead of the built-in Mafia functionality. It wouldn't be as flexible though.

    You could also execute some ASH via a command in your Mood. For example:

    Trigger On: When an effect is lost
    Check For: Polka of Plenty
    Command: import "acquireBuff.ash"; effect ef=$effect[Polka of Plenty];skill sk=to_skill(ef); if(have_skill(sk)){use_skill(1,sk);exit;} if(!acquireBuff(ef))abort("Could not get turns of "+ef);

    Unfortunately, this will wait until you get an effect before asking for the next one. Doing what you are thinking of would require an important rewrite of Rinn's acquireBuff.

    I have this aliased:
    Code:
    rbuff => ashq import 'acquirebuff.ash'; acquireBuff($effect[%%]);
    You could put the command I wrote above in an alias, like this:
    Code:
    rbuff => ashq import "acquireBuff.ash"; effect ef = $effect[%%];skill sk = to_skill(ef);if(have_skill(sk)){use_skill(1,sk);exit;}if(!acquireBuff(ef))abort("Could not get turns of "+ef);
    and simply use this to add something in your mood:

    Trigger On: When an effect is lost
    Check For: Polka of Plenty
    Command: rbuff Polka of Plenty

    I didn't understand the bit about the zlib value though. The ones set in Rinn's script don't need to be modified in function of the buff? If you want to set a new max price, do not edit acquireBuff.ash, just type zlib acquireBuff_max_price = 5000 in the gCLI.
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  10. #20
    Senior Member
    Join Date
    Jul 2009
    Location
    Minne-snow-da
    Posts
    262

    Default

    Thanks, slyz. That is what I was hoping could be done.

    I didn't understand the bit about the zlib value though. The ones set in Rinn's script don't need to be modified in function of the buff? If you want to set a new max price, do not edit acquireBuff.ash, just type zlib acquireBuff_max_price = 5000 in the gCLI.
    Originally Posted by slyz View Post
    The thought was if I am only willing to spend x on Polka of Plenty, y on The Ode to Booze, but z on Bubbly Ballad, I would then preset the zlib limit for that buff before trying to aquire it. Like if I was cash strapped and did not want to spend more than a certain limit for a specific buff. I wanted to limit how much could be spent on an inexpensive buff in case the less expensive bots were offline without prohibiting an expensive buff from being acquired.

    Trigger On: When an effect is lost
    Check For: Polka of Plenty
    Command: rbuff Polka of Plenty

    Code:
    rbuff => ashq import "acquireBuff.ash"; effect ef = $effect[%%]; 
    "zlib acquireBuff_max_price = {using file/effectvalue|value_of_effect[ef]}";
    skill sk = to_skill(ef); if(have_skill(sk)){use_skill(1,sk);exit;}
    if(!acquireBuff(ef))abort("Could not get turns of "+ef);
    This would require some sort of file/list with the effect names and some value that can be accessed in the alias. I hope that helps explain.

    I just don't know how to write the code as you can probably tell by my bolded insert above.

Similar Threads

  1. Feature - Rejected New Buffbot
    By EvilSpud in forum Bug Reports
    Replies: 1
    Last Post: 08-04-2012, 03:10 PM
  2. Bug - Fixed Buffbot buff casting weirdness
    By starkid in forum Bug Reports
    Replies: 23
    Last Post: 09-29-2010, 02:36 PM
  3. Buffbot - cast buff on someone besides sender
    By That FN Ninja in forum Scripting Discussion
    Replies: 3
    Last Post: 08-01-2009, 05:21 PM
  4. Add buff to buffbot not working
    By mooshotty in forum Community Support
    Replies: 8
    Last Post: 11-15-2007, 05:30 AM
  5. Add Buffbot
    By Pyro Kittens in forum Community Support
    Replies: 5
    Last Post: 01-25-2007, 12:04 AM

Posting Permissions

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