Author Topic: [6.7.0 pascal] a simple sell function  (Read 3238 times)

0 Members and 1 Guest are viewing this topic.

Offline epsilon2Topic starter

  • Jr. Member
  • **
  • Posts: 36
  • Activity:
    0%
  • Reputation Power: 1
  • epsilon2 has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
[6.7.0 pascal] a simple sell function
« on: October 17, 2016, 07:50:44 AM »
0
Code: [Select]
function SellItems(Shop: String; Item: Cardinal; Amount: Integer; Debug : Integer): Integer;

var
i          : integer;
x          : integer;
list2      : TStringList;
UserList   : TStringList;
begin
ClearShopList;
SetAutoSellDelay($0001);
AutoSell(Item,$0000,Amount);
FindDistance:= 9;
FindVertical:= 9;
list2 := TStringList.Create;
FindType($0190,Ground);
wait(100);
UserList := TStringList.Create;
GetFindedList(UserList);
for i:= 0 to UserList.count -1 do
begin
    if Debug = 1 then
    begin
        FillNewWindow('Chars around: ' + GetTooltip(StrToInt('$'+UserList[i]))+ '  $' + UserList[i]);
    end;
    if  0 < pos(Shop, GetTooltip(StrtoInt('$'+UserList[i]))) then
    begin
        if Debug = 1 then
        begin
            FillNewWindow('My Shop found at: ' + InttoStr(i));
        end;
        ClearContextMenu;
        RequestContextMenu(StrtoInt('$'+UserList[i]));
        wait(1000);       
        GetContextMenu(list2);
        for x:= 1 to list2.count do
        begin
            if Debug = 1 then
            begin
                FillNewWindow('Shops ContextMenue: ' + list2[x]);
            end;
            if  0 < pos('Sell', list2[x]) then
            begin
                if Debug = 1 then
                begin
                    FillNewWindow('Shops ContextMenue entry at: ' + InttoStr(x));
                end;
                SetContextMenuHook(StrToInt('$'+UserList[i]), x);                   
            end;
            ClearShopList;
        end;
        ClearContextMenu;       
    end;
end;
UserList.free;
list2.free;
result := 1;

end;

Tags: