SRL Archive - Discussions & Debates

Problem(s) with P07Include - take a look


obsessive

2013-02-27 08:33:04

Hi guys,
I just set up P07 but have encountered an error with it.

Please look here:
http://i.imgur.com/vsizLxV.png


Would anyone be able to help me, please?
I removed all the anti-leach from the other script file.

code:
//OldSchoolRS07 Unofficial Include (P07)
//Last Update [27/2/13][D/M/Y]
//Currently Developed by DannyRS

Const
P07_AutoUpdateInclude = True;
P07_VersionNumber = '1.7';

Var
P07_PName,P07_PPass,P07_PlayerName,P07_PlayerPass: String;
P07_ClientHeight,P07_ClientWidth: Integer;
P07_outline_orange,P07_outline_blue,P07_Outline_Black,P07_outline_white,P07_outline_yellow: Integer;
P07_MSX1,P07_MSX2,P07_MSY1,P07_MSY2: Integer;
P07_MIX1,P07_MIX2,P07_MIY1,P07_MIY2: Integer;
P07_MMX1,P07_MMX2,P07_MMY1,P07_MMY2: Integer;
P07_CompassX1,P07_CompassX2,P07_CompassY1,P07_CompassY2: Integer;
P07_MSCX,P07_MSCY,P07_MICX,P07_MICY,P07_MMCX,P07_MMCY: Integer;
P07_CTCDTM1,P07_CTCDTM2,P07_CompassDTM,P07_FlagDTM: Integer;
P07_MouseSpeed: Integer;

//Credits to Harry and Shuttleu
//Edited by DannyRS and Shatterhand
procedure P07_AutoUpdateMe;
var
NewFile : Integer;
OnlineVersion, NewScript, NewFileName : String;
begin
begin
Writeln('Checking P07Include VersionNumber');
OnlineVersion := GetPage('http://unofficial-srl-oldschool07-include.googlecode.com/svn/trunk/P07VersionNumber.txt');
Writeln('Local : ' + P07_VersionNumber + ' / Latest : ' + OnlineVersion);
if (Trim(OnlineVersion) > P07_VersionNumber) then
begin
Writeln('New P07Include Version Available! Updating...');
NewScript := GetPage('http://unofficial-srl-oldschool07-include.googlecode.com/svn/trunk/P07Include.simba');
NewFileName := AppPath + 'Includes\P07Include.simba';
NewFile := RewriteFile(NewFileName, true);
try
WriteFileString(NewFile, NewScript);
except
begin
Writeln('Fatal error writing to ' + NewFileName + '!');
TerminateScript;
end;
end;
CloseFile(NewFile);
Writeln('New P07Include Version Downloaded Please Restart Your Script!');
TerminateScript;
end else
writeln('You Have The Latest Version of P07Include');
end;
end;

Procedure P07_MouseBox(X1, Y1, X2, Y2: Integer; ClickType: Integer);
Begin
MMouse(RandomRange(X1,X2),RandomRange(Y1,Y2),0,0);
ClickMouse2(ClickType);
Wait(RandomRange(37,50));
End;

Procedure P07_TypeFast(Text: String);
Var
I: Integer;
Begin
For I:=1 To Length(Text) Do
SendKeys(Text[I],RandomRange(60,120),RandomRange(60,120));
Wait(RandomRange(110,250));
End;

Procedure P07_UseKey(KeyToUse: Word);
Begin
KeyDown(KeyToUse);
Wait(RandomRange(59,91));
KeyUp(KeyToUse);
Wait(RandomRange(40,150));
End;

Function P07_LoggedIn: Boolean;
Begin
//White text on Report Abuse Button
Result := (GetColor(427, 489) = 16777215);
End;

(*
GetUpText
~~~~~~~~~

.. code-block:: pascal

function GetUpText : string;

Returns the text in the upperleft
corner of the screen (often referred to as UpText).

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_GetUpText: String;
Var
WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
Begin
WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'P07UpChars');
BlueT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars');
YellowT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 1235160, 40, 'P07UpChars');
OrangeT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 4687583, 53, 'P07UpChars');
FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
Result:=FoundText;
End;

Function P07_ContainsText(CheckText: String; Text: TStringArray): Boolean;
Var
TheText: String;
i, n: Integer;
Begin
TheText := CheckText;
n := High(Text);
For i := 0 to n do
If (Pos(Text[i], TheText) > 0) then
Begin
Result := True;
Exit;
End;
End;

(*
IsUpTextMultiCustom
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function IsUpTextMultiCustom(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.

.. note::

by DannyRS

Example:

.. code-block:: pascal

IsUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'])

*)
Function P07_IsUpTextMultiCustom(Text: TStringArray): Boolean;
Begin
Result:=P07_ContainsText(P07_GetUpText, Text);
End;

(*
P07_WaitUpTextMultiCustom
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function P07_WaitUpTextMultiCustom(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.
For a set amount of time.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WaitUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'],RandomRange(200,300)) Then

*)
Function P07_WaitUpTextMultiCustom(Text: TStringArray; TimeOfWait: Integer): Boolean;
Var
TOWait: Integer;
Begin
Result:=False;
MarkTime(TOWait);
Repeat Begin
Wait(RandomRange(20,80));
If P07_IsUpTextMultiCustom(Text) Then
Result:=True;
End; Until (Result) Or (TimeFromMark(TOWait)>TimeOfWait)
End;

(*
P07_LoginPlayer
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_LoginPlayer;

Logs A Player into RS07

.. note::

by DannyRS

Example:

.. code-block:: pascal

If Not P07_LoggedIn Then
P07_LoginPlayer;

*)
Procedure P07_LoginPlayer;
Var
X,Y,Attempts: Integer;
Begin
Repeat Begin
If (GetTextAtExWrap(250, 215, 387, 231, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Enter your username') Then
Begin
WriteLn('Enter your username & password');
If Not (FindColor(x, y, P07_outline_white, 312, 255, 512, 266)) Then
Begin
If (P07_PlayerName = '') Then
Begin
WriteLn('Player Name Not Entered, Or Set P07_PlayerName and P07_PlayerPass Before SetupP07Include');
TerminateScript;
End;
//P07_MouseBox(345, 259, 365, 263, mouse_left);
P07_TypeFast(P07_PName);
End;
P07_UseKey(9);
If Not (FindColor(x, y, P07_outline_white, 345, 271, 525, 278)) Then
Begin
If (P07_PlayerPass = '') Then
Begin
WriteLn('Player Password Not Entered, Or Use P07_DeclarePlayer Before SetupP07Include');
TerminateScript;
End;
P07_TypeFast(P07_PPass);
End;
Wait(RandomRange(100, 200));
P07_MouseBox(235, 304, 369, 337, mouse_left);
Wait(RandomRange(300, 500));
End;
If (GetTextAtExWrap(300, 240, 381, 255, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Welcome to') Then
Begin
WriteLn('Welcome to Project RS06');
P07_MouseBox(395, 275, 530, 307, mouse_left);
Wait(RandomRange(100, 200));
End;
If (GetTextAtExWrap(260, 215, 373, 227, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Invalid username') Then
Begin
WriteLn('Invalid username or password');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(100, 200));
Continue;
End;
If (GetTextAtExWrap(306, 215, 446, 230, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Connecting to') Then
Begin
WriteLn('Connecting to server...');
Wait(RandomRange(300, 500));
End;
If (GetTextAtExWrap(293, 215, 403, 231, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Error connecting') Then
Begin
WriteLn('Error connecting to server');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(3300, 5500));
Continue;
End;
If (GetTextAtExWrap(250, 205, 356, 217, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Your account') Then
Begin
WriteLn('Your account is already logged in.');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(7300, 15500));
Continue;
End;
If (GetTextAtExWrap(452, 330, 484, 343, 0, 5, 1, P07_outline_white, 20, 'P07UpChars') = 'PLAY') Then
Begin
WriteLn('Click To Play');
Wait(RandomRange(300, 1300));
P07_MouseBox(275, 269, 495, 377, mouse_left);
Wait(RandomRange(800, 1500));
Continue;
End;
If (GetTextAtExWrap(238, 215, 282, 227, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Please') Then
Begin
WriteLn('Please Enter Your Username');
Wait(RandomRange(100, 500));
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(100, 500));
Continue;
End;
End; Until (P07_LoggedIn) Or (Attempts > 5)
If (P07_LoggedIn) Then
Attempts:=0;
If (Attempts > 5) Then
Begin
WriteLn('Too Many Failed Login Attempts');
TerminateScript;
End;
Wait(RandomRange(1300, 2100));
End;

(*
P07_ItemExists
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_ItemExists(SlotToCheck: Integer): Boolean;

Checks if there is an Item in Inventory slot and returns true or false.
Accepts Numbers 1-28
.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_ItemExists(1) Then DoSomething();

*)
Function P07_ItemExists(SlotToCheck: Integer): Boolean;
Var
xsx,ysy,x,y,R,C:Integer;
Begin
SlotToCheck:=SlotToCheck-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToCheck/4));
R:=(SlotToCheck -(C*4));
If FindColor(x, y, P07_outline_black, xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25) Then
Begin
Result:=True;
End;
End;

(*
P07_InvFull
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InvFull: Boolean;

Checks if the player's inventory is full and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InvFull Then DoSomething();

*)
Function P07_InvFull: Boolean;
Var
C:Integer;
Begin
Result:=True;
For C:=1 To 28 Do
Begin
If (Not P07_ItemExists(C)) Then
Result:=False;
End;
End;

(*
P07_InvEmpty
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InvEmpty: Boolean;

Checks if the player's inventory is empty and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InvEmpty Then DoSomething();

*)
Function P07_InvEmpty: Boolean;
Var
C:Integer;
Begin
Result:=True;
For C:=1 To 28 Do
Begin
If P07_ItemExists(C) Then
Result:=False;
End;
End;

(*
P07_InvCount
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function P07_InvCount : Integer;

Counts Inventory Items.

.. note::

by Shatterhand

Example:

.. code-block:: pascal

Integer:=P07_InvCount;

*)
Function P07_InvCount : Integer;
Var
I : Integer;
Begin
Result := 0;
for I:=1 to 28 do
if P07_ItemExists(I) then
Inc(Result);
End;

(*
P07_GetChooseOptions
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetChooseOptions: TStringArray;

Gets current options on the right click game Choose Option pannel.

.. note::

by DannyRS

Example:

.. code-block:: pascal

UpOptions:=P07_GetChooseOptions;
For x:=0 To High(UpOptions) Do
WriteLn(UpOptions[x]);

*)
Function P07_GetChooseOptions: TStringArray;
Var
WhiteBoxT,BlueBoxT,YellowBoxT,OrangeBoxT,FoundText: String;
OptionTB:TBox;
OptionBoxTPA1: TPointArray;
NumberOfOptions,C: Integer;
Begin
FindColors(OptionBoxTPA1, 4674653, P07_MSX1, P07_MSY1, P07_ClientWidth-1, P07_ClientHeight-1);
OptionTB:=getTPABounds(OptionBoxTPA1);
If (Length(OptionBoxTPA1) < 10) Then
Begin
Exit;
End;
NumberOfOptions:=((OptionTB.Y2-2) - (OptionTB.Y1+21)) / 14;
SetLength(Result,NumberOfOptions);
For C:=0 To (NumberOfOptions-1) Do
Begin
If (OptionTB.Y1+21+(C*15)) > OptionTB.Y1+21+((C+1)*14) Then
Begin
Exit;
End;
WhiteBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16777215, 5, 'P07UpChars');
BlueBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16776960, 5, 'P07UpChars');
YellowBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 65535, 5, 'P07UpChars');
OrangeBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 4231423, 5, 'P07UpChars');
FoundText:=WhiteBoxT+' '+BlueBoxT+YellowBoxT+OrangeBoxT;
Result[C]:=Trim(FoundText);
End;
End;

(*
P07_ChooseOptionMulti
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_ChooseOptionMulti(Text: TStringArray): Boolean;

Chooses an option on the right click game Choose Option pannel.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_ChooseOptionMulti(['quickly']); - Bank

*)
Function P07_ChooseOptionMulti(Text: TStringArray): Boolean;
Var
WhiteBoxT,BlueBoxT,YellowBoxT,OrangeBoxT,FoundText: String;
OptionTB:TBox;
OptionBoxTPA1: TPointArray;
NumberOfOptions,C,X,Y: Integer;
Begin
FindColors(OptionBoxTPA1, 4674653, P07_MSX1, P07_MSY1, P07_ClientWidth-1, P07_ClientHeight-1);
OptionTB:=getTPABounds(OptionBoxTPA1);
If (Length(OptionBoxTPA1) < 10) Then
Begin
Result:=False;
Exit;
End;
NumberOfOptions:=((OptionTB.Y2-2) - (OptionTB.Y1+21)) / 14;
For C:=0 To (NumberOfOptions-1) Do
Begin
If (OptionTB.Y1+21+(C*15)) > OptionTB.Y1+21+((C+1)*14) Then
Begin
Result:=False;
Break;
End;
WhiteBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16777215, 5, 'P07UpChars');
BlueBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16776960, 5, 'P07UpChars');
YellowBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 65535, 5, 'P07UpChars');
OrangeBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 4231423, 5, 'P07UpChars');
FoundText:=WhiteBoxT+' '+BlueBoxT+YellowBoxT+OrangeBoxT;
If (P07_ContainsText(FoundText,Text)) Then
Begin
MMouse(RandomRange(OptionTB.X1+2,OptionTB.X2-2),RandomRange(OptionTB.Y1+21+(C*14),OptionTB.Y1+21+((C+1)*14)),0,0);
ClickMouse2(mouse_left);
Result:=True;
Exit;
End;
End;
GetMousePos(X,Y);
If Y > 21 Then
MMouse(RandomRange(OptionTB.X1+2,OptionTB.X2-2),RandomRange(Y-10,Y-20),0,0)
Else
MMouse(RandomRange(5,535),RandomRange(350,490),0,0);
Result:=False;
End;

(*
P07_P07_WaitOptionMulti
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_WaitOptionMulti(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.
For a set amount of time.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WaitOptionMulti(['Use', 'Bank'],RandomRange(200,300)) Then

*)
Function P07_WaitOptionMulti(Text: TStringArray; TimeOfWait: Integer): Boolean;
Var
TOWait,I,I2,L,L2: Integer;
UpOptions: TStringArray;
Begin
Result:=False;
L:=High(Text);
MarkTime(TOWait);
Repeat Begin
UpOptions:=P07_GetChooseOptions;
L2:=High(UpOptions);
For I:=0 To L Do
For I2:=0 To L2 Do
If (Pos(Text[I], UpOptions[I2]) > 0) Then
Begin
If (P07_ChooseOptionMulti(Text)) Then
Result:=True;
Exit;
End;
Wait(RandomRange(20,80));
End; Until (Result) Or (TimeFromMark(TOWait)>TimeOfWait)
End;

(*
P07_InventoryTab
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InventoryTab(TabNumber:Integer;): Boolean;

Switches/Checks Current InventoryTab 1-14.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_TabInventoryTab(4); - Inventory

*)
Function P07_TabInventoryTab(TabNumber:Integer): Boolean;
Var
X,Y:Integer;
Begin
Result:=False;
If (Not FindColorTolerance(X,Y,13758452,600,175,620,197,16)) Then
Exit;
Case TabNumber Of
1:Begin
If (Not FindColorTolerance(X,Y,1910383,535,172,540,176,13)) Then
P07_MouseBox(533,174,552,197, mouse_left);
End;
2:Begin
If (Not FindColorTolerance(X,Y,1910383,564,172,571,176,13)) Then
P07_MouseBox(563,171,590,197, mouse_left);
End;
3:Begin
If (Not FindColorTolerance(X,Y,1910383,596,172,600,176,13)) Then
P07_MouseBox(597,171,622,197, mouse_left);
End;
4:Begin
If (Not FindColorTolerance(X,Y,1910383,630,172,635,176,13)) Then
P07_MouseBox(629,171,655,197, mouse_left);
End;
5:Begin
If (Not FindColorTolerance(X,Y,1910383,663,172,670,176,13)) Then
P07_MouseBox(662,171,688,197, mouse_left);
End;
6:Begin
If (Not FindColorTolerance(X,Y,1910383,727,172,735,176,13)) Then
P07_MouseBox(695,171,719,197, mouse_left);
End;
7:Begin
If (Not FindColorTolerance(X,Y,1910383,730,173,734,180,13)) Then
P07_MouseBox(729,175,752,197, mouse_left);
End;
8:Begin
If (Not FindColorTolerance(X,Y,1910383,525,469,534,473,13)) Then
P07_MouseBox(529,469,554,490, mouse_left);
End;
9:Begin
If (Not FindColorTolerance(X,Y,1910383,563,469,570,473,13)) Then
P07_MouseBox(564,469,587,495, mouse_left);
End;
10:Begin
If (Not FindColorTolerance(X,Y,1910383,596,469,602,473,13)) Then
P07_MouseBox(597,469,620,495, mouse_left);
End;
11:Begin
If (Not FindColorTolerance(X,Y,1910383,629,469,634,473,13)) Then
P07_MouseBox(630,469,655,495, mouse_left);
End;
12:Begin
If (Not FindColorTolerance(X,Y,1910383,662,469,669,473,13)) Then
P07_MouseBox(662,469,688,495, mouse_left);
End;
13:Begin
If (Not FindColorTolerance(X,Y,1910383,695,469,700,473,13)) Then
P07_MouseBox(697,469,720,495, mouse_left);
End;
14:Begin
If (Not FindColorTolerance(X,Y,1910383,728,469,733,473,13)) Then
P07_MouseBox(729,469,752,490, mouse_left);
End;
End;
Result:=True;
End;

(*
P07_DropInventorySlot
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropInventorySlot;

Checks if there is an Item in Inventory slot and drops it
Accepts Number 1-28

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropInventorySlot(1);

*)
Procedure P07_DropInventorySlot(SlotToDrop: Integer);
Var
xsx,ysy,R,C:Integer;
Begin
SlotToDrop:=SlotToDrop-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToDrop/4));
R:=(SlotToDrop -(C*4));
SlotToDrop:=SlotToDrop+1;
If P07_ItemExists(SlotToDrop) Then
Begin
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25, mouse_right);
P07_ChooseOptionMulti(['Drop']);
End;
End;

