ScriptUO

Scripting Resources & Utilities => Stealth Client => Topic started by: epsilon2 on November 10, 2016, 11:51:15 PM

Title: [6.7.0 pascal] how does context menuehook works?
Post by: epsilon2 on November 10, 2016, 11:51:15 PM
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?

Title: Re: [6.7.0 pascal] how does context menuehook works?
Post by: Crome969 on November 11, 2016, 12:09:13 AM
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.