boolean zappp(item whatsit) {
if (item_amount(whatsit) == 0) return false;
cli_execute("zap 1 "+whatsit);
return true;
}
void daily_zap() {
print("Looking to zap...");
int whichwand = 0;
for i from 1268 to 1272
if(item_amount(to_item(i)) > 0) whichwand = i;
switch {
case whichwand == 0:
print("You don't have a wand.", "olive");
break;
case contains_text(visit_url("wand.php?whichwand="+whichwand),"feels warm"):
print("Already zapped today. Afraid of Kabloo-ey!", "red");
break;
case zappp($item[green-frosted astral cupcake]):
case zappp($item[orange-frosted astral cupcake]):
case zappp($item[purple-frosted astral cupcake]):
case zappp($item[33398 scroll]):
case zappp($item[ring of aggravate]):
break;
default:
print("You have nothing more to zap.", "olive");
}
}
//Find Wand
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
int FindWand()
{
int wand=0;
for i from 1268 to 1272
{
if (haveItem(to_item(i)))
wand = i;
}
return wand;
}
//checks if the wand was used today
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
boolean WandUseable(int wand)
{
if (wand==0)
return false;
if (contains_text(visit_url("wand.php?whichwand="+wand),"feels warm"))
return false;
else
return true;
}
// -1 No wand found in inventory
// 0 wand hasn't been used at all
// 1 feels warm to the touch (level 1)
// 2 You should probably be careful. (level 2)
// 3 You should definitely be careful. (level 3)
// 4 You should seriously be careful. (level4)
// 5 should never be seen in visit_url, because I think at this point the wand is gone
int wandstatus() {
int whichwand=0;
int retstatus;
for i from 1268 to 1272 {
if (item_amount(to_item(i)) > 0) whichwand = i;
}
if (whichwand == 0) {
retstatus = -1;
} else {
// we have a wand so can't be -1 preset to 0 then if its still 0
// after below checks then it really should be zero.
// does ash have elseif ?
retstatus = 0;
string wanddescription = visit_url("wand.php?whichwand="+whichwand);
if (contains_text(wanddescription, "feels warm")) {
retstatus = 1;
}
if (contains_text(wanddescription, "probably be careful")) {
retstatus = 2;
}
if (contains_text(wanddescription, "definitely be careful")) {
retstatus = 3;
}
if (contains_text(wanddescription, "seriously be careful")) {
retstatus = 4;
}
}
return retstatus;
}
// shot = 1 for first shot of Ode, or shot = 2 for second shot as a nightcap.
boolean get_ode(int shot) {
if(have_effect($effect[Ode To Booze]) < 1) {
if(have_skill($skill[The Ode To Booze])) {
if(my_mp()< mp_cost($skill[The Ode To Booze])) {
restore_mp(mp_cost($skill[The Ode To Booze]));
if(my_mp()< mp_cost($skill[The Ode To Booze]))
abort("Can't cast Ode to Booze due to lack of MP!");
}
use_skill(1, $skill[The Ode To Booze]);
if(have_effect($effect[Ode To Booze]) >= 1)
return true;
else
return false;
} else {
// lets try to get it from a buffbot
print("purchasing Ode to Booze from a few buffbots...", "blue");
if(shot == 1) {
cli_execute("csend 1 meat to Testudinata");
cli_execute("csend 23 meat to Iocainebot");
} else {
cli_execute("csend 11 meat to Testudinata");
cli_execute("csend 80 meat to Iocainebot");
}
int iterations = 0;
while( have_effect($effect[Ode to Booze]) < 1) {
if (iterations > (30)) {
print("failed to get Ode to Booze", "red");
return false;
}
cli_execute("wait 30");
cli_execute("effects refresh");
iterations = iterations + 1;
}
}
}
return true;
}
if(have_effect($effect["ode to booze"]) > 0){
print("Yes, your favorite song 'Ode to Booze' has been played for you.", "green");
} else {
print("Need to get 'Ode to Booze' (testudinata @ 1 meat)", "red");
cli_execute("csend 1 meat to testudinata");
wait(10);
cli_execute("status refresh");
}
int i = 0;
while( (have_effect($effect["ode to booze"]) <= 0) && i < 4 )
{
i = i + 1;
wait(30);
cli_execute("status refresh");
print("...waiting 30 seconds for buff...");
}
if(have_effect($effect["ode to booze"]) > 0){
print("Yes, your favorite song 'Ode to Booze' has been played for you.", "green");
} else {
abort("Well, something didn't work there with your buffbot. Get 'Ode to Booze'!");
}
Glad you liked it. When I looked at the HUGE if() command in your script I thought... that could be a lot prettier to look at.Ooh Bale, I am stealing that switch() mod to my zapping script. Nice.
And of course I'm a huge fan of switch to the point that sometimes I over-use it.![]()
Speaking of which, have you thought about improving your scripts with the salad() function? I've noticed that virtually every function in my recovery script should be replaced with salad(). I tried that, but strangely I cannot get it to work quite right yet. Once I've managed it, v3.0 will be 100% salad().Also, the word "switch" starts to look really funny if you keep looking at it.