(*
P07_DropAll
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropAll;

Checks if there is an Item in Inventory slot and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropAll;

*)
Procedure P07_DropAll;
Var
I:Integer;
Begin
P07_TabInventoryTab(4);
For I:=1 To 28 Do
Begin
P07_DropInventorySlot(I);
Wait(RandomRange(20,90));
End;
End;

(*
P07_DropAllExcept
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropAllExcept(SkipSlots:Array of Integer);

Drops everything in inventory. Ignores slots specified by SkipSlots array.

.. note::

by Nava2, modified by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropAllExcept([1]);

*)
Procedure P07_DropAllExcept(SkipSlots: TIntegerArray);
Var
Inv,I,L:Integer;
Begin
P07_TabInventoryTab(4);
L:=High(SkipSlots);
For I := 0 To L Do
SkipSlots[I]:=SkipSlots[I]-1;
For I := 0 To L Do
{ Set the bit associated with the DontDrop Array }
Inv := Inv Or (1 Shl SkipSlots[I]);
For I := 0 To 27 Do
{ Check the bit at i, and if its high, then we dont drop. }
If (((Inv Shr I) And 1) = 0) Then
P07_DropInventorySlot(I+1);
End;

(*
P07_BankScreen
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_BankScreen: Boolean;

Checks if the Bank Panel is up and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then DoSomething();

*)
Function P07_BankScreen: Boolean;
Begin
Result:=(GetTextAtExWrap(184, 35, 243, 47, 0, 5, 1, 2070783, 10, 'P07UpChars')='The Bank');
End;

(*
P07_DepositInventorySlot
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DepositInventorySlot(SlotToDrop: Integer; DepositAll:Boolean);

Deposits item from inventory slot.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then P07_DepositInventorySlot(1, True);

*)
Procedure P07_DepositInventorySlot(SlotToDepo: Integer; DepositAll:Boolean);
Var
xsx,ysy,R,C:Integer;
Begin
SlotToDepo:=SlotToDepo-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToDepo/4));
R:=(SlotToDepo -(C*4));
SlotToDepo:=SlotToDepo+1;
If P07_ItemExists(SlotToDepo) Then
Begin
If (DepositAll) Then
Begin
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25,mouse_right);
P07_ChooseOptionMulti(['Store All','All']);
Wait(RandomRange(300,500));
End Else
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25,mouse_left);
End;
End;

(*
P07_Deposit
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_Deposit(SlotFrom, SlotTo: Integer; DepositAll:Boolean);

Deposits items from inventory from slots int-int if bank is open.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then P07_Deposit(1, 28, False);
If P07_BankScreen And P07_InvFull Then P07_Deposit(1, 28, True);

*)
Procedure P07_Deposit(SlotFrom, SlotTo: Integer; DepositAll: Boolean);
Var
I:Integer;
Begin
If (Not P07_BankScreen) Then
Exit;
For I:=SlotFrom To SlotTo Do
Begin
P07_DepositInventorySlot(I,DepositAll);
Wait(RandomRange(20,90));
End;
End;

(*
P07_MakeCameraAngleHigh
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCameraAngleHigh;

Make's The Game's Camera Angle Highest.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCameraAngleHigh;

*)
Procedure P07_MakeCameraAngleHigh;
Begin
If (Not P07_LoggedIn) Then
Exit;
KeyDown(38);
Wait(RandomRange(1800,2000));
KeyUp(38);
End;

(*
P07_MakeCameraAngleLow
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCameraAngleLow;

Make's The Game's Camera Angle Lowest.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCameraAngleLow;

*)
Procedure P07_MakeCameraAngleLow;
Begin
If (Not P07_LoggedIn) Then
Exit;
KeyDown(40);
Wait(RandomRange(1800,2000));
KeyUp(40);
End;

(*
P07_GetCompassAngle
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetCompassAngle: Integer;

Gets Compass Angle 0-360

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_GetCompassAngle

*)
Function P07_GetCompassAngle: Integer;
Var
X,Y: Integer;
AtAngle,AngleResult: Extended;
Begin
If FindDTMRotated(P07_CompassDTM,X,Y,P07_CompassX1,P07_CompassY1,P07_CompassX2,P07_CompassY2, 0, (2*Pi), Pi/180, AtAngle) Then
Begin
AngleResult:=Degrees(AtAngle);
End
Else
AngleResult:=0;
Result:=Round(AngleResult);
End;

