Author Topic: [6.7.0 pascal] how does context menuehook works?  (Read 3245 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] how does context menuehook works?
« on: November 10, 2016, 11:51:15 PM »
0
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));
    if Debug = 'True' then
    begin
        FillNewWindow('Chars around: ' + text+ '  $' + UserList);
    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));
        wait(1000);        
        GetContextMenu(list2);
        for x:= 0 to list2.count-1 do
        begin
            if Debug = 'True' then
            begin
                FillNewWindow('Shops ContextMenue: ' + list2
  • );

            end;
            if  (pos('Bulk Order Info', list2
  • )>0) then

            begin
                if Debug = 'True' then
                begin
                    FillNewWindow('Shops ContextMenue entry at: ' + InttoStr(x));
                end;
                SetContextMenuHook(StrToInt('$'+UserList), 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?

« Last Edit: November 10, 2016, 11:53:15 PM by epsilon2 »

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: [6.7.0 pascal] how does context menuehook works?
« Reply #1 on: November 11, 2016, 12:09:13 AM »
0
You might check https://github.com/Crome696/ScriptSDK/blob/master/ScriptSDK/Attributes/Context%20Menu/ContextMenu.cs its in c# but shows how i hook context menus. You hook it before you use and then use it. and when you are done using you need to kill the hook, else it will use same hook until it get overwritten.

Tags: