I'm trying to make a script check which clanbot is online and ask them for a buff if I can't cast it. If I put only one BotName and BotID it works fine but I get "Unknown variable 'BotID' (test.ash, line 24)" if I try to make it switch if the bots aren't online. How do I set the variable to switch from one bot to the other?
Code:
import <zlib.ash>;
//Set to true if you want the script to use the bot even if you have the skill yourself.
boolean AbuseBot = true;
//Set the number of turns you want to ask the bots.
int BotTurns = 400;
if (is_online(000000)){
string BotName = "Clanbot1";
int BotID = 000000;
}
else if (is_online(1111111)){
string BotName = "Clanbot2";
int BotID = 1111111;
}
if ( have_effect($effect[Fat Leon's Phat Loot Lyric]) < 1 ){
if ( AbuseBot == False){
if (have_skill($skill[Fat Leon's Phat Loot Lyric])){
use_skill($skill[Fat Leon's Phat Loot Lyric]);
}
}
else if (is_online(BotID)){
print("Asking "+BotName+" to cast Fat Leon's Phat Loot Lyric on you","green");
string url = visit_url("sendmessage.php?pwd=&action=send&towho="+BotID+"&message="+ BotTurns +" phat&savecopy=on");
print("Done... we're are waiting on "+BotName+" to buff you", "green");
if(have_effect($effect[Fat Leon's Phat Loot Lyric]) < 1)
repeat {wait(5); refresh_status();}
until (have_effect($effect[Fat Leon's Phat Loot Lyric]) > 1);
}
else if ( AbuseBot == True && have_skill($skill[Fat Leon's Phat Loot Lyric])){
use_skill($skill[Fat Leon's Phat Loot Lyric]);
}
else {
abort ("You don't know how to cast Fat Leon's Phat Loot Lyric and both bots seem offline");
}
}
if ( have_effect($effect[Polka of Plenty]) < 1 ){
if ( AbuseBot == False){
if (have_skill($skill[The Polka of Plenty])){
use_skill($skill[The Polka of Plenty]);
}
}
else if (is_online(BotID)){
print("Asking "+BotName+" to cast Polka of Plenty on you","green");
string url = visit_url("sendmessage.php?pwd=&action=send&towho="+BotID+"&message="+ BotTurns +" polka&savecopy=on");
print("Done... we're are waiting on "+BotName+" to buff you", "green");
if(have_effect($effect[Polka of Plenty]) < 1)
repeat {wait(5); refresh_status();}
until (have_effect($effect[Polka of Plenty]) > 1);
}
else if ( AbuseBot == True && have_skill($skill[The Polka of Plenty])){
use_skill($skill[The Polka of Plenty]);
}
else {
abort ("You don't know how to cast Polka of Plenty and both bots seem offline");
}