(*
P07_MakeCompassDegree
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassDegree(MakeAngle: Integer);

Makes Compass Angle 5-355

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassDegree(5); Or P07_MakeCompassDegree(355); //North
P07_MakeCompassDegree(180); //South

*)
Procedure P07_MakeCompassDegree(MakeAngle: Integer);
Var
WaitsDone,CurAngle,CurAngleR,CurAngleL,LeftDist,RightDist,StepsL,StepsR: Integer;
KeyToHold: Word;
Begin
//LOL At How Bad This Math Is, Meh Works - Danny
WaitsDone:=0;
KeyToHold:=37;
If (Not P07_LoggedIn) Then
Exit;
CurAngle:=P07_GetCompassAngle;
CurAngleR:=CurAngle+5;
If (CurAngleR>360) Then
CurAngleR:=CurAngleR-360;
CurAngleL:=CurAngle-5;
If (CurAngleL<0) Then
CurAngleL:=(360-(CurAngleL*-1));
If (MakeAngle < 5) Then
MakeAngle:=5;
If (MakeAngle > 355) Then
MakeAngle:=355;
If (MakeAngle < CurAngleR) And (MakeAngle > CurAngleL) Then
Exit;
StepsL:=0;
LeftDist:=CurAngle;
Repeat Begin
LeftDist:=LeftDist-1;
If (LeftDist<0) Then
LeftDist:=360;
StepsL:=StepsL+1;
End; Until (LeftDist=MakeAngle)
StepsR:=0;
RightDist:=CurAngle;
Repeat Begin
RightDist:=RightDist+1;
If (RightDist>360) Then
RightDist:=0;
StepsR:=StepsR+1;
End; Until (RightDist=MakeAngle)
If StepsL > StepsR Then
KeyToHold:=39;
KeyDown(KeyToHold);
Repeat Begin
WaitsDone:=WaitsDone+1;
CurAngle:=P07_GetCompassAngle;
CurAngleR:=CurAngle+10;
If (CurAngleR>360) Then
CurAngleR:=CurAngleR-360;
CurAngleL:=CurAngle-10;
If (CurAngleL<0) Then
CurAngleL:=(360-(CurAngleL*-1));
Wait(10);
End; Until ((MakeAngle < CurAngleR) And (MakeAngle > CurAngleL)) Or (WaitsDone>700)
wait(RandomRange(10,90));
KeyUp(KeyToHold);
End;

(*
P07_MakeCompassNorth
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassNorth;

Make's Compass North.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassNorth;

*)
Procedure P07_MakeCompassNorth;
Var
CurAngle: Integer;
Begin
If (Not P07_LoggedIn) Then
Exit;
CurAngle:=P07_GetCompassAngle;
If CurAngle > 180 Then
P07_MakeCompassDegree(355)
Else
P07_MakeCompassDegree(5);
End;

(*
P07_MakeCompassEast
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassEast;

Make's Compass East.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassEast;

*)
Procedure P07_MakeCompassEast;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(270);
End;

(*
P07_MakeCompassWest
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassWest;

Make's Compass West.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassWest;

*)
Procedure P07_MakeCompassWest;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(90);
End;

(*
P07_MakeCompassSouth
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassSouth;

Make's Compass South.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassSouth;

*)
Procedure P07_MakeCompassSouth;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(180);
End;

(*
P07_FindMMFlag
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_FindMMFlag: Boolean;

Checks if the red flag on the minimap is there

.. note::

by DannyRS

Example:

.. code-block:: pascal

If (Not P07_FindMMFlag) Then

*)
Function P07_FindMMFlag: Boolean;
Var
X,Y: Integer;
Begin
Result:=(FindDTM(P07_FlagDTM,X,Y,P07_MMX1,P07_MMY1,P07_MMX2,P07_MMY2));
End;

(*
P07_FFlag
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_FFlag;

Waits till the red flag on the minimap is gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

Click; P07_FFlag; Click;

*)
Procedure P07_FFlag;
Var
WaitsDone: Integer;
Begin
Repeat Begin
If (Not P07_FindMMFlag) Then
Begin
Exit;
End;
Wait(RandomRange(50,100));
WaitsDone:=WaitsDone+1;
End; Until (WaitsDone > 800)
End;

(*
P07_MMToMSPoint
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

procedure P07_MMToMSPoint(var X, Y : Integer);

Converts a Minimap point to a MainScreen Point

.. note::

by Shatterhand

Example:

.. code-block:: pascal

P07_MMToMSPoint(X,Y);

*)
procedure P07_MMToMSPoint(var X, Y : Integer);
var
x1, y1 : Integer;
begin
x1 := X;
y1 := X;

X := Round((X-P07_MMCX)*255/40) + P07_MSCX;
Y := Round((Y-P07_MMCY)*176/28) + P07_MSCY;

if X < MSX1 then X := MSX1;
if Y < MSY1 then Y := MSY1;
if X > MSX2 then X := MSX2;
if Y > MSY2 then Y := MSY2;
end;

(*
P07_FindObjEx
~~~~~~~~~

.. code-block:: pascal

function P07_FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;

Searches for an object using an array of colors and texts within the area
you specify. Will start searching from the middle and returns true if found.
Parameters:

- cx, cy: Coordinate Position of object if result is true
- Text: Array of string you want to search for
- Color: Array of colors you want to search for
- Tol: Tolerance of the colors you will allow
- Step: How big you want to make the search squares.
50 = Default. 30-70 Recommended
- xs, ys, xe, ye: Bounds you want to search in

.. note::

by Starblaster100, Modified by DannyRS


Example:

.. code-block:: pascal

*)
function P07_FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
var
MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
ColorFound: Boolean;
SearchBoxes: Array of Array of TBox;
p: TPointArray;
begin
Result := False;

//check for all the colors
for i := 0 to (GetArrayLength(Color)-1) do
if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
begin
ColorFound := True;
Break;
end;

if not(ColorFound) then
Exit; //None of the colors could be found on screen

//Start coordinates
MidX := Round((xe - xs) / 2);
MidY := Round((ye - ys) / 2);

//width and height in boxes
Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;

SetLength(SearchBoxes, Width);

//Getting mid of screen in boxes, not pixels
HalfWidth := Floor(Width / 2);
HalfHeight := Floor(Height / 2)

//Create the search boxes, starting in mid because of backwards compatibility
for x := -1 * HalfWidth to HalfWidth do
begin
SetLength(SearchBoxes[x + HalfWidth], Height);
for y := -1 * HalfHeight to HalfHeight do
SearchBoxes[x + HalfWidth][y + HalfHeight] := IntToBox(
Max(xs, xs + Round(MidX + ((x - 0.5) * Step))),
Max(ys, ys + Round(MidY + ((y - 0.5) * Step))),
Min(xe, xs + Round(MidX + ((x + 0.5) * Step))),
Min(ye, ys + Round(MidY + ((y + 0.5) * Step))));
end;

//Create a TPA, where points are representing the boxes
p := TPAFromBox(IntToBox(0, 0, Width-1, Height-1));

//Sort thid TPA from the middle to get a spiral like effect
SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));

//Loop through the boxes, searching for the object (the k and j loop might be better to switch though)
for k := 0 to High(Color) do
for j := 0 to High(p) do
begin
if (FindColorTolerance(cx, cy, Color[k], SearchBoxes[p[j].x][p[j].y].x1,
SearchBoxes[p[j].x][p[j].y].y1, SearchBoxes[p[j].x][p[j].y].x2,
SearchBoxes[p[j].x][p[j].y].y2, Tol)) then
begin
MMouse(RandomRange(cx-2,cx+2), RandomRange(cy-2,cy+2), 0, 0);
Wait(RandomRange(30,90));
If P07_IsUpTextMultiCustom(Text) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end;
end;
end;
end;

(*
P07_FindObj
~~~~~~~

.. code-block:: pascal


function P07_FindObj(var cx, cy: Integer; Text: string; Color, Tol: Integer): Boolean;

Finds Object

.. note::

by Starblaster100, Modified by DannyRS

Example:

.. code-block:: pascal

If P07_FindObj(x, y, 'Talk', 3040587, 10) Then
ClickMouse2(mouse_left);

*)
function P07_FindObj(var cx, cy: Integer; Text: string; Color: Integer; Tol: Integer): Boolean;
begin
Result := P07_FindObjEx(cx, cy, [Text], [Color], Tol, 50, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2);
end;

(*
P07_FindObjCustom
~~~~~~~~~~~~~

.. code-block:: pascal

function P07_FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

Finds Object with custom amount of colors and custom amount of Uptext

.. note::

by Starblaster100, Modified by DannyRS

Example:

.. code-block:: pascal

If P07_FindObjCustom(x, y, ['Attack', 'MonsterName'], [123456, 345678], 5) Then
ClickMouse2(mouse_left);

*)
function P07_FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;
begin
Result := P07_FindObjEx(cx, cy, Text, Color, Tol, 50, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2);
end;

(*
P07_HoverSkill
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_HoverSkill(SkillName: String; HoverTime: Integer);

Hovers over a chosen Skill in skill panel for an amount of time

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_HoverSkill('random',RandomRange(2500,3500));

*)
Procedure P07_HoverSkill(SkillName: String; HoverTime: Integer);
Var
RowN,ColN,RandomXN,RandomYN: Integer;
Begin
RowN:=0; ColN:=0;
RandomXN:=RandomRange(0,3);
RandomYN:=RandomRange(0,8);
If ((RandomXN=3) And (RandomYN=7)) Then
RandomXN:=RandomRange(0,2);
If Not P07_TabInventoryTab(2) Then
Exit;
Case Lowercase(SkillName) Of
'attack': Begin RowN:=0; ColN:=0; End;
'hitpoints': Begin RowN:=1; ColN:=0; End;
'mining': Begin RowN:=2; ColN:=0; End;
'strength': Begin RowN:=0; ColN:=1; End;
'agility': Begin RowN:=1; ColN:=1; End;
'smithing': Begin RowN:=2; ColN:=1; End;
'defence': Begin RowN:=0; ColN:=2; End;
'herblore': Begin RowN:=1; ColN:=2; End;
'fishing': Begin RowN:=2; ColN:=2; End;
'ranged': Begin RowN:=0; ColN:=3; End;
'thieving': Begin RowN:=1; ColN:=3; End;
'cooking': Begin RowN:=2; ColN:=3; End;
'prayer': Begin RowN:=0; ColN:=4; End;
'crafting': Begin RowN:=1; ColN:=4; End;
'firemaking': Begin RowN:=2; ColN:=4; End;
'magic': Begin RowN:=0; ColN:=5; End;
'fletching': Begin RowN:=1; ColN:=5; End;
'woodcutting': Begin RowN:=2; ColN:=5; End;
'runecrafting': Begin RowN:=0; ColN:=6; End;
'slayer': Begin RowN:=1; ColN:=6; End;
'farming': Begin RowN:=2; ColN:=6; End;
'construction': Begin RowN:=0; ColN:=7; End;
'hunter': Begin RowN:=1; ColN:=7; End;
'random': Begin RowN:=RandomXN; ColN:=RandomYN; End;
End;
MMouse(550+(RowN*63),210+(ColN*31),54,25);
Wait(HoverTime);
P07_TabInventoryTab(4);
End;

(*
P07_DidClick
~~~~~~~~~~~~~

.. code-block:: pascal

function P07_DidClick(Red: Boolean; Time: integer): boolean;

Checks if player clicked screen

.. note::

by Justin

Example:

.. code-block:: pascal

Result := P07_DidClick(true, 1000);

*)
function P07_DidClick(Red: Boolean; Time: integer): boolean;
var
TimeOut, x, y, w, h, R, G: integer;
B: TBox;
begin
GetMousePos(x, y);
GetClientDimensions(w, h);
B := IntToBox(x - 15, y - 15, x + 15, y + 15);
if B.x1 < 0 then B.x1 := 0;
if B.y1 < 0 then B.y1 := 0;
if B.x2 > w then B.x2 := w;
if B.y2 > h then B.y2 := h;
TimeOut := GetSystemTime + Time;
while (GetSystemTime < TimeOut) do
begin
R := CountColorTolerance(255, B.x1, B.y1, B.x2, B.y2, 15);
G := CountColorTolerance(65535, B.x1, B.y1, B.x2, B.y2, 15);
if Red then
begin
if (G > 8) then
Exit;
Result := (R > 20);
end else
begin
if (R > 5) then
Exit;
Result := (G > 35);
end;
if Result then
Exit;
end;
end;
//Checks if player click was Red, by Justin
function P07_DidRedClick: Boolean;
begin
Result := P07_DidClick(true, 1000);
end;
//Checks if player click was Yellow, by Justin
function P07_DidYellowClick: Boolean;
begin
Result := P07_DidClick(false, 1000);
end;

