GreatKhan
2008-11-24 18:02:27
Was gonna make it do GE operations too (buy/sell the things), but Idk how to do that stuff yet.. also think the anti randoms could use some tweaking (not sure what though).. lmk whatcha think, would work well after running the fill vial with water script
program CleanGrubs;
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Misc\Users.Scar}
Const
CleanHerb=False;
MakeUnfPotions=True;
MakeFinishedPotions=False;
// Avantoe, Cadantine, Dwarf Weed, Guam Leaf, Harralander, Irit Leaf, Kwuarm,
// Lantadyme, Marrentill, Ranarr Weed, Rogues Purse, Tarromin, Toadflax, or Torstol
HerbToClean='Kwuarm';
Bank='vwb';
// 0=Dont Sell on GE, 1=Lowest, 2=Current, 3=Max
SellFinishedProduct=0;
Var
HerbsCleaned:Integer;
UnfPotionsMade:Integer;
PotionsMade:Integer;
Exp:Integer;
PotionItem:String;
Potion:String;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Number of players
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure MakeAll;
begin
Mouse(258, 396, 5, 5, False);
Wait(random(100)+100);
if not ChooseOption('Make All') then
if ChooseOption('Make X') then
begin
Wait(100+Random(500));
TypeSend('28')
end
end;
procedure WithdrawX(col, row, Amount: Integer);
Var
BBox: TBox;
begin
//FixBank;
//FixBankTab;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col - 1, Row - 1)));
If Amount = 1 Then
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
Wait(RandomRange(50, 150));
End
Else
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (Amount = 5) or (Amount = 10) or (Amount=14) then
ChooseOption('Withdraw-' +IntToStr(Amount))
else if Amount = 0 then
ChooseOption('Withdraw-All')
else
if (ChooseOption('Withdraw-X')) then
begin
Wait(1000 + Random(100));
TypeSend(IntToStr(Amount));
end;
End;
end;
function FindInInv(Item:String; x:Integer):Integer;
begin
repeat
MMouseItem(x);
if (Pos(lowercase(Item),lowercase(GetUpText))>0) then
begin
Result:=x;
x:=30;
end;
x:=x+1;
until x>28;
if x<30 then
Result:=-1;
end;
function FinishedPotionItem:String;
var
Level:Integer;
begin
Level:=GetSkillInfo('Herblore',False)
Result:=' ';
case HerbToClean of
'Avantoe': begin
if Level>52 then begin // 120 xp
Result:='Kebbit Teeth Dust'
Potion:='Hunter Potion' end
else if Level>51 then begin // 118 xp
Result:='Mort Myre Fungi'
Potion:='Super Energy' end
else if Level>49 then begin // 112.5 xp
Result:='Snape Grass'
Potion:='Fishing' end
end;
'Cadantine': begin
if Level>65 then begin // 150 xp
Result:='White Berries'
Potion:='Super Defense' end
end;
'Dwarf Weed': begin
if Level>71 then begin // 165 xp
Result:='Wine of Zamorak'
Potion:='Ranging' end
end;
'Guam Leaf': begin // 25 xp
if Level>2 then begin
Result:='Eye of Newt'
Potion:='Attack' end
end;
'Harralander': begin
if Level>35 then begin // 84 xp
Result:='Ground Goat'
Potion:='Combat Potion' end
else if Level>25 then begin // 67.5 xp
Result:='Chocolate Dust'
Potion:='Energy' end
else if Level>24 then begin // 80 xp
Result:='Blamish Snail Slime'
Potion:='Blamish Oil' end
else if Level>21 then begin // 62.5 xp
Result:='Red Spider'
Potion:='Stat Restore' end
end;
'Irit Leaf': begin
if Level>47 then begin // 107.5 xp
Result:='Ground Unicorn Horn'
Potion:='Super Anti-Poison' end
else if Level>44 then begin // 100 xp
Result:='Eye of Newt'
Potion:='Super Attack' end
end;
'Kwuarm': begin
if Level>59 then begin // 137.5 xp
Result:='Ground Blue Dragon Scale'
Potion:='Weapon Poison' end
else if Level>54 then begin // 125 xp
Result:='Limpwurt Root'
Potion:='Super Strength' end
end;
'Lantadyme': begin
if Level>75 then begin // 172.5 xp
Result:='Potato Cactus'
Potion:='Magic' end
else if Level>68 then begin // 158 xp
Result:='Ground Blue Dragon Scale'
Potion:='Anti-FireBreath' end
end;
'Marrentill': begin
if Level>4 then begin // 37.5 xp
Result:='Ground Unicorn Horn'
Potion:='Anti-Poison' end
end;
'Ranarr Weed': begin
if Level>37 then begin // 87.5 xp
Result:='Snape Grass'
Potion:='Restore Prayer' end
else if Level>29 then begin // 75 xp
Result:='White Berries'
Potion:='Defense' end
end;
'Rogues Purse': begin
if Level>7 then begin // 42 xp
Result:='Snake Weed'
Potion:='Relicyms Balm' end
end;
'Tarromin': begin
if Level>14 then begin // 50 xp
Result:='Ashes'
Potion:='Serum 207' end
else if Level>11 then begin // 50 xp
Result:='Limpwurt Root'
Potion:='Strength' end
end;
'Toadflax': begin
if Level>80 then begin // 180 xp
Result:='Crushed Birdsnest'
Potion:='Saradomins Brew' end
else if Level>33 then begin // 80 xp
Result:='Toad Legs'
Potion:='Agility' end
end;
'Torstol': begin
if Level>77 then begin // 175 xp
Result:='Jangerberries'
Potion:='Zamorak' end
end;
end;
end;
procedure CleanHerbs;
var
x:Integer;
begin
x:=0;
while (x>=0) and (x<28) Do
begin
x:=FindInInv('Grimy '+HerbToClean, x+1);
if x>0 then
begin
MouseItem(x, True);
Inc(HerbsCleaned);
wait(400+random(200));
writeln(inttostr(x));
end;
end;
end;
procedure MakeUnfinishedPotion;
var
WaterLoc:Integer;
CleanLoc:Integer;
begin
WaterLoc:=FindInInv('Vial of water', 1);
CleanLoc:=FindInInv('Clean '+HerbToClean, 1);
if (WaterLoc=-1) or (CleanLoc=-1) then
exit;
MouseItem(WaterLoc, True);
Wait(random(500)+500);
MouseItem(CleanLoc, True);
Wait(random(500)+500);
MakeAll;
Inc(UnfPotionsMade);
Wait(10000+Random(1000));
end;
procedure MakeFinishedPotion;
var
UnfLoc:Integer;
FinishItemLoc:Integer;
begin
UnfLoc:=FindInInv(HerbToClean+' Potion', 1);
FinishItemLoc:=FindInInv(PotionItem, 1);
if (UnfLoc=0) or (FinishItemLoc=0) then
exit;
MouseItem(UnfLoc, True);
Wait(random(500)+500);
MouseItem(FinishItemLoc, True);
Wait(random(500)+500);
MakeAll;
Inc(PotionsMade);
Wait(10000+Random(1000));
end;
//returns true if withdrawn from bank
function InBank(Item:String; Amount:Integer; Deposit:Boolean; CloseAfter:Boolean):Boolean;
begin
Result:=False;
if not OpenBankFast(Bank) then
Exit;
if Deposit then
DepositAll;
wait(random(500)+4000);
SearchBank(Item)
wait(random(500)+500);
MoveMouseSmooth(BankIndexToMSPoint(1).x+10,BankIndexToMSPoint(1).y+10);
wait(random(500)+500);
if (Pos('withdraw',lowercase(GetUpText))>0) then
begin
WithdrawX(1,1,Amount);
wait(100+random(500));
Result:=True
// if CloseAfter then
CloseBank;
end;
end;
begin
ClearDebug;
WriteLn('GreatKhan');
SetupSRL;
DeclarePlayers;
ActivateClient;
LoginPlayer;
Exp:=GetXp('Herblore');
// Repeat
// if not LoggedIn then break;
if GameTab(4) then
if CleanHerb then
While InBank('Grimy '+HerbToClean, 0, True, True) do
begin
CleanHerbs;
if HerbsCleaned mod 251>224 then //9 sets, check for randoms
writeln('rando check'); //FindNormalRandoms;
end;
writeln('Cleaned '+IntToStr(HerbsCleaned)+' herbs.');
writeln(IntToStr(GetXp('Herblore')-Exp)+' Herblore experience gained.')
writeln('...')
if MakeUnfPotions then
begin
writeln('Starting to make unfinished potions...')
while (InBank('Vial of Water', 14, True, False)
and InBank('Clean '+HerbToClean, 14, False, True)) Do
begin
MakeUnfinishedPotion;
if UnfPotionsMade mod 125>97 then
FindNormalRandoms;
end;
writeln('Made '+IntToStr(UnfPotionsMade)+' Unfinished Potions.');
end;
writeln('...')
if MakeFinishedPotions then
begin
PotionItem:=FinishedPotionItem;
writeln('Starting to make finished potions...')
while (InBank(HerbToClean+' potion', 14, True, False)
and InBank(PotionItem, 14, False, True)) Do
begin
MakeFinishedPotion;
if PotionsMade mod 125>97 then
FindNormalRandoms;
end;
CloseBank;
writeln('Made '+IntToStr(PotionsMade)+' '+Potion+' Potions.');
end;
writeln('...')
writeln(IntToStr(GetXp('Herblore')-Exp)+' Herblore experience gained.')
// NextPlayer(Players[CurrentPlayer].Active);
// if PlayersActive = 0 then break;
// Until True
end.