sirlaughsalot
2009-02-16 11:59:30
These are just some functions I have made over my career.
Color
General
Reflection
Banking
General
{*******************************************************************************
Function EnterAmount: Boolean;
By: Sirlaughsalot
Description: Checks for EnterAmount in the chat box
*******************************************************************************}
Function EnterAmount: Boolean;
begin
Result := FindTextTPA(0,0,MCx1,Mcy1,MCx2,MCy2, 'nter', UpChars, Nothing);
end;Reflection
Banking
{*******************************************************************************
Procedure R_DepositAllExcept(What:Integer);
By: Sirlaughsalot
Description: Deposits everything expcept the specified ID
*******************************************************************************}
Procedure R_DepositAllExcept(What:Integer);
var
huh : Tpoint;
Item: TInvItem;
begin
For i:=0 to 28 do
begin
Item:=GetInvItemInfo(i);
if (Item.ID<>What) and (Item.ID>0) then
begin
Huh:=ItemCoords(i);
Mouse(huh.x,huh.y,5,5,False);
Wait(400+random(300));
ChooseOption('ll');
end;
end;
end;
{*******************************************************************************
Procedure IsInBank(What: TBankSlot; var WhatSlot : Integer) : Boolean;
By: Sirlaughsalot
Description: Checks if an item is in the bank and returns the slot
*******************************************************************************}
Function IsInBank(What : TBankSlot; var WhatSlot : Integer) : Boolean;
Var
I : integer;
BankAr : TBankSlotArray;
begin
if not R_BankScreen then exit;
BankAr:=GetBankArray;
For i:=0 to High(BankAr) do
begin
if (BankAr[i].ID=What.ID) or (BankAr[i].Name=What.Name) then Result:=True;
WhatSlot:=BankAr[i].Index;
Writeln(IntToStr(WhatSlot));
if Result then Exit;
end;
end;
{*******************************************************************************
Procedure R_SearchBank(WhatFor: Integer; var ItemName : String) : Boolean;
By: Sirlaughsalot
Description: Searches the bank for the item with the specified ID and returns
the name
*******************************************************************************}
Function R_SearchBank(WhatFor : Integer; var ItemName : String) : Boolean;
var
Ind : Integer;
Item : TBankSlot;
begin
if BankScreen then
begin
Item.ID:=WhatFor;
if IsInBank(Item, Ind) then
begin
Writeln(IntToStr(Ind));
Item:=GetBankSlot(Ind)
ItemName:=Item.Name;
Writeln(Item.Name);
SearchBank(Item.Name);
Result:=True;
Writeln(BoolToStr(Result));
end;
end;
end;
{*******************************************************************************
Procedure WithdrawItem(What: Integer; Option, IfX : String) : Boolean;
By: Sirlaughsalot
Description: Tries to withdraw the specified item via ID, Option is for
ChooseOption, IfX is how many to withdraw if Option is X
*******************************************************************************}
Function WithdrawItem(What : Integer; Option, IfX : String) : Boolean;
var
x, y, i : integer;
Slot : TBox;
Name : String;
Invent : TIntegerArray;
begin
if R_SearchBank(What, Name) then
begin
For i:=1 to 50 do
begin
Slot:=BankIndexToMSBox(i);
MouseBox(Slot.x1,Slot.y1,Slot.x2,Slot.y2,3);
GetMousePos(x,y);
Delete(Name,1,1);
Wait(200+random(200));
if IsUpText(Name) then
begin
Mouse(x,y,0,0,False);
ChooseOption(Option);
if LowerCase(Option)='x' then
begin
Wait(500+Random(400));//Edit later
if FindTextTPA(0,0,MCx1,Mcy1,MCx2,MCy2, 'nter', UpChars, Nothing) then
TypeSend(IfX);
end;
Wait(500+random(500));
end;
if (InventoryContains(What+1, Invent)) or (InventoryContains(What+2, Invent)) then
begin
Result:=True
exit;
end;
end;
end;
end;