(*
P07_ClickToContinue
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_ClickToContinue;

Clicks ClickToContinue ChatText Till Gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_ClickToContinue;

*)
Procedure P07_ClickToContinue;
Var
X,Y,TOTimer: Integer;
Begin
If FindDTM(P07_CTCDTM1,X,Y,225,440,385,460) Then
Begin
MarkTime(TOTimer);
P07_MouseBox(236, 447, 375, 454, mouse_left);
Repeat Begin
If FindDTM(P07_CTCDTM1,X,Y,225,440,385,460) Or
FindColor(X,Y,P07_outline_white,225,440,385,460) Then
P07_MouseBox(236, 447, 375, 454, mouse_left);
Wait(RandomRange(100,400));
End; Until (Not FindDTM(P07_CTCDTM1,X,Y,225,440,385,460)) And
(Not FindColor(X,Y,P07_outline_white,225,440,385,460)) And
(Not FindDTM(P07_CTCDTM2,X,Y,225,440,385,460)) Or
(TimeFromMark(TOTimer)>30000)
End;
End;

(*
P07_CastSpell
~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_CastSpell(SpellNumber: Integer): Boolean;

Clicks ClickToContinue ChatText Till Gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_CastSpell(1) Then //HomePort
Wait(RandomRange(5000,6000));

*)
Function P07_CastSpell(SpellNumber: Integer): Boolean;
Var
xsx,ysy,R,C: Integer;
Begin
Result:=False;
If ((SpellNumber<1) Or (SpellNumber>63)) Then
Exit;
xsx:=565;
ysy:=233;
SpellNumber:=SpellNumber-1;
C:=(Round(SpellNumber/7));
R:=(SpellNumber -(C*7));
If P07_TabInventoryTab(7) Then
Begin
P07_MouseBox(xsx+(R*24), ysy+(C*24), xsx+(R*24)+10, ysy+(C*24)+10,mouse_left);
Result:=True;
End;
End;

(*
P07_AutoRetaliate
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_AutoRetaliate(ToggleTo: Boolean);

Toggles AutoRetaliate On / Off

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_AutoRetaliate(True);

*)
Procedure P07_AutoRetaliate(ToggleTo: Boolean);
Begin
If (Not P07_TabInventoryTab(1)) Then Exit;
If (Not ToggleTo) And (GetTextAtExWrap(644, 379, 667, 392, 0, 5, 1, P07_outline_orange, 20, 'P07UpChars') = '(On)')
Then
P07_MouseBox(572, 362, 713, 397, mouse_left)
Else If (ToggleTo) And
(GetTextAtExWrap(642, 379, 670, 394, 0, 5, 1, P07_outline_orange, 20, 'P07UpChars') = '(Off)')
Then
P07_MouseBox(572, 362, 713, 397, mouse_left);
End;

(*
P07_CombatStance
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_CombatStance(ToggleToNum: Integer);

Toggles Combat Stance, Range 1-4.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_CombatStance(1); //AttackXp

*)
Procedure P07_CombatStance(ToggleToNum: Integer);
Var
X,Y: Integer;
Begin
If (Not P07_TabInventoryTab(1)) Then Exit;
If (ToggleToNum=1) And
(Not FindColorTolerance(X,Y,1974408,572,255,631,290,30)) Then
P07_MouseBox(572,255,631,290, mouse_left);
If (ToggleToNum=2) And
(Not FindColorTolerance(X,Y,1974408,656,255,715,290,30)) Then
P07_MouseBox(656,255,715,290, mouse_left);
If (ToggleToNum=3) And
(Not FindColorTolerance(X,Y,1974408,572,308,631,343,30)) Then
P07_MouseBox(572,308,631,343, mouse_left);
If (ToggleToNum=4) And
(Not FindColorTolerance(X,Y,1974408,655,308,714,343,30)) Then
P07_MouseBox(655,308,714,343, mouse_left);
End;

