Author Topic: [C#] ContextMenus Question  (Read 3654 times)

0 Members and 1 Guest are viewing this topic.

Offline rwo001Topic starter

  • Jr. Member
  • **
  • Posts: 45
  • Activity:
    0%
  • Reputation Power: 1
  • rwo001 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
[C#] ContextMenus Question
« on: January 13, 2016, 07:34:23 PM »
0
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?

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: [C#] ContextMenus Question
« Reply #1 on: January 13, 2016, 09:48:07 PM »
0
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.

Offline rwo001Topic starter

  • Jr. Member
  • **
  • Posts: 45
  • Activity:
    0%
  • Reputation Power: 1
  • rwo001 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: [C#] ContextMenus Question
« Reply #2 on: January 13, 2016, 11:51:40 PM »
0
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

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: [C#] ContextMenus Question
« Reply #3 on: January 14, 2016, 12:31:35 AM »
0
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.

Tags: