**BANNED The Man
01-01-2011, 01:30 AM
Hmm, ok so my AK cooker is having problems...
I think it is to do with my loop/location setting.
But my eyes are tired at 1:30 AM so I can't see the problem.
Here is the script, I know there are things I need to finish... :P
program AlKharidCooker;
{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i Reflection\Reflection.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with players[0] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Integers[5] := 327; // Fish ID
Loc := 'at bank';
// 345 = Herring, 327 = Sardine, 359 = Tuna
end;
end;
Procedure LevelTalking;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
exit;
If (FindBlackChatMessage('Congratulations')) Or
(FindBlackChatMessage('you just advance')) Or
InChat('Congratulations') Or InChat('just advance') Or
InChat('congratulations,') Then
Begin
Inc(Players[CurrentPlayer].Integers[2]);
Writeln('Woooot we have now gained'+IntToStr(Players[CurrentPlayer].Integers[2])+' levels!');
Begin
Case Random(50) Of
0: TypeSend('Guess what... I levelled!');
1: TypeSend('w00t lvld');
2: TypeSend('lvld again...');
3: TypeSend('grats me! I lvld!');
4: TypeSend('gay lag, didnt realise i lvld');
5: TypeSend('woopdewoop');
6: TypeSend('this levelling stuff is getting boring...');
7: TypeSend('dangdarnit, I jooost lavallled');
8: TypeSend('can we have a party cause i just lvld');
9: TypeSend('house party at mine! jokes...');
End;
End;
End;
End;
Procedure ProgressReport;
Begin
LevelTalking;
cleardebug;
Writeln('[-----------------------------]');
Writeln('[ AKCooker ]');
Writeln('[-----------------------------]');
Writeln(' We worked for ' + TimeRunning);
Writeln(' Cooked ' + IntToStr(Players[CurrentPlayer].Integers[0])+' Fish');
Writeln(' Loads Done:' + IntToStr(Players[CurrentPlayer].Integers[1]));
Writeln(' Leveled ' + IntToStr(Players[CurrentPlayer].Integers[2]));
Writeln(' Antibanned ' + IntToStr(Players[CurrentPlayer].Integers[3]));
Writeln('[-----------------------------]');
End;
function R_IDExistAT(ID, slot: Integer): Boolean;
begin
Result := (GetItemIDAt(slot) = (ID));
end;
procedure AntiBan;
begin
case (Random(400)) of
0: RandomRClick;
1: MouseSpeed := 15 + Random(5);
2: PickUpMouse;
3: BoredHuman;
4..400: begin
Wait(100 + Random(50));
Exit;
end;
end;
Inc(Players[CurrentPlayer].Integers[3]);
end;
Procedure AntiRandoms;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
NextPlayer(false);
LevelTalking;
FindNormalRandoms;
Wait(300+Random(200));
FindLamp('Cooking');
End;
function R_WithdrawItemID(ID, Amount: Integer): Boolean;
var
I, WhichBankTab, ItemSlot: Integer;
BankTabItemIDs: TIntegerArray;
RelPoint: TPoint;
TabBox, ItemBox: TBox;
begin
for ItemSlot := 0 to 515 do
if ID = GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) then
Break;
if GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) = -1 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
if ItemSlot = 515 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
if (RelPoint.x = 0) then
begin
SetLength(BankTabItemIDs, 9);
for I := 1 to 9 do
BankTabItemIDs[I - 1] := GetInterfaceComponentID(INTERFACE_BANK, 47 + ((9 - I) * 2));
for I := ItemSlot downto 0 do
if InIntArrayEx(BankTabItemIds, WhichBankTab, GetChildComponentID(INTERFACE_BANK, 93, I)) then
Break;
TabBox.x1 := GetInterfaceComponentRelativeX(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.y1 := GetInterfaceComponentRelativeY(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.x2 := TabBox.x1 + GetInterfaceComponentWidth(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
TabBox.y2 := TabBox.y1 + GetInterfaceComponentHeight(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
MouseBox(TabBox.x1, TabBox.y1, TabBox.x2, TabBox.y2, 1);
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
end;
ItemBox.x1 := RelPoint.x + GetInterfaceComponentRelativeX(INTERFACE_BANK, 93) + 4;
ItemBox.y1 := RelPoint.y + GetInterfaceComponentRelativeY(INTERFACE_BANK, 93) + 4;
ItemBox.x2 := ItemBox.x1 + GetChildComponentWidth(INTERFACE_BANK, 93, ItemSlot)
ItemBox.y2 := ItemBox.y1 + GetChildComponentHeight(INTERFACE_BANK, 93, ItemSlot)
if Amount = 1 then
begin
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 1);
Result := True;
Exit;
end;
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 2);
if Amount = 0 then
Result := R_ChooseOption('Withdraw-All') else
if OptionExists('Withdraw-' + IntToStr(Amount)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount)) else
begin
if R_ChooseOption('Withdraw-X') then
begin
Wait(RandomRange(1200, 1500));
//I personally don't like this, but its how both RSBot and Tribot does it
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;
Function Bank: Boolean;
Var
i : integer;
Begin
If Not LoggedIn Then
Exit;
Wait(1000+ Random(1000));
If Not OpenBankFast(Bank_AK) Then
If Not OpenBankQuiet(Bank_AK) Then
Exit;
Deposit(i, 28, True);
R_WithdrawItemID(Players[CurrentPlayer].Integers[5], 28);
Wait(750);
if R_InvEmpty then
Exit;
Players[CurrentPlayer].Loc := 'banked';
Result := True;
CloseBank;
Inc(Players[CurrentPlayer].Integers[1]);
IncEx(Players[CurrentPlayer].Integers[0], 28);
ProgressReport;
End;
Function Cook: Boolean;
var
x, y :integer;
Begin
if ValidInterface(137) then
MMouse(258, 423, 10, 10);
GetMousePos(x, y);
if IsUpText('ook') then
Mouse(x, y, 0, 0, true);
Result := True;
End;
function WaitWhileCooking: Boolean;
begin
if not(LoggedIn) then
Exit;
if not R_IDExistAt((Players[CurrentPlayer].Integers[0]), 28) then
begin
Result := False;
end else
Result := True;
end;
procedure CountCooked;
begin
if not(LoggedIn) then
Exit;
IncEx((Players[CurrentPlayer].Integers[0]), (R_CountItemID(Players[CurrentPlayer].Integers[5])));
end;
function WalkToRange: Boolean;
var
Path: TTileArray;
begin
if not(LoggedIn) then
Exit;
R_FindRandoms;
//case Random(3) of
Path := [Tile(3275, 3173), Tile(3272, 3181)];
WalkPath(Path);
Players[CurrentPlayer].Loc := 'at range';
Result := True;
end;
function ClickRaw: Boolean;
begin
if not(LoggedIn) then
Exit;
if R_IDExistAt((Players[CurrentPlayer].Integers[0]), 1) then
if R_ClickItem(1, True, '') then
Result := True;
end;
function ClickRange: Boolean;
var
RangerX, RangerY, RangerID, X, Y : integer;
Ranger: TRSObject;
begin
RangerX := 3271;
RangerY := 3181;
RangerID := 25730;
Ranger := GetInteractableAt(Point(RangerX, RangerY));
if (Ranger.ID = RangerID) then
begin
TileToMS(Point(RangerX, RangerY), 5);
MMouse(X, Y, 1, 1);
Mouse(X, Y, 0, 0, True);
{Possibly TPA with REF backup?}
Result := True;
end;
end;
function CookLoop:boolean;
begin
if not(LoggedIn) then
Exit;
if ClickRaw then
if ClickRange then
if Cook then
if WaitWhileCooking then
CountCooked;
Players[CurrentPlayer].Loc := 'cooked';
Result := True;
end;
function WalkToBank: Boolean;
var
Path: TTileArray;
begin
if not(LoggedIn) then
Exit;
R_FindRandoms;
{case Random(3) of
0: Path :=
1: Path :=}
Path := [Tile(3275, 3173), Tile(3269, 3169)];
WalkPath(Path);
Players[CurrentPlayer].Loc := 'at bank';
Result := True;
end;
Procedure MainLoop;
Begin
repeat
Case Lowercase(Players[CurrentPlayer].Loc) of
'banked':
if WalkToRange then
Players[CurrentPlayer].Loc := 'at range';
'at range':
if CookLoop then
Players[CurrentPlayer].Loc := 'cooked';
'cooked':
if WalkToBank then
Players[CurrentPlayer].Loc := 'at bank';
'at bank':
if Bank then
Players[CurrentPlayer].Loc := 'banked';
end;
until(Players[CurrentPlayer].Integers[1] >= Players[CurrentPlayer].Integers[4]);
End;
begin
ClearDebug;
ClearReport;
Smart_Server := 17;
Smart_Members := false;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
begin
declareplayers;
LoginPlayer;
ProgressReport;
MakeCompass('North');
SetAngle(True);
Gametab(tab_Inv);
repeat
MainLoop
until(false);
end;
end.
EDIT: Also sorry about the spacing... Gedit :/
Thankyoooo
-Boom
I think it is to do with my loop/location setting.
But my eyes are tired at 1:30 AM so I can't see the problem.
Here is the script, I know there are things I need to finish... :P
program AlKharidCooker;
{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i Reflection\Reflection.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with players[0] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Integers[5] := 327; // Fish ID
Loc := 'at bank';
// 345 = Herring, 327 = Sardine, 359 = Tuna
end;
end;
Procedure LevelTalking;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
exit;
If (FindBlackChatMessage('Congratulations')) Or
(FindBlackChatMessage('you just advance')) Or
InChat('Congratulations') Or InChat('just advance') Or
InChat('congratulations,') Then
Begin
Inc(Players[CurrentPlayer].Integers[2]);
Writeln('Woooot we have now gained'+IntToStr(Players[CurrentPlayer].Integers[2])+' levels!');
Begin
Case Random(50) Of
0: TypeSend('Guess what... I levelled!');
1: TypeSend('w00t lvld');
2: TypeSend('lvld again...');
3: TypeSend('grats me! I lvld!');
4: TypeSend('gay lag, didnt realise i lvld');
5: TypeSend('woopdewoop');
6: TypeSend('this levelling stuff is getting boring...');
7: TypeSend('dangdarnit, I jooost lavallled');
8: TypeSend('can we have a party cause i just lvld');
9: TypeSend('house party at mine! jokes...');
End;
End;
End;
End;
Procedure ProgressReport;
Begin
LevelTalking;
cleardebug;
Writeln('[-----------------------------]');
Writeln('[ AKCooker ]');
Writeln('[-----------------------------]');
Writeln(' We worked for ' + TimeRunning);
Writeln(' Cooked ' + IntToStr(Players[CurrentPlayer].Integers[0])+' Fish');
Writeln(' Loads Done:' + IntToStr(Players[CurrentPlayer].Integers[1]));
Writeln(' Leveled ' + IntToStr(Players[CurrentPlayer].Integers[2]));
Writeln(' Antibanned ' + IntToStr(Players[CurrentPlayer].Integers[3]));
Writeln('[-----------------------------]');
End;
function R_IDExistAT(ID, slot: Integer): Boolean;
begin
Result := (GetItemIDAt(slot) = (ID));
end;
procedure AntiBan;
begin
case (Random(400)) of
0: RandomRClick;
1: MouseSpeed := 15 + Random(5);
2: PickUpMouse;
3: BoredHuman;
4..400: begin
Wait(100 + Random(50));
Exit;
end;
end;
Inc(Players[CurrentPlayer].Integers[3]);
end;
Procedure AntiRandoms;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
NextPlayer(false);
LevelTalking;
FindNormalRandoms;
Wait(300+Random(200));
FindLamp('Cooking');
End;
function R_WithdrawItemID(ID, Amount: Integer): Boolean;
var
I, WhichBankTab, ItemSlot: Integer;
BankTabItemIDs: TIntegerArray;
RelPoint: TPoint;
TabBox, ItemBox: TBox;
begin
for ItemSlot := 0 to 515 do
if ID = GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) then
Break;
if GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) = -1 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
if ItemSlot = 515 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
if (RelPoint.x = 0) then
begin
SetLength(BankTabItemIDs, 9);
for I := 1 to 9 do
BankTabItemIDs[I - 1] := GetInterfaceComponentID(INTERFACE_BANK, 47 + ((9 - I) * 2));
for I := ItemSlot downto 0 do
if InIntArrayEx(BankTabItemIds, WhichBankTab, GetChildComponentID(INTERFACE_BANK, 93, I)) then
Break;
TabBox.x1 := GetInterfaceComponentRelativeX(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.y1 := GetInterfaceComponentRelativeY(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.x2 := TabBox.x1 + GetInterfaceComponentWidth(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
TabBox.y2 := TabBox.y1 + GetInterfaceComponentHeight(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
MouseBox(TabBox.x1, TabBox.y1, TabBox.x2, TabBox.y2, 1);
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
end;
ItemBox.x1 := RelPoint.x + GetInterfaceComponentRelativeX(INTERFACE_BANK, 93) + 4;
ItemBox.y1 := RelPoint.y + GetInterfaceComponentRelativeY(INTERFACE_BANK, 93) + 4;
ItemBox.x2 := ItemBox.x1 + GetChildComponentWidth(INTERFACE_BANK, 93, ItemSlot)
ItemBox.y2 := ItemBox.y1 + GetChildComponentHeight(INTERFACE_BANK, 93, ItemSlot)
if Amount = 1 then
begin
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 1);
Result := True;
Exit;
end;
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 2);
if Amount = 0 then
Result := R_ChooseOption('Withdraw-All') else
if OptionExists('Withdraw-' + IntToStr(Amount)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount)) else
begin
if R_ChooseOption('Withdraw-X') then
begin
Wait(RandomRange(1200, 1500));
//I personally don't like this, but its how both RSBot and Tribot does it
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;
Function Bank: Boolean;
Var
i : integer;
Begin
If Not LoggedIn Then
Exit;
Wait(1000+ Random(1000));
If Not OpenBankFast(Bank_AK) Then
If Not OpenBankQuiet(Bank_AK) Then
Exit;
Deposit(i, 28, True);
R_WithdrawItemID(Players[CurrentPlayer].Integers[5], 28);
Wait(750);
if R_InvEmpty then
Exit;
Players[CurrentPlayer].Loc := 'banked';
Result := True;
CloseBank;
Inc(Players[CurrentPlayer].Integers[1]);
IncEx(Players[CurrentPlayer].Integers[0], 28);
ProgressReport;
End;
Function Cook: Boolean;
var
x, y :integer;
Begin
if ValidInterface(137) then
MMouse(258, 423, 10, 10);
GetMousePos(x, y);
if IsUpText('ook') then
Mouse(x, y, 0, 0, true);
Result := True;
End;
function WaitWhileCooking: Boolean;
begin
if not(LoggedIn) then
Exit;
if not R_IDExistAt((Players[CurrentPlayer].Integers[0]), 28) then
begin
Result := False;
end else
Result := True;
end;
procedure CountCooked;
begin
if not(LoggedIn) then
Exit;
IncEx((Players[CurrentPlayer].Integers[0]), (R_CountItemID(Players[CurrentPlayer].Integers[5])));
end;
function WalkToRange: Boolean;
var
Path: TTileArray;
begin
if not(LoggedIn) then
Exit;
R_FindRandoms;
//case Random(3) of
Path := [Tile(3275, 3173), Tile(3272, 3181)];
WalkPath(Path);
Players[CurrentPlayer].Loc := 'at range';
Result := True;
end;
function ClickRaw: Boolean;
begin
if not(LoggedIn) then
Exit;
if R_IDExistAt((Players[CurrentPlayer].Integers[0]), 1) then
if R_ClickItem(1, True, '') then
Result := True;
end;
function ClickRange: Boolean;
var
RangerX, RangerY, RangerID, X, Y : integer;
Ranger: TRSObject;
begin
RangerX := 3271;
RangerY := 3181;
RangerID := 25730;
Ranger := GetInteractableAt(Point(RangerX, RangerY));
if (Ranger.ID = RangerID) then
begin
TileToMS(Point(RangerX, RangerY), 5);
MMouse(X, Y, 1, 1);
Mouse(X, Y, 0, 0, True);
{Possibly TPA with REF backup?}
Result := True;
end;
end;
function CookLoop:boolean;
begin
if not(LoggedIn) then
Exit;
if ClickRaw then
if ClickRange then
if Cook then
if WaitWhileCooking then
CountCooked;
Players[CurrentPlayer].Loc := 'cooked';
Result := True;
end;
function WalkToBank: Boolean;
var
Path: TTileArray;
begin
if not(LoggedIn) then
Exit;
R_FindRandoms;
{case Random(3) of
0: Path :=
1: Path :=}
Path := [Tile(3275, 3173), Tile(3269, 3169)];
WalkPath(Path);
Players[CurrentPlayer].Loc := 'at bank';
Result := True;
end;
Procedure MainLoop;
Begin
repeat
Case Lowercase(Players[CurrentPlayer].Loc) of
'banked':
if WalkToRange then
Players[CurrentPlayer].Loc := 'at range';
'at range':
if CookLoop then
Players[CurrentPlayer].Loc := 'cooked';
'cooked':
if WalkToBank then
Players[CurrentPlayer].Loc := 'at bank';
'at bank':
if Bank then
Players[CurrentPlayer].Loc := 'banked';
end;
until(Players[CurrentPlayer].Integers[1] >= Players[CurrentPlayer].Integers[4]);
End;
begin
ClearDebug;
ClearReport;
Smart_Server := 17;
Smart_Members := false;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
begin
declareplayers;
LoginPlayer;
ProgressReport;
MakeCompass('North');
SetAngle(True);
Gametab(tab_Inv);
repeat
MainLoop
until(false);
end;
end.
EDIT: Also sorry about the spacing... Gedit :/
Thankyoooo
-Boom