(*
P07_GetEquippedItemBounds
~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetEquippedItemBounds(EquipSlot: Integer): TBox;

Returns TBox of the specified equipment slot

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_GetEquippedItemBounds(EquipSlot: Integer): TBox;
Begin
Result := IntToBox(0, 0, 0, 0);
Case EquipSlot Of
1: Result := IntToBox(629, 213, 656, 240);
2: Result := IntToBox(588, 252, 615, 279);
3: Result := IntToBox(629, 252, 656, 279);
4: Result := IntToBox(670, 252, 697, 279);
5: Result := IntToBox(573, 291, 600, 318);
6: Result := IntToBox(629, 291, 656, 318);
7: Result := IntToBox(685, 291, 712, 318);
8: Result := IntToBox(629, 331, 656, 358);
9: Result := IntToBox(573, 371, 600, 398);
10: Result := IntToBox(629, 371, 656, 398);
11: Result := IntToBox(685, 371, 712, 398);
End;
End;

(*
P07_MouseEquippedItem
~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MouseEquippedItem(EquipSlot: Integer; ClickType: Integer);

Mouses an equipped item slot.

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Procedure P07_MouseEquippedItem(EquipSlot: Integer; ClickType: Integer);
Var
B : TBox;
Begin
B := P07_GetEquippedItemBounds(EquipSlot);
If (B.x1 = 0) And (B.x2 = 0) Then Exit;
If P07_TabInventoryTab(5) Then
P07_MouseBox(B.X1, B.Y1, B.X2, B.Y2, ClickType);
End;

(*
P07_WearingItem
~~~~~~~~~~~

.. code-block:: pascal

Function P07_WearingItem(I: Integer): Boolean;

Results True if an item is equipped at equpiment slot defined by I.
Range 1-11.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WearingItem(1) Then
*)
Function P07_WearingItem(I: Integer): Boolean;
Var
X, Y: Integer;
TB: TBox;
Begin
Result := False;
If (Not InRange(I, 1, 11)) Then Exit;
If (Not P07_TabInventoryTab(5)) Then Exit;
TB := P07_GetEquippedItemBounds(I);
Result := FindColor(X, Y, P07_Outline_Black, TB.X1, TB.Y1, TB.X2, TB.Y2);
End;

(*
P07_GetMiniMapDots
~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetMiniMapDots(WhatDotCol: String): TPointArray;

Results the dots specified by WhatDot on the Minimap. See `GetMiniMapDotsIn`
for more information.


.. note::

by Nava2, Modded by DannyRS

Example:

.. code-block:: pascal

// print the minimap positions on the debug canvas
DebugTPA(P07_GetMiniMapDots('white'));

*)
Function P07_GetMiniMapDots(WhatDotCol: String): TPointArray;
Begin
Result:=(GetMiniMapDotsIn(WhatDotCol, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2));
End;

(*
P07_CountMiniMapDots
~~~~~~~~~~~

.. code-block:: pascal

Function P07_CountMiniMapDots(WhatDotCol: String): Integer;

Returns Integer of number of dots on minimap.

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_CountMiniMapDots(WhatDotCol: String): Integer;
Begin
Result:=Length(P07_GetMiniMapDots(WhatDotCol));
End;

Procedure P07_SetGlobals;
Begin
If P07_AutoUpdateInclude Then
P07_AutoUpdateMe;

GetClientDimensions(P07_ClientWidth,P07_ClientHeight);

P07_MSX1:=4;
P07_MSX2:=515;
P07_MSY1:=4;
P07_MSY2:=337;
P07_MIX1:=552;
P07_MIX2:=731;
P07_MIY1:=207;
P07_MIY2:=464;
P07_MMX1:=570;
P07_MMX2:=714;
P07_MMY1:=9;
P07_MMY2:=159;
P07_CompassX1:=544;
P07_CompassX2:=577;
P07_CompassY1:=3;
P07_CompassY2:=36;

P07_MSCX:=(((P07_MSX2-P07_MSX1)/2)+P07_MSX1);
P07_MSCY:=(((P07_MSY2-P07_MSY1)/2)+P07_MSY1);
P07_MICX:=(((P07_MIY2-P07_MIY1)/2)+P07_MIY1);
P07_MICY:=(((P07_MIY2-P07_MIY1)/2)+P07_MIY1);
P07_MMCX:=648;
P07_MMCY:=83;

P07_outline_black:=65536;
P07_outline_white:=16777215;
P07_outline_blue:=16711680;
P07_outline_yellow:=65535;
P07_outline_orange:=2070783;

If P07_MouseSpeed > 0 Then
MouseSpeed:=P07_MouseSpeed
Else
MouseSpeed:=15;

P07_PName:=P07_PlayerName;
P07_PPass:=P07_PlayerPass;

P07_CompassDTM:=DTMFromString('mbQAAAHicY2VgYDBkgmBVILYHYiMgFgaKCwCxKBCLALEiEG91cALj+Tx8cGwEFEfHjFgwGAAAss4HDQ==');
P07_FlagDTM:=DTMFromString('mWAAAAHicY2FgYNjCxMCwDog3MkHYXgwQ7A7ELkD8Hw2jA0Y0DAIA2fcH8w==');
P07_CTCDTM1:=DTMFromString('mFQEAAHic42VgYOBjZGBQA2ITIM4B4gogbgTiTiCeBMTTgHguEEsAsTEQxwKxHhNhbIyGGRj+k4FJB4xkYBQAAN/kFGI=');
P07_CTCDTM2:=DTMFromString('m1gAAAHic42JgYOBkgmAhIPYBYjEg1gJiFyAOAOIQII4AYnMgdoDS1kBsD8W2SGwQZmD4TyQmDjASiREAAD31DoQ=');
End;

Procedure P07_FreeGlobals;
Begin
//FreeBitmap();
//FreeDTM();
FreeDTM(P07_CompassDTM);
FreeDTM(P07_FlagDTM);
FreeDTM(P07_CTCDTM1);
FreeDTM(P07_CTCDTM2);
End;

Procedure SetupP07Include;
Begin
P07_SetGlobals;
AddOnTerminate('P07_FreeGlobals');

{$IFDEF SMART}
SRL_EnableNavBar;
{$ENDIF}

End;

pija

2013-02-27 10:00:00

From: obsessive
Hi guys,
I just set up P07 but have encountered an error with it.

Please look here:
http://i.imgur.com/vsizLxV.png


Would anyone be able to help me, please?
I removed all the anti-leach from the other script file.

code:
//OldSchoolRS07 Unofficial Include (P07)
//Last Update [27/2/13][D/M/Y]
//Currently Developed by DannyRS

Const
P07_AutoUpdateInclude = True;
P07_VersionNumber = '1.7';

Var
P07_PName,P07_PPass,P07_PlayerName,P07_PlayerPass: String;
P07_ClientHeight,P07_ClientWidth: Integer;
P07_outline_orange,P07_outline_blue,P07_Outline_Black,P07_outline_white,P07_outline_yellow: Integer;
P07_MSX1,P07_MSX2,P07_MSY1,P07_MSY2: Integer;
P07_MIX1,P07_MIX2,P07_MIY1,P07_MIY2: Integer;
P07_MMX1,P07_MMX2,P07_MMY1,P07_MMY2: Integer;
P07_CompassX1,P07_CompassX2,P07_CompassY1,P07_CompassY2: Integer;
P07_MSCX,P07_MSCY,P07_MICX,P07_MICY,P07_MMCX,P07_MMCY: Integer;
P07_CTCDTM1,P07_CTCDTM2,P07_CompassDTM,P07_FlagDTM: Integer;
P07_MouseSpeed: Integer;

//Credits to Harry and Shuttleu
//Edited by DannyRS and Shatterhand
procedure P07_AutoUpdateMe;
var
NewFile : Integer;
OnlineVersion, NewScript, NewFileName : String;
begin
begin
Writeln('Checking P07Include VersionNumber');
OnlineVersion := GetPage('http://unofficial-srl-oldschool07-include.googlecode.com/svn/trunk/P07VersionNumber.txt');
Writeln('Local : ' + P07_VersionNumber + ' / Latest : ' + OnlineVersion);
if (Trim(OnlineVersion) > P07_VersionNumber) then
begin
Writeln('New P07Include Version Available! Updating...');
NewScript := GetPage('http://unofficial-srl-oldschool07-include.googlecode.com/svn/trunk/P07Include.simba');
NewFileName := AppPath + 'Includes\P07Include.simba';
NewFile := RewriteFile(NewFileName, true);
try
WriteFileString(NewFile, NewScript);
except
begin
Writeln('Fatal error writing to ' + NewFileName + '!');
TerminateScript;
end;
end;
CloseFile(NewFile);
Writeln('New P07Include Version Downloaded Please Restart Your Script!');
TerminateScript;
end else
writeln('You Have The Latest Version of P07Include');
end;
end;

Procedure P07_MouseBox(X1, Y1, X2, Y2: Integer; ClickType: Integer);
Begin
MMouse(RandomRange(X1,X2),RandomRange(Y1,Y2),0,0);
ClickMouse2(ClickType);
Wait(RandomRange(37,50));
End;

Procedure P07_TypeFast(Text: String);
Var
I: Integer;
Begin
For I:=1 To Length(Text) Do
SendKeys(Text[I],RandomRange(60,120),RandomRange(60,120));
Wait(RandomRange(110,250));
End;

Procedure P07_UseKey(KeyToUse: Word);
Begin
KeyDown(KeyToUse);
Wait(RandomRange(59,91));
KeyUp(KeyToUse);
Wait(RandomRange(40,150));
End;

Function P07_LoggedIn: Boolean;
Begin
//White text on Report Abuse Button
Result := (GetColor(427, 489) = 16777215);
End;

(*
GetUpText
~~~~~~~~~

.. code-block:: pascal

function GetUpText : string;

Returns the text in the upperleft
corner of the screen (often referred to as UpText).

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_GetUpText: String;
Var
WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
Begin
WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'P07UpChars');
BlueT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars');
YellowT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 1235160, 40, 'P07UpChars');
OrangeT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 4687583, 53, 'P07UpChars');
FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
Result:=FoundText;
End;

Function P07_ContainsText(CheckText: String; Text: TStringArray): Boolean;
Var
TheText: String;
i, n: Integer;
Begin
TheText := CheckText;
n := High(Text);
For i := 0 to n do
If (Pos(Text[i], TheText) > 0) then
Begin
Result := True;
Exit;
End;
End;

(*
IsUpTextMultiCustom
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function IsUpTextMultiCustom(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.

.. note::

by DannyRS

Example:

.. code-block:: pascal

IsUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'])

*)
Function P07_IsUpTextMultiCustom(Text: TStringArray): Boolean;
Begin
Result:=P07_ContainsText(P07_GetUpText, Text);
End;

(*
P07_WaitUpTextMultiCustom
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function P07_WaitUpTextMultiCustom(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.
For a set amount of time.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WaitUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'],RandomRange(200,300)) Then

*)
Function P07_WaitUpTextMultiCustom(Text: TStringArray; TimeOfWait: Integer): Boolean;
Var
TOWait: Integer;
Begin
Result:=False;
MarkTime(TOWait);
Repeat Begin
Wait(RandomRange(20,80));
If P07_IsUpTextMultiCustom(Text) Then
Result:=True;
End; Until (Result) Or (TimeFromMark(TOWait)>TimeOfWait)
End;

(*
P07_LoginPlayer
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_LoginPlayer;

Logs A Player into RS07

.. note::

by DannyRS

Example:

.. code-block:: pascal

If Not P07_LoggedIn Then
P07_LoginPlayer;

*)
Procedure P07_LoginPlayer;
Var
X,Y,Attempts: Integer;
Begin
Repeat Begin
If (GetTextAtExWrap(250, 215, 387, 231, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Enter your username') Then
Begin
WriteLn('Enter your username & password');
If Not (FindColor(x, y, P07_outline_white, 312, 255, 512, 266)) Then
Begin
If (P07_PlayerName = '') Then
Begin
WriteLn('Player Name Not Entered, Or Set P07_PlayerName and P07_PlayerPass Before SetupP07Include');
TerminateScript;
End;
//P07_MouseBox(345, 259, 365, 263, mouse_left);
P07_TypeFast(P07_PName);
End;
P07_UseKey(9);
If Not (FindColor(x, y, P07_outline_white, 345, 271, 525, 278)) Then
Begin
If (P07_PlayerPass = '') Then
Begin
WriteLn('Player Password Not Entered, Or Use P07_DeclarePlayer Before SetupP07Include');
TerminateScript;
End;
P07_TypeFast(P07_PPass);
End;
Wait(RandomRange(100, 200));
P07_MouseBox(235, 304, 369, 337, mouse_left);
Wait(RandomRange(300, 500));
End;
If (GetTextAtExWrap(300, 240, 381, 255, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Welcome to') Then
Begin
WriteLn('Welcome to Project RS06');
P07_MouseBox(395, 275, 530, 307, mouse_left);
Wait(RandomRange(100, 200));
End;
If (GetTextAtExWrap(260, 215, 373, 227, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Invalid username') Then
Begin
WriteLn('Invalid username or password');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(100, 200));
Continue;
End;
If (GetTextAtExWrap(306, 215, 446, 230, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Connecting to') Then
Begin
WriteLn('Connecting to server...');
Wait(RandomRange(300, 500));
End;
If (GetTextAtExWrap(293, 215, 403, 231, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Error connecting') Then
Begin
WriteLn('Error connecting to server');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(3300, 5500));
Continue;
End;
If (GetTextAtExWrap(250, 205, 356, 217, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Your account') Then
Begin
WriteLn('Your account is already logged in.');
Attempts:=Attempts+1;
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(7300, 15500));
Continue;
End;
If (GetTextAtExWrap(452, 330, 484, 343, 0, 5, 1, P07_outline_white, 20, 'P07UpChars') = 'PLAY') Then
Begin
WriteLn('Click To Play');
Wait(RandomRange(300, 1300));
P07_MouseBox(275, 269, 495, 377, mouse_left);
Wait(RandomRange(800, 1500));
Continue;
End;
If (GetTextAtExWrap(238, 215, 282, 227, 0, 5, 1, P07_outline_yellow, 20, 'P07UpChars') = 'Please') Then
Begin
WriteLn('Please Enter Your Username');
Wait(RandomRange(100, 500));
P07_MouseBox(395, 305, 530, 336, mouse_left);
Wait(RandomRange(100, 500));
Continue;
End;
End; Until (P07_LoggedIn) Or (Attempts > 5)
If (P07_LoggedIn) Then
Attempts:=0;
If (Attempts > 5) Then
Begin
WriteLn('Too Many Failed Login Attempts');
TerminateScript;
End;
Wait(RandomRange(1300, 2100));
End;

(*
P07_ItemExists
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_ItemExists(SlotToCheck: Integer): Boolean;

Checks if there is an Item in Inventory slot and returns true or false.
Accepts Numbers 1-28
.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_ItemExists(1) Then DoSomething();

*)
Function P07_ItemExists(SlotToCheck: Integer): Boolean;
Var
xsx,ysy,x,y,R,C:Integer;
Begin
SlotToCheck:=SlotToCheck-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToCheck/4));
R:=(SlotToCheck -(C*4));
If FindColor(x, y, P07_outline_black, xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25) Then
Begin
Result:=True;
End;
End;

(*
P07_InvFull
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InvFull: Boolean;

Checks if the player's inventory is full and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InvFull Then DoSomething();

*)
Function P07_InvFull: Boolean;
Var
C:Integer;
Begin
Result:=True;
For C:=1 To 28 Do
Begin
If (Not P07_ItemExists(C)) Then
Result:=False;
End;
End;

(*
P07_InvEmpty
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InvEmpty: Boolean;

Checks if the player's inventory is empty and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InvEmpty Then DoSomething();

*)
Function P07_InvEmpty: Boolean;
Var
C:Integer;
Begin
Result:=True;
For C:=1 To 28 Do
Begin
If P07_ItemExists(C) Then
Result:=False;
End;
End;

(*
P07_InvCount
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function P07_InvCount : Integer;

Counts Inventory Items.

.. note::

by Shatterhand

Example:

.. code-block:: pascal

Integer:=P07_InvCount;

*)
Function P07_InvCount : Integer;
Var
I : Integer;
Begin
Result := 0;
for I:=1 to 28 do
if P07_ItemExists(I) then
Inc(Result);
End;

(*
P07_GetChooseOptions
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetChooseOptions: TStringArray;

Gets current options on the right click game Choose Option pannel.

.. note::

by DannyRS

Example:

.. code-block:: pascal

UpOptions:=P07_GetChooseOptions;
For x:=0 To High(UpOptions) Do
WriteLn(UpOptions[x]);

*)
Function P07_GetChooseOptions: TStringArray;
Var
WhiteBoxT,BlueBoxT,YellowBoxT,OrangeBoxT,FoundText: String;
OptionTB:TBox;
OptionBoxTPA1: TPointArray;
NumberOfOptions,C: Integer;
Begin
FindColors(OptionBoxTPA1, 4674653, P07_MSX1, P07_MSY1, P07_ClientWidth-1, P07_ClientHeight-1);
OptionTB:=getTPABounds(OptionBoxTPA1);
If (Length(OptionBoxTPA1) < 10) Then
Begin
Exit;
End;
NumberOfOptions:=((OptionTB.Y2-2) - (OptionTB.Y1+21)) / 14;
SetLength(Result,NumberOfOptions);
For C:=0 To (NumberOfOptions-1) Do
Begin
If (OptionTB.Y1+21+(C*15)) > OptionTB.Y1+21+((C+1)*14) Then
Begin
Exit;
End;
WhiteBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16777215, 5, 'P07UpChars');
BlueBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16776960, 5, 'P07UpChars');
YellowBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 65535, 5, 'P07UpChars');
OrangeBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 4231423, 5, 'P07UpChars');
FoundText:=WhiteBoxT+' '+BlueBoxT+YellowBoxT+OrangeBoxT;
Result[C]:=Trim(FoundText);
End;
End;

(*
P07_ChooseOptionMulti
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_ChooseOptionMulti(Text: TStringArray): Boolean;

Chooses an option on the right click game Choose Option pannel.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_ChooseOptionMulti(['quickly']); - Bank

*)
Function P07_ChooseOptionMulti(Text: TStringArray): Boolean;
Var
WhiteBoxT,BlueBoxT,YellowBoxT,OrangeBoxT,FoundText: String;
OptionTB:TBox;
OptionBoxTPA1: TPointArray;
NumberOfOptions,C,X,Y: Integer;
Begin
FindColors(OptionBoxTPA1, 4674653, P07_MSX1, P07_MSY1, P07_ClientWidth-1, P07_ClientHeight-1);
OptionTB:=getTPABounds(OptionBoxTPA1);
If (Length(OptionBoxTPA1) < 10) Then
Begin
Result:=False;
Exit;
End;
NumberOfOptions:=((OptionTB.Y2-2) - (OptionTB.Y1+21)) / 14;
For C:=0 To (NumberOfOptions-1) Do
Begin
If (OptionTB.Y1+21+(C*15)) > OptionTB.Y1+21+((C+1)*14) Then
Begin
Result:=False;
Break;
End;
WhiteBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16777215, 5, 'P07UpChars');
BlueBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16776960, 5, 'P07UpChars');
YellowBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 65535, 5, 'P07UpChars');
OrangeBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 4231423, 5, 'P07UpChars');
FoundText:=WhiteBoxT+' '+BlueBoxT+YellowBoxT+OrangeBoxT;
If (P07_ContainsText(FoundText,Text)) Then
Begin
MMouse(RandomRange(OptionTB.X1+2,OptionTB.X2-2),RandomRange(OptionTB.Y1+21+(C*14),OptionTB.Y1+21+((C+1)*14)),0,0);
ClickMouse2(mouse_left);
Result:=True;
Exit;
End;
End;
GetMousePos(X,Y);
If Y > 21 Then
MMouse(RandomRange(OptionTB.X1+2,OptionTB.X2-2),RandomRange(Y-10,Y-20),0,0)
Else
MMouse(RandomRange(5,535),RandomRange(350,490),0,0);
Result:=False;
End;

(*
P07_P07_WaitOptionMulti
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_WaitOptionMulti(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.
For a set amount of time.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WaitOptionMulti(['Use', 'Bank'],RandomRange(200,300)) Then

*)
Function P07_WaitOptionMulti(Text: TStringArray; TimeOfWait: Integer): Boolean;
Var
TOWait,I,I2,L,L2: Integer;
UpOptions: TStringArray;
Begin
Result:=False;
L:=High(Text);
MarkTime(TOWait);
Repeat Begin
UpOptions:=P07_GetChooseOptions;
L2:=High(UpOptions);
For I:=0 To L Do
For I2:=0 To L2 Do
If (Pos(Text[I], UpOptions[I2]) > 0) Then
Begin
If (P07_ChooseOptionMulti(Text)) Then
Result:=True;
Exit;
End;
Wait(RandomRange(20,80));
End; Until (Result) Or (TimeFromMark(TOWait)>TimeOfWait)
End;

(*
P07_InventoryTab
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_InventoryTab(TabNumber:Integer;): Boolean;

Switches/Checks Current InventoryTab 1-14.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_TabInventoryTab(4); - Inventory

*)
Function P07_TabInventoryTab(TabNumber:Integer): Boolean;
Var
X,Y:Integer;
Begin
Result:=False;
If (Not FindColorTolerance(X,Y,13758452,600,175,620,197,16)) Then
Exit;
Case TabNumber Of
1:Begin
If (Not FindColorTolerance(X,Y,1910383,535,172,540,176,13)) Then
P07_MouseBox(533,174,552,197, mouse_left);
End;
2:Begin
If (Not FindColorTolerance(X,Y,1910383,564,172,571,176,13)) Then
P07_MouseBox(563,171,590,197, mouse_left);
End;
3:Begin
If (Not FindColorTolerance(X,Y,1910383,596,172,600,176,13)) Then
P07_MouseBox(597,171,622,197, mouse_left);
End;
4:Begin
If (Not FindColorTolerance(X,Y,1910383,630,172,635,176,13)) Then
P07_MouseBox(629,171,655,197, mouse_left);
End;
5:Begin
If (Not FindColorTolerance(X,Y,1910383,663,172,670,176,13)) Then
P07_MouseBox(662,171,688,197, mouse_left);
End;
6:Begin
If (Not FindColorTolerance(X,Y,1910383,727,172,735,176,13)) Then
P07_MouseBox(695,171,719,197, mouse_left);
End;
7:Begin
If (Not FindColorTolerance(X,Y,1910383,730,173,734,180,13)) Then
P07_MouseBox(729,175,752,197, mouse_left);
End;
8:Begin
If (Not FindColorTolerance(X,Y,1910383,525,469,534,473,13)) Then
P07_MouseBox(529,469,554,490, mouse_left);
End;
9:Begin
If (Not FindColorTolerance(X,Y,1910383,563,469,570,473,13)) Then
P07_MouseBox(564,469,587,495, mouse_left);
End;
10:Begin
If (Not FindColorTolerance(X,Y,1910383,596,469,602,473,13)) Then
P07_MouseBox(597,469,620,495, mouse_left);
End;
11:Begin
If (Not FindColorTolerance(X,Y,1910383,629,469,634,473,13)) Then
P07_MouseBox(630,469,655,495, mouse_left);
End;
12:Begin
If (Not FindColorTolerance(X,Y,1910383,662,469,669,473,13)) Then
P07_MouseBox(662,469,688,495, mouse_left);
End;
13:Begin
If (Not FindColorTolerance(X,Y,1910383,695,469,700,473,13)) Then
P07_MouseBox(697,469,720,495, mouse_left);
End;
14:Begin
If (Not FindColorTolerance(X,Y,1910383,728,469,733,473,13)) Then
P07_MouseBox(729,469,752,490, mouse_left);
End;
End;
Result:=True;
End;

(*
P07_DropInventorySlot
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropInventorySlot;

Checks if there is an Item in Inventory slot and drops it
Accepts Number 1-28

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropInventorySlot(1);

*)
Procedure P07_DropInventorySlot(SlotToDrop: Integer);
Var
xsx,ysy,R,C:Integer;
Begin
SlotToDrop:=SlotToDrop-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToDrop/4));
R:=(SlotToDrop -(C*4));
SlotToDrop:=SlotToDrop+1;
If P07_ItemExists(SlotToDrop) Then
Begin
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25, mouse_right);
P07_ChooseOptionMulti(['Drop']);
End;
End;

