Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

[6.7.0 pascal] how does context menuehook works?

Ask for help
Post Reply
epsilon2
Neophyte
Neophyte
Posts: 19
Joined: 15.08.2016 20:41

[6.7.0 pascal] how does context menuehook works?

Post by epsilon2 »

Code: Select all

function GetBod(Shop: String; Debug: String):Integer;
var
list2      : TStringList;
UserList   : TStringList;
i          : integer;
x          : integer;
text       : String;

begin
ClearShopList;
ClearContextMenu;
FindDistance:= 3;
FindVertical:= 3;
list2 := TStringList.Create;
FindType($0190,Ground);
wait(100);
UserList := TStringList.Create;
GetFindedList(UserList);
for i:= 0 to UserList.count -1 do
begin
    text := GetTooltip(StrToInt('$'+UserList[i])); 
    if Debug = 'True' then
    begin
        FillNewWindow('Chars around: ' + text+ '  $' + UserList[i]);
    end;
    if  (pos(Shop, text)>0) and (pos('guildmaster', text)=0) then
    begin
        if Debug = 'True' then
        begin
            FillNewWindow('My Shop found at: ' + InttoStr(i));
        end;
        ClearContextMenu;
        RequestContextMenu(StrtoInt('$'+UserList[i]));
        wait(1000);        
        GetContextMenu(list2);
        for x:= 0 to list2.count-1 do
        begin
            if Debug = 'True' then
            begin
                FillNewWindow('Shops ContextMenue: ' + list2[x]);
            end;
            if  (pos('Bulk Order Info', list2[x])>0) then
            begin
                if Debug = 'True' then
                begin
                    FillNewWindow('Shops ContextMenue entry at: ' + InttoStr(x));
                end;
                SetContextMenuHook(StrToInt('$'+UserList[i]), x);
                wait(1000);                    
            end;
            ClearShopList;
        end;
        ClearContextMenu;        
    end;
end;                                                                
UserList.free;
list2.free;

  Result := 1;
end;
SetContextMenuHook(StrToInt('$'+UserList), x); do not work every time.

can you explain me?
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: [6.7.0 pascal] how does context menuehook works?

Post by Vizit0r »

what explanation do you want to read?
looks like you make correct action.

If you can repeat this - give me packet with context menu (0xBF with 0x14 subcommand) and your action.
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
Post Reply