Buffbot set to use jumbo dr. lucifer's to restore MP

risenjihad

New member
Basically thread title. I set up a buffbot, and for MP restoratives I want it to eat a jumbo dr. lucifer and then use a scroll of drastic healing for MP restoratives.
 

slyz

Developer
This is untested, but here goes:

Code:
boolean use_scroll() {
   if (item_amount($item[scroll of drastic healing]) < 1 ) {
      buy( 1, $item[scroll of drastic healing] );
   }
   if( use(1, $item[scroll of drastic healing]) ) {return true;}
   else return false;
}

boolean use_Lucifer() {
   if (item_amount($item[Jumbo Dr. Lucifer]) < 1 ) {
      buy( 1, $item[Jumbo Dr. Lucifer] );
   }
   if( eat(1, $item[Jumbo Dr. Lucifer]) ) {return true;}
   else return false;
}

boolean main(string type, int amount) {
   if ( type == "HP" ) {
      if(!use_scroll()){
         abort("Problem occurred while trying to use a Scroll of drastic healing");
      }
   }
	
   if ( type == "MP" ) {
      if (my_fullness() == fullness_limit()) {
         abort("You cannot use any more Jumbo Dr. Lucifer");
         // print("You cannot use any more Jumbo Dr. Lucifer","red");
         // print("Switching to the Universal Recovery Script","blue");
         // set_property("recoveryScript","Universal_recovery");
         // restore_mp(amount);
      }
		
      if (my_hp() < my_maxhp() ) {
         if(!use_scroll()){
            abort("Problem occurred while trying to use a Scroll of drastic healing");
         }
      }
		
      if(!use_Lucifer()){
         abort("Problem occurred while trying to eat a Jumbo Dr. Lucifer");
      }	
   }

   return true;
}

I attached this code to the post. All you need to do to use it is type this in the gCLI to make it your default recovery script:

Code:
   set recoveryScript=LuciferRecovery

As you can see, I commented a couple of lines : if you want to switch back to Bale's Universal Recovery Script once your buffbot is full, replace

Code:
abort("You cannot use any more Jumbo Dr. Lucifer");
// print("You cannot use any more Jumbo Dr. Lucifer","red");
// print("Switching to the Universal Recovery Script","blue");
// set_property("recoveryScript","Universal_recovery");
// restore_mp(amount);

by

Code:
// abort("You cannot use any more Jumbo Dr. Lucifer");
print("You cannot use any more Jumbo Dr. Lucifer","red");
print("Switching to the Universal Recovery Script","blue");
set_property("recoveryScript","Universal_recovery");
restore_mp(amount);

Of course, you would need to set LuciferRecovery.ash as your recovery script again at login (add set recoveryScript=LuciferRecovery in the "on login' line of preferences->breakfast.)

I repeat this is untested!

EDIT: I forgot to add that a scroll will be used before using a Dr Lucifer when you hp is lower than your maximum hp. If you want to change this limit, change

Code:
if (my_hp() < my_maxhp() )
to
Code:
float limit = 0.5
if (my_hp() < limit*my_maxhp() )
for example.

EDIT 2: added 'return true' to make mafia happy. This could be rewritten to return false when character is full, so that Mafia's default recovery can kick in.

EDIT 3: added forgotten ""
 

Attachments

  • LuciferRecovery.ash
    1.2 KB · Views: 38
Last edited:

Bale

Minion
A recovery script needs to return true or false.

If you return false, then mafia's default recovery will kick in and complete restoration in case you haven't made your recovery target. This is useful in case you want to write a little script to restore with birdform items, but still want to use mafia's default recovery methods after birdform items have been used.

If you return true, then mafia will never use default recovery, even if it is needed.
 

Bale

Minion
You're welcome. I'm probably one of only two people who had a clue what the return value of a restore script was used for. :D
 

risenjihad

New member
So far it sems to work, haven't tested it much though.

Also in case anyone in the future uses this, line 34 just needs to add quotation marks around blue.
 
Last edited:

slyz

Developer
To test something related to this, try changing the declaration of use_lucifer() to:

Code:
boolean use_Lucifer() {
   if (item_amount($item[Jumbo Dr. Lucifer]) < 1 ) {
      buy( 1, $item[Jumbo Dr. Lucifer] );
   }
   int full = my_fullness();
   eat(1, $item[Jumbo Dr. Lucifer]);
   if( my_fullness() != full ) {return true;}
   else { print("Fulness not accounted for!"); return false; }
}
 
Top