Breakfast Script needs tweaking help.

FlashGordon

New member
Code:
void acquire(int n, item it){
	int x = 0;
	buy(n,it);
}


if (can_eat()){
	
	acquire(1, $item[milk of magnesium]);
	use(1,$item[milk of magnesium]);
}

if (can_drink()){

	acquire(5, $item[salty dog]);
	acquire(3, $item[bottle of rum]);
	acquire(3, $item[bottle of whiskey]);
	
}

Here's part of my breakfast script that I use upon login, butchered from other scripts here & there. It buys & consumes a MoM and buys from Boozerbear and DocHolliday's. Problem is, if I were to log in again, it'll buy all that again. I don't want that. Therefore, I need a bit of help to tweak this. Maybe a price added to the drinks and/or something to say, if consumption limit reached, don't buy & consume. Is this possible?

I guess the price part would make it more of a mallbot, but really, I just plan to stock up on booze.
 

Sandiman

Member
The mushroom planting scripts use a user setting that stores the moon phase. I would think something like this would be usable:

Code:
string property = "myScriptMoonPhase";
int current_phase = moon_phase();
int last_run_phase = get_property(property);

if (last_run_phase == current_phase)
{
  print( "Already ran today, exiting." );
  return;
}

// Main body of the script goes here //

set_property(property, current_phase);
 

FlashGordon

New member
Here's my whole script, along with the "Cleansed the Taint" addition.

Code:
# Version 1.0			Booze Buyer

#	This Script should basically get the booze offered in the mall
#    from Boozerbear & Doc Hollandaise.  But who knows if this damn thing works. ;)

string property = "myScriptMoonPhase";
int current_phase = moon_phase();
int last_run_phase = get_property(property);

if (last_run_phase == current_phase)
{
  print( "Already ran today, exiting." );
  return;
}

// Main body of the script goes here //
void acquire(int n, item it){
	int x = 0;
	buy(n,it);
}


if (can_eat()){
	
	acquire(1, $item[milk of magnesium]);
	use(1,$item[milk of magnesium]);
}

if (can_drink()){

	acquire(5, $item[salty dog]);
	acquire(3, $item[bottle of rum]);
	acquire(3, $item[bottle of whiskey]);
	
}
if (contains_text(visit_url("questlog.php?which=2"),"cleansed the taint"))
  visit_url("friars.php?action=buffs&bro=3&pwd=");


set_property(property, current_phase);
Anything else I have to change? I'm getting this error: "Cannot store string in last_run_phase of type int (boosebuyer.ash, line 8)"

Line 8 is this: int last_run_phase = get_property(property);

Cheers for the help!
 
Top