(*
P07_DropAll
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropAll;

Checks if there is an Item in Inventory slot and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropAll;

*)
Procedure P07_DropAll;
Var
I:Integer;
Begin
P07_TabInventoryTab(4);
For I:=1 To 28 Do
Begin
P07_DropInventorySlot(I);
Wait(RandomRange(20,90));
End;
End;

(*
P07_DropAllExcept
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DropAllExcept(SkipSlots:Array of Integer);

Drops everything in inventory. Ignores slots specified by SkipSlots array.

.. note::

by Nava2, modified by DannyRS

Example:

.. code-block:: pascal

If P07_InFull Then P07_DropAllExcept([1]);

*)
Procedure P07_DropAllExcept(SkipSlots: TIntegerArray);
Var
Inv,I,L:Integer;
Begin
P07_TabInventoryTab(4);
L:=High(SkipSlots);
For I := 0 To L Do
SkipSlots[I]:=SkipSlots[I]-1;
For I := 0 To L Do
{ Set the bit associated with the DontDrop Array }
Inv := Inv Or (1 Shl SkipSlots[I]);
For I := 0 To 27 Do
{ Check the bit at i, and if its high, then we dont drop. }
If (((Inv Shr I) And 1) = 0) Then
P07_DropInventorySlot(I+1);
End;

(*
P07_BankScreen
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_BankScreen: Boolean;

Checks if the Bank Panel is up and returns true or false.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then DoSomething();

*)
Function P07_BankScreen: Boolean;
Begin
Result:=(GetTextAtExWrap(184, 35, 243, 47, 0, 5, 1, 2070783, 10, 'P07UpChars')='The Bank');
End;

(*
P07_DepositInventorySlot
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_DepositInventorySlot(SlotToDrop: Integer; DepositAll:Boolean);

Deposits item from inventory slot.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then P07_DepositInventorySlot(1, True);

*)
Procedure P07_DepositInventorySlot(SlotToDepo: Integer; DepositAll:Boolean);
Var
xsx,ysy,R,C:Integer;
Begin
SlotToDepo:=SlotToDepo-1;
xsx:=565;
ysy:=215;
C:=(Round(SlotToDepo/4));
R:=(SlotToDepo -(C*4));
SlotToDepo:=SlotToDepo+1;
If P07_ItemExists(SlotToDepo) Then
Begin
If (DepositAll) Then
Begin
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25,mouse_right);
P07_ChooseOptionMulti(['Store All','All']);
Wait(RandomRange(300,500));
End Else
P07_MouseBox(xsx+(R*42), ysy+(C*36), xsx+(R*42)+27, ysy+(C*36)+25,mouse_left);
End;
End;

(*
P07_Deposit
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_Deposit(SlotFrom, SlotTo: Integer; DepositAll:Boolean);

Deposits items from inventory from slots int-int if bank is open.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_BankScreen Then P07_Deposit(1, 28, False);
If P07_BankScreen And P07_InvFull Then P07_Deposit(1, 28, True);

*)
Procedure P07_Deposit(SlotFrom, SlotTo: Integer; DepositAll: Boolean);
Var
I:Integer;
Begin
If (Not P07_BankScreen) Then
Exit;
For I:=SlotFrom To SlotTo Do
Begin
P07_DepositInventorySlot(I,DepositAll);
Wait(RandomRange(20,90));
End;
End;

(*
P07_MakeCameraAngleHigh
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCameraAngleHigh;

Make's The Game's Camera Angle Highest.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCameraAngleHigh;

*)
Procedure P07_MakeCameraAngleHigh;
Begin
If (Not P07_LoggedIn) Then
Exit;
KeyDown(38);
Wait(RandomRange(1800,2000));
KeyUp(38);
End;

(*
P07_MakeCameraAngleLow
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCameraAngleLow;

Make's The Game's Camera Angle Lowest.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCameraAngleLow;

*)
Procedure P07_MakeCameraAngleLow;
Begin
If (Not P07_LoggedIn) Then
Exit;
KeyDown(40);
Wait(RandomRange(1800,2000));
KeyUp(40);
End;

(*
P07_GetCompassAngle
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetCompassAngle: Integer;

Gets Compass Angle 0-360

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_GetCompassAngle

*)
Function P07_GetCompassAngle: Integer;
Var
X,Y: Integer;
AtAngle,AngleResult: Extended;
Begin
If FindDTMRotated(P07_CompassDTM,X,Y,P07_CompassX1,P07_CompassY1,P07_CompassX2,P07_CompassY2, 0, (2*Pi), Pi/180, AtAngle) Then
Begin
AngleResult:=Degrees(AtAngle);
End
Else
AngleResult:=0;
Result:=Round(AngleResult);
End;

(*
P07_MakeCompassDegree
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassDegree(MakeAngle: Integer);

Makes Compass Angle 5-355

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassDegree(5); Or P07_MakeCompassDegree(355); //North
P07_MakeCompassDegree(180); //South

*)
Procedure P07_MakeCompassDegree(MakeAngle: Integer);
Var
WaitsDone,CurAngle,CurAngleR,CurAngleL,LeftDist,RightDist,StepsL,StepsR: Integer;
KeyToHold: Word;
Begin
//LOL At How Bad This Math Is, Meh Works - Danny
WaitsDone:=0;
KeyToHold:=37;
If (Not P07_LoggedIn) Then
Exit;
CurAngle:=P07_GetCompassAngle;
CurAngleR:=CurAngle+5;
If (CurAngleR>360) Then
CurAngleR:=CurAngleR-360;
CurAngleL:=CurAngle-5;
If (CurAngleL<0) Then
CurAngleL:=(360-(CurAngleL*-1));
If (MakeAngle < 5) Then
MakeAngle:=5;
If (MakeAngle > 355) Then
MakeAngle:=355;
If (MakeAngle < CurAngleR) And (MakeAngle > CurAngleL) Then
Exit;
StepsL:=0;
LeftDist:=CurAngle;
Repeat Begin
LeftDist:=LeftDist-1;
If (LeftDist<0) Then
LeftDist:=360;
StepsL:=StepsL+1;
End; Until (LeftDist=MakeAngle)
StepsR:=0;
RightDist:=CurAngle;
Repeat Begin
RightDist:=RightDist+1;
If (RightDist>360) Then
RightDist:=0;
StepsR:=StepsR+1;
End; Until (RightDist=MakeAngle)
If StepsL > StepsR Then
KeyToHold:=39;
KeyDown(KeyToHold);
Repeat Begin
WaitsDone:=WaitsDone+1;
CurAngle:=P07_GetCompassAngle;
CurAngleR:=CurAngle+10;
If (CurAngleR>360) Then
CurAngleR:=CurAngleR-360;
CurAngleL:=CurAngle-10;
If (CurAngleL<0) Then
CurAngleL:=(360-(CurAngleL*-1));
Wait(10);
End; Until ((MakeAngle < CurAngleR) And (MakeAngle > CurAngleL)) Or (WaitsDone>700)
wait(RandomRange(10,90));
KeyUp(KeyToHold);
End;

(*
P07_MakeCompassNorth
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassNorth;

Make's Compass North.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassNorth;

*)
Procedure P07_MakeCompassNorth;
Var
CurAngle: Integer;
Begin
If (Not P07_LoggedIn) Then
Exit;
CurAngle:=P07_GetCompassAngle;
If CurAngle > 180 Then
P07_MakeCompassDegree(355)
Else
P07_MakeCompassDegree(5);
End;

