SilentRuin
September 13th, 2020, 17:07
I have a generic asset that I add onto the map for FGU (using 5E but calling only coreRPG related stuff). When the token is added I do the following to that token:
newTokenInstance.registerMenuItem(Interface.getStr ing("my_special_menu_lock"), "lock", 4);
newTokenInstance.registerMenuItem(Interface.getStr ing("my_special_menu_unlock"), "unlock", 6);
newTokenInstance.onMenuSelection = onMenuSelection;
But I will never see these options in the right mouse radial menu - nor ever get my onMenuSelection called. I cannot find any examples in 5E/coreRPG that do anything with a tokeninstance radial menus and the dev doc for unity has some cryptic warning about needing a handler for these things.
registerMenuItem
function registerMenuItem(label, icon, ...)
This function registers a new user defined menu item. If the user selects the item, the script is notified of this through the onMenuSelection handler, if registered.
The menu item is defined by specifying the bitmap and label to use, as well as the position of the item on the menu. The position is given as a number value. To define entries in submenus, use multiple number values, with the first being the position value of the outermost submenu, and the last being the position of the actual menu item in the innermost submenu.
Trying to redefine an existing menu item will fail.
The token interface for menus is different than other objects in that a handler must be registered to intercept menu events.
Parameters
label (string)
A string to be used as the label of the menu item
icon (string)
The name of an icon resource to use as the bitmap for the menu item...A list of numbers specifying the menu item position as a number between 1 and 8, with one being the top slot, and the progression of numbers proceeding in a clockwise direction.
I know FGU has tokeninstance things defined for its radial menu that I will never be able to see or interact with - but all I can see is when I right mouse over a generic asset placed on map I see menu items at positions 1,3,7,8 so I picked 4,6 for my user defined ones. But I see nothing. I'm doing the above code when my Token.onTokenAdd callback detects my brand of token was placed.
Any clues on why this is not working?
newTokenInstance.registerMenuItem(Interface.getStr ing("my_special_menu_lock"), "lock", 4);
newTokenInstance.registerMenuItem(Interface.getStr ing("my_special_menu_unlock"), "unlock", 6);
newTokenInstance.onMenuSelection = onMenuSelection;
But I will never see these options in the right mouse radial menu - nor ever get my onMenuSelection called. I cannot find any examples in 5E/coreRPG that do anything with a tokeninstance radial menus and the dev doc for unity has some cryptic warning about needing a handler for these things.
registerMenuItem
function registerMenuItem(label, icon, ...)
This function registers a new user defined menu item. If the user selects the item, the script is notified of this through the onMenuSelection handler, if registered.
The menu item is defined by specifying the bitmap and label to use, as well as the position of the item on the menu. The position is given as a number value. To define entries in submenus, use multiple number values, with the first being the position value of the outermost submenu, and the last being the position of the actual menu item in the innermost submenu.
Trying to redefine an existing menu item will fail.
The token interface for menus is different than other objects in that a handler must be registered to intercept menu events.
Parameters
label (string)
A string to be used as the label of the menu item
icon (string)
The name of an icon resource to use as the bitmap for the menu item...A list of numbers specifying the menu item position as a number between 1 and 8, with one being the top slot, and the progression of numbers proceeding in a clockwise direction.
I know FGU has tokeninstance things defined for its radial menu that I will never be able to see or interact with - but all I can see is when I right mouse over a generic asset placed on map I see menu items at positions 1,3,7,8 so I picked 4,6 for my user defined ones. But I see nothing. I'm doing the above code when my Token.onTokenAdd callback detects my brand of token was placed.
Any clues on why this is not working?