ScriptUO

Scripting Resources & Utilities => Stealth Client => Topic started by: rwo001 on January 13, 2016, 07:34:23 PM

Title: [C#] ContextMenus Question
Post by: rwo001 on January 13, 2016, 07:34:23 PM
Code: [Select]
Console.WriteLine("Start");
Console.WriteLine("SDK Version : "+SDK.Revision);
ScriptSDK.SDK.Initialize();
Mobile a = new Mobile(new Serial(0x004230E2));
a.ContextMenu.Parse();
Console.WriteLine(a.ContextMenu.Entries.Count);

Mobile b = new Mobile(new Serial(0x00B14FC5));
b.AttachContextMenu();
Console.WriteLine(b.ContextMenu.Parse()); // Return False ?
Console.WriteLine(b.ContextMenu.Entries.Count);

a.ContextMenu.Click(3006123);           
Console.WriteLine("End");
Console.ReadKey();

Code: [Select]
SDK Version : 0.9.0
4
False
0

How can i do to parse the context menu of b?
Title: Re: [C#] ContextMenus Question
Post by: Crome969 on January 13, 2016, 09:48:07 PM
Do you play EA or Freeshard? I would need to check but as far i remember context menu worked properly due latest udate.

What i notice is you try to assign 2 mobiles a context menu and this wont work.
The context menu is a singleton attachment, you assign it to an object and parse and then can  use and when you need to use on another object you assign to another object.

and b.AttachContextMenu(); is equal to b.ContextMenu.Parse() (i just made a linker function).

If you can provide me informations where i could test this, i would try to reproduce, as far as my last tests (i think i fixed a few context stuff on 0.8.x) it worked.
Title: Re: [C#] ContextMenus Question
Post by: rwo001 on January 13, 2016, 11:51:40 PM
Code: [Select]
Mobile b = new Mobile(new Serial(0x00B14FC5));
ScriptSDK.Configuration.ContextOptions.Initialize();
Console.WriteLine(b.ContextMenu.Parse());
Console.WriteLine(b.ContextMenu.Entries.Count);

Console.WriteLine(b.ContextMenu.Click(3006123));  // True;
Console.WriteLine(a.ContextMenu.Click(3006123));  // False;

I add initialize() to make "b" work but "a" will lost the contextmenu
Title: Re: [C#] ContextMenus Question
Post by: Crome969 on January 14, 2016, 12:31:35 AM
Thats correct due the unique characteristic of context menus in stealth (and i guess in uo).
When you attach to a all other attachments are lost. If you now attach to b, a no longer has an attachment on system.