(*
P07_MakeCompassEast
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassEast;

Make's Compass East.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassEast;

*)
Procedure P07_MakeCompassEast;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(270);
End;

(*
P07_MakeCompassWest
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassWest;

Make's Compass West.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassWest;

*)
Procedure P07_MakeCompassWest;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(90);
End;

(*
P07_MakeCompassSouth
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MakeCompassSouth;

Make's Compass South.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_MakeCompassSouth;

*)
Procedure P07_MakeCompassSouth;
Begin
If (Not P07_LoggedIn) Then
Exit;
P07_MakeCompassDegree(180);
End;

(*
P07_FindMMFlag
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_FindMMFlag: Boolean;

Checks if the red flag on the minimap is there

.. note::

by DannyRS

Example:

.. code-block:: pascal

If (Not P07_FindMMFlag) Then

*)
Function P07_FindMMFlag: Boolean;
Var
X,Y: Integer;
Begin
Result:=(FindDTM(P07_FlagDTM,X,Y,P07_MMX1,P07_MMY1,P07_MMX2,P07_MMY2));
End;

(*
P07_FFlag
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_FFlag;

Waits till the red flag on the minimap is gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

Click; P07_FFlag; Click;

*)
Procedure P07_FFlag;
Var
WaitsDone: Integer;
Begin
Repeat Begin
If (Not P07_FindMMFlag) Then
Begin
Exit;
End;
Wait(RandomRange(50,100));
WaitsDone:=WaitsDone+1;
End; Until (WaitsDone > 800)
End;

(*
P07_MMToMSPoint
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

procedure P07_MMToMSPoint(var X, Y : Integer);

Converts a Minimap point to a MainScreen Point

.. note::

by Shatterhand

Example:

.. code-block:: pascal

P07_MMToMSPoint(X,Y);

*)
procedure P07_MMToMSPoint(var X, Y : Integer);
var
x1, y1 : Integer;
begin
x1 := X;
y1 := X;

X := Round((X-P07_MMCX)*255/40) + P07_MSCX;
Y := Round((Y-P07_MMCY)*176/28) + P07_MSCY;

if X < MSX1 then X := MSX1;
if Y < MSY1 then Y := MSY1;
if X > MSX2 then X := MSX2;
if Y > MSY2 then Y := MSY2;
end;

(*
P07_FindObjEx
~~~~~~~~~

.. code-block:: pascal

function P07_FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;

Searches for an object using an array of colors and texts within the area
you specify. Will start searching from the middle and returns true if found.
Parameters:

- cx, cy: Coordinate Position of object if result is true
- Text: Array of string you want to search for
- Color: Array of colors you want to search for
- Tol: Tolerance of the colors you will allow
- Step: How big you want to make the search squares.
50 = Default. 30-70 Recommended
- xs, ys, xe, ye: Bounds you want to search in

.. note::

by Starblaster100, Modified by DannyRS


Example:

.. code-block:: pascal

*)
function P07_FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
var
MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
ColorFound: Boolean;
SearchBoxes: Array of Array of TBox;
p: TPointArray;
begin
Result := False;

//check for all the colors
for i := 0 to (GetArrayLength(Color)-1) do
if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
begin
ColorFound := True;
Break;
end;

if not(ColorFound) then
Exit; //None of the colors could be found on screen

//Start coordinates
MidX := Round((xe - xs) / 2);
MidY := Round((ye - ys) / 2);

//width and height in boxes
Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;

SetLength(SearchBoxes, Width);

//Getting mid of screen in boxes, not pixels
HalfWidth := Floor(Width / 2);
HalfHeight := Floor(Height / 2)

//Create the search boxes, starting in mid because of backwards compatibility
for x := -1 * HalfWidth to HalfWidth do
begin
SetLength(SearchBoxes[x + HalfWidth], Height);
for y := -1 * HalfHeight to HalfHeight do
SearchBoxes[x + HalfWidth][y + HalfHeight] := IntToBox(
Max(xs, xs + Round(MidX + ((x - 0.5) * Step))),
Max(ys, ys + Round(MidY + ((y - 0.5) * Step))),
Min(xe, xs + Round(MidX + ((x + 0.5) * Step))),
Min(ye, ys + Round(MidY + ((y + 0.5) * Step))));
end;

//Create a TPA, where points are representing the boxes
p := TPAFromBox(IntToBox(0, 0, Width-1, Height-1));

//Sort thid TPA from the middle to get a spiral like effect
SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));

//Loop through the boxes, searching for the object (the k and j loop might be better to switch though)
for k := 0 to High(Color) do
for j := 0 to High(p) do
begin
if (FindColorTolerance(cx, cy, Color[k], SearchBoxes[p[j].x][p[j].y].x1,
SearchBoxes[p[j].x][p[j].y].y1, SearchBoxes[p[j].x][p[j].y].x2,
SearchBoxes[p[j].x][p[j].y].y2, Tol)) then
begin
MMouse(RandomRange(cx-2,cx+2), RandomRange(cy-2,cy+2), 0, 0);
Wait(RandomRange(30,90));
If P07_IsUpTextMultiCustom(Text) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end;
end;
end;
end;

(*
P07_FindObj
~~~~~~~

.. code-block:: pascal


function P07_FindObj(var cx, cy: Integer; Text: string; Color, Tol: Integer): Boolean;

Finds Object

.. note::

by Starblaster100, Modified by DannyRS

Example:

.. code-block:: pascal

If P07_FindObj(x, y, 'Talk', 3040587, 10) Then
ClickMouse2(mouse_left);

*)
function P07_FindObj(var cx, cy: Integer; Text: string; Color: Integer; Tol: Integer): Boolean;
begin
Result := P07_FindObjEx(cx, cy, [Text], [Color], Tol, 50, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2);
end;

(*
P07_FindObjCustom
~~~~~~~~~~~~~

.. code-block:: pascal

function P07_FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

Finds Object with custom amount of colors and custom amount of Uptext

.. note::

by Starblaster100, Modified by DannyRS

Example:

.. code-block:: pascal

If P07_FindObjCustom(x, y, ['Attack', 'MonsterName'], [123456, 345678], 5) Then
ClickMouse2(mouse_left);

*)
function P07_FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;
begin
Result := P07_FindObjEx(cx, cy, Text, Color, Tol, 50, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2);
end;

(*
P07_HoverSkill
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_HoverSkill(SkillName: String; HoverTime: Integer);

Hovers over a chosen Skill in skill panel for an amount of time

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_HoverSkill('random',RandomRange(2500,3500));

*)
Procedure P07_HoverSkill(SkillName: String; HoverTime: Integer);
Var
RowN,ColN,RandomXN,RandomYN: Integer;
Begin
RowN:=0; ColN:=0;
RandomXN:=RandomRange(0,3);
RandomYN:=RandomRange(0,8);
If ((RandomXN=3) And (RandomYN=7)) Then
RandomXN:=RandomRange(0,2);
If Not P07_TabInventoryTab(2) Then
Exit;
Case Lowercase(SkillName) Of
'attack': Begin RowN:=0; ColN:=0; End;
'hitpoints': Begin RowN:=1; ColN:=0; End;
'mining': Begin RowN:=2; ColN:=0; End;
'strength': Begin RowN:=0; ColN:=1; End;
'agility': Begin RowN:=1; ColN:=1; End;
'smithing': Begin RowN:=2; ColN:=1; End;
'defence': Begin RowN:=0; ColN:=2; End;
'herblore': Begin RowN:=1; ColN:=2; End;
'fishing': Begin RowN:=2; ColN:=2; End;
'ranged': Begin RowN:=0; ColN:=3; End;
'thieving': Begin RowN:=1; ColN:=3; End;
'cooking': Begin RowN:=2; ColN:=3; End;
'prayer': Begin RowN:=0; ColN:=4; End;
'crafting': Begin RowN:=1; ColN:=4; End;
'firemaking': Begin RowN:=2; ColN:=4; End;
'magic': Begin RowN:=0; ColN:=5; End;
'fletching': Begin RowN:=1; ColN:=5; End;
'woodcutting': Begin RowN:=2; ColN:=5; End;
'runecrafting': Begin RowN:=0; ColN:=6; End;
'slayer': Begin RowN:=1; ColN:=6; End;
'farming': Begin RowN:=2; ColN:=6; End;
'construction': Begin RowN:=0; ColN:=7; End;
'hunter': Begin RowN:=1; ColN:=7; End;
'random': Begin RowN:=RandomXN; ColN:=RandomYN; End;
End;
MMouse(550+(RowN*63),210+(ColN*31),54,25);
Wait(HoverTime);
P07_TabInventoryTab(4);
End;

(*
P07_DidClick
~~~~~~~~~~~~~

.. code-block:: pascal

function P07_DidClick(Red: Boolean; Time: integer): boolean;

Checks if player clicked screen

.. note::

by Justin

Example:

.. code-block:: pascal

Result := P07_DidClick(true, 1000);

*)
function P07_DidClick(Red: Boolean; Time: integer): boolean;
var
TimeOut, x, y, w, h, R, G: integer;
B: TBox;
begin
GetMousePos(x, y);
GetClientDimensions(w, h);
B := IntToBox(x - 15, y - 15, x + 15, y + 15);
if B.x1 < 0 then B.x1 := 0;
if B.y1 < 0 then B.y1 := 0;
if B.x2 > w then B.x2 := w;
if B.y2 > h then B.y2 := h;
TimeOut := GetSystemTime + Time;
while (GetSystemTime < TimeOut) do
begin
R := CountColorTolerance(255, B.x1, B.y1, B.x2, B.y2, 15);
G := CountColorTolerance(65535, B.x1, B.y1, B.x2, B.y2, 15);
if Red then
begin
if (G > 8) then
Exit;
Result := (R > 20);
end else
begin
if (R > 5) then
Exit;
Result := (G > 35);
end;
if Result then
Exit;
end;
end;
//Checks if player click was Red, by Justin
function P07_DidRedClick: Boolean;
begin
Result := P07_DidClick(true, 1000);
end;
//Checks if player click was Yellow, by Justin
function P07_DidYellowClick: Boolean;
begin
Result := P07_DidClick(false, 1000);
end;

(*
P07_ClickToContinue
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_ClickToContinue;

Clicks ClickToContinue ChatText Till Gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_ClickToContinue;

*)
Procedure P07_ClickToContinue;
Var
X,Y,TOTimer: Integer;
Begin
If FindDTM(P07_CTCDTM1,X,Y,225,440,385,460) Then
Begin
MarkTime(TOTimer);
P07_MouseBox(236, 447, 375, 454, mouse_left);
Repeat Begin
If FindDTM(P07_CTCDTM1,X,Y,225,440,385,460) Or
FindColor(X,Y,P07_outline_white,225,440,385,460) Then
P07_MouseBox(236, 447, 375, 454, mouse_left);
Wait(RandomRange(100,400));
End; Until (Not FindDTM(P07_CTCDTM1,X,Y,225,440,385,460)) And
(Not FindColor(X,Y,P07_outline_white,225,440,385,460)) And
(Not FindDTM(P07_CTCDTM2,X,Y,225,440,385,460)) Or
(TimeFromMark(TOTimer)>30000)
End;
End;

(*
P07_CastSpell
~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_CastSpell(SpellNumber: Integer): Boolean;

Clicks ClickToContinue ChatText Till Gone

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_CastSpell(1) Then //HomePort
Wait(RandomRange(5000,6000));

*)
Function P07_CastSpell(SpellNumber: Integer): Boolean;
Var
xsx,ysy,R,C: Integer;
Begin
Result:=False;
If ((SpellNumber<1) Or (SpellNumber>63)) Then
Exit;
xsx:=565;
ysy:=233;
SpellNumber:=SpellNumber-1;
C:=(Round(SpellNumber/7));
R:=(SpellNumber -(C*7));
If P07_TabInventoryTab(7) Then
Begin
P07_MouseBox(xsx+(R*24), ysy+(C*24), xsx+(R*24)+10, ysy+(C*24)+10,mouse_left);
Result:=True;
End;
End;

