waiting for a buffbot?

razorboy

Member
I'm trying to automate my pre-adventure routine, and I'm curious about automating a buffbot.

Right now I buff myself from an alt, but I realize that would be hard to sync with automation, so I figured I'd start using a buffbot.

I'm just not sure how to get that to sync either. I could be inelegant and just hardcode a set wait time in between kmailing the meat and continuing... but is there a better way?

Is it possible to have an ash script pause until a buff comes in? (I'm guessing not, but I thought I'd ask.)
 

Sputnik1

Member
This is how I do it
I define a buffbot depending on who's on and then define the buff amount at the beginning of my script, then i use this to kmail them and then wait till I get the buff

Code:
   if (have_effect ($effect[Scarysauce]) < my_adventures()) 
      { kmail (scarysaucebuffer, "", scarysauce);}

   if (have_effect ($effect[Scarysauce]) < my_adventures())
      repeat { wait (5); refresh_status ();
      } until (have_effect ($effect[Scarysauce]) > my_adventures());
 

Bale

Minion
I'd ask that you be kinder the the server and extent your wait(5) to at least wait(15) or preferably wait(30). Lag is nobody's friend so we try to be gentler.
 

razorboy

Member
I wrote a function to do this, but I'm having trouble with it.
I pass it this:
waitforit("Ode To Booze", 0);

and this is the function:

Code:
int waitforit(string buff, int turns)
{
print("buff ="+ buff);
print("turns ="+ turns);
	if (turns == 0){
      		repeat { wait (10); refresh_status ();
      		} until (have_effect ($effect[buff]) > 0);
   		print ("done waiting for "+ buff +"any turns");
	}
	else if(turns > 0){
      		repeat { wait (10); refresh_status ();
      		} until (have_effect ($effect[buff]) < my_adventures());
   		print ("done waiting"+ buff +" more than myadv");
	}
return 0;
}

But it never seems to trigger. I'm guessing the "have_effect($effect[buff])" doesn't work right. What did I do wrong?
 

razorboy

Member
I figured it out. The effect datatype makes me f'ing crazy. I never know how to use it.

I changed the call to the function to:
Code:
waitforit($effect["ode to booze"], 0);

and the function to:
Code:
int waitforit(effect buff, int turns)
{
print("buff ="+ buff);
print("turns ="+ turns);
	if (turns == 0){
      		repeat { wait (10); refresh_status ();
      		} until (have_effect(buff) > 0);
   		print ("done waiting for "+ buff +"any turns");
	}
	else if(turns > 0){
      		repeat { wait (10); refresh_status ();
      		} until (have_effect(buff) > my_adventures());
   		print ("done waiting"+ buff +" more than myadv");
	}
return 0;
}
 

Theraze

Active member
With your former one, instead of have_effect($effect[buff]) it would probably have worked with have_effect(to_effect(buf)) instead...
 

Bale

Minion
Your problem was that $effect[buff] does not make use of a variable. It is a constant. What you wanted to use is to_effect(buff). If you'd checked for have_effect(to_effect(buff)) it would have worked perfectly.

Code:
[COLOR="#808000"]> ash print( $effect[buff] )[/COLOR]

Surreally Buff
Returned: void

$effect[buff] did a fuzzy match on "buff" and so you were checking to see if your character had the buff "Surreally Buff". Unsurprisingly you did not ever have that effect.
 

avbferry

New member
This is how I do it
I define a buffbot depending on who's on and then define the buff amount at the beginning of my script, then i use this to kmail them and then wait till I get the buff

Code:
   if (have_effect ($effect[Scarysauce]) < my_adventures()) 
      { kmail (scarysaucebuffer, "", scarysauce);}

   if (have_effect ($effect[Scarysauce]) < my_adventures())
      repeat { wait (5); refresh_status ();
      } until (have_effect ($effect[Scarysauce]) > my_adventures());

Hello,

I tried modifying your code but was unsuccessful. Basically, I wish to send meat to Kolabuff until I have sufficient Ode to the Booze and then drink booze. Could someone tell me whats wrong? Thanks!

if (have_effect ($effect[ode]) < 29;
{ kmail (kolabuff, "1", ode);
kmail (kolabuff, "1", ode);
kmail (kolabuff, "2", ode);
kmail (kolabuff, "2", ode);}

if (have_effect ($effect[ode]) < 29)
repeat { wait (30); refresh_status ();
} until (have_effect ($effect[ode]) > 29);

equip 1 tuxedo shirt
drink 1 rockin wagon
 
Last edited:

slyz

Developer
The Zlib kmail() function you are trying to use accepts:
PHP:
boolean kmail(string to, string message, int meat)
So, unless kolabuff is a variable with the name of the buffbot you are sending meat to, you should change
PHP:
kmail (kolabuff, "1", ode);
to:
PHP:
kmail ("kolabuff", "ode", 1);
 

Bale

Minion
Many things are wrong with that code.

  1. The biggest problem is that kmail is not an ash function. I suspect that an old version of ZLIB (click that link!) is being used or else it is a custom function. I'll assume that it is zlib, so that will only work if you download zlib and the first line in your script is:
    import "zlib.ash";

  2. if (have_effect ($effect[ode]) < 29;
    You do not use a semi-colon after a conditional statement. Also, you forgot a closing parenthesis:
    if (have_effect ($effect[ode]) < 29)

  3. { kmail (kolabuff, "1", ode);
    kmail (kolabuff, "1", ode);

    That is not how zlib's kmail() function works. Perhaps it is an old version, so you'd need to change it to this:
    kmail ("kolabuff", "ode", 1);
    That will send 1 meat to kolabuff with a message "ode". Also, you had the line doubled for some reason. You only need to send a message ONCE!

  4. equip 1 tuxedo shirt
    drink 1 rockin wagon

    Whoa! Big problem with those two lines! That's CLI which cannot be easily mixed into an ash script! You'd need to do that like this:
    equip($item[tuxedo shirt]);
    drink(1, $item[rockin wagon]);


  5. You need to end your filename with the extension .ash since it will not work if you use .txt. Yeah, I'm guessing at that one, but I bet I'm right. :D

Edit: Minor ninja by slyz. He missed stuff.
 
Last edited:
Top