Program ContexMenu;
var
i : integer;
npc : cardinal;
begin
FindDistance := 1;
npc := FindType($0191,ground); //female npc
RequestContextMenu(npc);
SetContextMenuHook(npc, 0);
end.
i try 398 times with 1 char, but when i changed the char, in the first try i haved success.
when i use the Razor, no matter the char, aways it works. i doing some things wrong in the stealth?
Re: how can i use SetContextMenuHook?
Posted: 01.05.2019 19:55
by GeeZeR
try to swap RequestContextMenu(npc); and SetContextMenuHook(npc, 0);, i use this code in a loop and it always works:
i thing my shard has a problem, some times i get contextmenu with click in the npc, some times not. but even when i can't get the menu by clicking on npc, Razor contextmenu still works.
i don't know if its important, but when i can't get the npc menu (manually) clicking in the npc, SetContextMenuHook() don´t works, when i get the menu (manually) clicking in the npc, SetContextMenuHook() works
Re: how can i use SetContextMenuHook?
Posted: 01.05.2019 22:09
by GeeZeR
yea i've noticed that too, try to play with those commands using checklag. I didn't research this feature a lot. My code works well in my case.
Re: how can i use SetContextMenuHook?
Posted: 01.05.2019 22:43
by GeeZeR
Sometimes Stealth commands reacts on a menu appearance but the menu items are not present at that moment because of lag and they appear a bit later. Try to use some simple loop checking if the menu items are present (GetContextMenu). http://stealth.od.ua/Doc:Manual/Reference/ContextMenu
Re: how can i use SetContextMenuHook?
Posted: 01.05.2019 23:21
by 01101011
when ContextMenu its works the script return all context, but when ContextMenu not works, the script return nothing
Program ContexMenu;
var
MenuList : TStringList;
i : integer;
npc : cardinal;
{$Include 'CheckLag.inc'}
begin
CheckLag;
FindDistance := 2:
npc := FindType($0191,ground); //female npc
SetContextMenuHook(npc, 0);
RequestContextMenu(npc);
MenuList := TStringList.Create;
GetContextMenu(MenuList);
for i := 0 to MenuList.Count-1 do
begin
addtosystemjournal(MenuList[i]);
end;
MenuList.Free;
ClearContextMenu;
end.
the problem is the shard with stealth, some times SetContextMenuHook() its works, but after few minutes stop working. but i think having solution, because Razor contextmenuaction aways works
Re: how can i use SetContextMenuHook?
Posted: 02.05.2019 3:18
by 01101011
Log when i click on NPC to open Context Menu (manual click).
Program test;
var
MenuList : TStringList;
i : integer;
npc : cardinal;
begin
FindDistance := 4;
npc := FindType($0191,ground); //female npc
MenuList := TStringList.Create;
SetContextMenuHook(npc, 0);
RequestContextMenu(npc);
GetContextMenu(MenuList);
for i := 0 to MenuList.Count-1 do begin
addtosystemjournal(MenuList[i]);
end;
MenuList.Free;
ClearContextMenu;
end.
i can't use ContextMenu anymore, stopped working with all chars, i think when my shard restart the "contextmenu" will work again for one more time with all chars =[
any way to integrate Razor+Stealth?
Re: how can i use SetContextMenuHook?
Posted: 11.05.2019 11:11
by Vizit0r
Whats mean "restart"?
Anyway, give packets for ladt menu, which is not works.
Re: how can i use SetContextMenuHook?
Posted: 11.05.2019 15:09
by 01101011
restart = like a shutdown and turn on again to debug the shard.
i think my shard doesn't work well with contextmenu, even without using stealth, some times i can't get npc menucontext with click.
Re: how can i use SetContextMenuHook?
Posted: 15.05.2019 14:16
by Vizit0r
strange shard
Re: how can i use SetContextMenuHook?
Posted: 13.05.2020 12:22
by 01101011
hi guys, sorry for "An Corp" topic, but i find the error =]]
my shard don't use the right way to use menucontext, i go do exemplo:
in razor:
Assistant.Macro.ContextMenu|0x0G8D3HY|518|3007001 -> i use Buy
Assistant.Macro.ContextMenu|0x0G8D3HY|519|3007002 -> i use Sell
but if i use in stealth:
SetContextMenuHook($0G8D3HY, 3007002); because my shard don't use the "argument" 3007001 or 3007002, they use argument 518 to buy and 519 to sell.
i don't know if it was clean, but maybe has any way to stealth use that argument, i don't know