(*
P07_AutoRetaliate
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_AutoRetaliate(ToggleTo: Boolean);

Toggles AutoRetaliate On / Off

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_AutoRetaliate(True);

*)
Procedure P07_AutoRetaliate(ToggleTo: Boolean);
Begin
If (Not P07_TabInventoryTab(1)) Then Exit;
If (Not ToggleTo) And (GetTextAtExWrap(644, 379, 667, 392, 0, 5, 1, P07_outline_orange, 20, 'P07UpChars') = '(On)')
Then
P07_MouseBox(572, 362, 713, 397, mouse_left)
Else If (ToggleTo) And
(GetTextAtExWrap(642, 379, 670, 394, 0, 5, 1, P07_outline_orange, 20, 'P07UpChars') = '(Off)')
Then
P07_MouseBox(572, 362, 713, 397, mouse_left);
End;

(*
P07_CombatStance
~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_CombatStance(ToggleToNum: Integer);

Toggles Combat Stance, Range 1-4.

.. note::

by DannyRS

Example:

.. code-block:: pascal

P07_CombatStance(1); //AttackXp

*)
Procedure P07_CombatStance(ToggleToNum: Integer);
Var
X,Y: Integer;
Begin
If (Not P07_TabInventoryTab(1)) Then Exit;
If (ToggleToNum=1) And
(Not FindColorTolerance(X,Y,1974408,572,255,631,290,30)) Then
P07_MouseBox(572,255,631,290, mouse_left);
If (ToggleToNum=2) And
(Not FindColorTolerance(X,Y,1974408,656,255,715,290,30)) Then
P07_MouseBox(656,255,715,290, mouse_left);
If (ToggleToNum=3) And
(Not FindColorTolerance(X,Y,1974408,572,308,631,343,30)) Then
P07_MouseBox(572,308,631,343, mouse_left);
If (ToggleToNum=4) And
(Not FindColorTolerance(X,Y,1974408,655,308,714,343,30)) Then
P07_MouseBox(655,308,714,343, mouse_left);
End;

(*
P07_GetEquippedItemBounds
~~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetEquippedItemBounds(EquipSlot: Integer): TBox;

Returns TBox of the specified equipment slot

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_GetEquippedItemBounds(EquipSlot: Integer): TBox;
Begin
Result := IntToBox(0, 0, 0, 0);
Case EquipSlot Of
1: Result := IntToBox(629, 213, 656, 240);
2: Result := IntToBox(588, 252, 615, 279);
3: Result := IntToBox(629, 252, 656, 279);
4: Result := IntToBox(670, 252, 697, 279);
5: Result := IntToBox(573, 291, 600, 318);
6: Result := IntToBox(629, 291, 656, 318);
7: Result := IntToBox(685, 291, 712, 318);
8: Result := IntToBox(629, 331, 656, 358);
9: Result := IntToBox(573, 371, 600, 398);
10: Result := IntToBox(629, 371, 656, 398);
11: Result := IntToBox(685, 371, 712, 398);
End;
End;

(*
P07_MouseEquippedItem
~~~~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure P07_MouseEquippedItem(EquipSlot: Integer; ClickType: Integer);

Mouses an equipped item slot.

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Procedure P07_MouseEquippedItem(EquipSlot: Integer; ClickType: Integer);
Var
B : TBox;
Begin
B := P07_GetEquippedItemBounds(EquipSlot);
If (B.x1 = 0) And (B.x2 = 0) Then Exit;
If P07_TabInventoryTab(5) Then
P07_MouseBox(B.X1, B.Y1, B.X2, B.Y2, ClickType);
End;

(*
P07_WearingItem
~~~~~~~~~~~

.. code-block:: pascal

Function P07_WearingItem(I: Integer): Boolean;

Results True if an item is equipped at equpiment slot defined by I.
Range 1-11.

.. note::

by DannyRS

Example:

.. code-block:: pascal

If P07_WearingItem(1) Then
*)
Function P07_WearingItem(I: Integer): Boolean;
Var
X, Y: Integer;
TB: TBox;
Begin
Result := False;
If (Not InRange(I, 1, 11)) Then Exit;
If (Not P07_TabInventoryTab(5)) Then Exit;
TB := P07_GetEquippedItemBounds(I);
Result := FindColor(X, Y, P07_Outline_Black, TB.X1, TB.Y1, TB.X2, TB.Y2);
End;

(*
P07_GetMiniMapDots
~~~~~~~~~~~~~~

.. code-block:: pascal

Function P07_GetMiniMapDots(WhatDotCol: String): TPointArray;

Results the dots specified by WhatDot on the Minimap. See `GetMiniMapDotsIn`
for more information.


.. note::

by Nava2, Modded by DannyRS

Example:

.. code-block:: pascal

// print the minimap positions on the debug canvas
DebugTPA(P07_GetMiniMapDots('white'));

*)
Function P07_GetMiniMapDots(WhatDotCol: String): TPointArray;
Begin
Result:=(GetMiniMapDotsIn(WhatDotCol, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2));
End;

(*
P07_CountMiniMapDots
~~~~~~~~~~~

.. code-block:: pascal

Function P07_CountMiniMapDots(WhatDotCol: String): Integer;

Returns Integer of number of dots on minimap.

.. note::

by DannyRS

Example:

.. code-block:: pascal

*)
Function P07_CountMiniMapDots(WhatDotCol: String): Integer;
Begin
Result:=Length(P07_GetMiniMapDots(WhatDotCol));
End;

Procedure P07_SetGlobals;
Begin
If P07_AutoUpdateInclude Then
P07_AutoUpdateMe;

GetClientDimensions(P07_ClientWidth,P07_ClientHeight);

P07_MSX1:=4;
P07_MSX2:=515;
P07_MSY1:=4;
P07_MSY2:=337;
P07_MIX1:=552;
P07_MIX2:=731;
P07_MIY1:=207;
P07_MIY2:=464;
P07_MMX1:=570;
P07_MMX2:=714;
P07_MMY1:=9;
P07_MMY2:=159;
P07_CompassX1:=544;
P07_CompassX2:=577;
P07_CompassY1:=3;
P07_CompassY2:=36;

P07_MSCX:=(((P07_MSX2-P07_MSX1)/2)+P07_MSX1);
P07_MSCY:=(((P07_MSY2-P07_MSY1)/2)+P07_MSY1);
P07_MICX:=(((P07_MIY2-P07_MIY1)/2)+P07_MIY1);
P07_MICY:=(((P07_MIY2-P07_MIY1)/2)+P07_MIY1);
P07_MMCX:=648;
P07_MMCY:=83;

P07_outline_black:=65536;
P07_outline_white:=16777215;
P07_outline_blue:=16711680;
P07_outline_yellow:=65535;
P07_outline_orange:=2070783;

If P07_MouseSpeed > 0 Then
MouseSpeed:=P07_MouseSpeed
Else
MouseSpeed:=15;

P07_PName:=P07_PlayerName;
P07_PPass:=P07_PlayerPass;

P07_CompassDTM:=DTMFromString('mbQAAAHicY2VgYDBkgmBVILYHYiMgFgaKCwCxKBCLALEiEG91cALj+Tx8cGwEFEfHjFgwGAAAss4HDQ==');
P07_FlagDTM:=DTMFromString('mWAAAAHicY2FgYNjCxMCwDog3MkHYXgwQ7A7ELkD8Hw2jA0Y0DAIA2fcH8w==');
P07_CTCDTM1:=DTMFromString('mFQEAAHic42VgYOBjZGBQA2ITIM4B4gogbgTiTiCeBMTTgHguEEsAsTEQxwKxHhNhbIyGGRj+k4FJB4xkYBQAAN/kFGI=');
P07_CTCDTM2:=DTMFromString('m1gAAAHic42JgYOBkgmAhIPYBYjEg1gJiFyAOAOIQII4AYnMgdoDS1kBsD8W2SGwQZmD4TyQmDjASiREAAD31DoQ=');
End;

Procedure P07_FreeGlobals;
Begin
//FreeBitmap();
//FreeDTM();
FreeDTM(P07_CompassDTM);
FreeDTM(P07_FlagDTM);
FreeDTM(P07_CTCDTM1);
FreeDTM(P07_CTCDTM2);
End;

Procedure SetupP07Include;
Begin
P07_SetGlobals;
AddOnTerminate('P07_FreeGlobals');

{$IFDEF SMART}
SRL_EnableNavBar;
{$ENDIF}

End;


Why are you trying to compile the include? don't know what you are expecting from that.
The MMouse function is defined in the SRL. You need to include that.
If you were compiling CurseRelease, then you didn't include SRL.simba.
If you were compiling the P07Include, then that doesn't have a main function, it's a library, it doesn't have any main function/procedure. Go read a tutorial.

obsessive

2013-02-27 10:14:11

From: pija
Why are you trying to compile the include? don't know what you are expecting from that.
The MMouse function is defined in the SRL. You need to include that.
If you were compiling CurseRelease, then you didn't include SRL.simba.
If you were compiling the P07Include, then that doesn't have a main function, it's a library, it doesn't have any main function/procedure. Go read a tutorial.


I've learnt my mistakes and fixed these problems.
Now I just get:

"Local : 1.7 / Latest : 1.7
You Have The Latest Version of P07Include
Clicking curse
Error: Exception: Font [P07UpChars] not found. at line 108
The following DTMs were not freed: [0, 1, 2, 3]
"

and the script stops after It clicks the curse.

line 108 = the white one:

Begin
WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'P07UpChars');
BlueT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars');
YellowT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 1235160, 40, 'P07UpChars');

pija

2013-02-27 10:52:07

From: obsessive
I've learnt my mistakes and fixed these problems.
Now I just get:

"Local : 1.7 / Latest : 1.7
You Have The Latest Version of P07Include
Clicking curse
Error: Exception: Font [P07UpChars] not found. at line 108
The following DTMs were not freed: [0, 1, 2, 3]
"

and the script stops after It clicks the curse.

line 108 = the white one:

Begin
WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'P07UpChars');
BlueT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars');
YellowT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 1235160, 40, 'P07UpChars');

DannyRS released upchars for 07, he released it with his include. Set them up on the fonts folder.

Kevin

2013-02-27 12:06:11

From: obsessive
I've learnt my mistakes and fixed these problems.
Now I just get:

"Local : 1.7 / Latest : 1.7
You Have The Latest Version of P07Include
Clicking curse
Error: Exception: Font [P07UpChars] not found. at line 108
The following DTMs were not freed: [0, 1, 2, 3]
"

and the script stops after It clicks the curse.

line 108 = the white one:

Begin
WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'P07UpChars');
BlueT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars');
YellowT:=GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 1235160, 40, 'P07UpChars');


Like pija says, you're missing the UpChars font file needed for this. It was included in the same post as the include itself and I believe it's part of the instructions to download and where to place it.

From: pija
DannyRS released upchars for 07, he released it with his include. Set them up on the fonts folder.


Very good job man having your first few posts being helpful and proving you've done some reading up yourself before just asking away! :)

DannyRS

2013-02-27 12:09:07

You need to download and extract the font's folder, then move it into Simba/Fonts,

Also do not try to Run/Compile the Include, it will not work ;) it will only work in a script,

And Goodjob Pija :)

wimpie2001

2013-02-27 16:03:51

yes good job thsi helped me alot, bit by bit we'r getting there :D

Duchx2

2013-03-05 16:11:53

WhiteBoxT:=GetTextAtExWrap(OptionTB.X1+2, OptionTB.Y1+21+(C*15), OptionTB.X2-2, OptionTB.Y1+21+((C+1)*14), 0, 5, 1, 16777215, 5, 'P07UpChars'); i got this probleme