-
September 13th, 2020, 17:07 #1
How to set user radial menu option on token in map?
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:
Code:newTokenInstance.registerMenuItem(Interface.getString("my_special_menu_lock"), "lock", 4); newTokenInstance.registerMenuItem(Interface.getString("my_special_menu_unlock"), "unlock", 6); newTokenInstance.onMenuSelection = onMenuSelection;
Code: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.
Any clues on why this is not working?Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 14th, 2020, 16:06 #2
Has no one ever tried to get radial menus on the map to support user defined menus in FGU? It's kind of surprising nobody knows how to do this.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 16th, 2020, 17:55 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,613
The short answer is that no one has used this capability, and it hasn't been looked at in years. Thus, it's unknown to me at this point whether it works and what the limitations are. I do know that custom menus can not override built-in menus.
I'll add it to the list of tasks to investigate.
Regards,
JPG
-
September 16th, 2020, 18:06 #4
Thanks for the answer - yeah the FGU hardcoded things would not be triggering the onMenuSelection so I understood that only user stuff would. Just could not get it to work per my example and that mysterious warning in the document that I did not understand.
I'll probably just work around it with a new window that pops up on double click and provide the options in there as I know that stuff works.Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 22nd, 2022, 21:46 #5oldonTokenAdd=ImageManager.onTokenAdd
ImageManager.onTokenAdd=newonTokenAdd
end
function newonTokenAdd(tokenMap)
Debug.chat("Token added to map",tokenMap)
oldonTokenAdd(tokenMap)
tokenMap.registerMenuItem(Interface.getString("ct_ searchtip"), "stv", 4)
Debug.chat("Combat tracker entry is")
end
The above works for adding a new item to the radial menu, but I am unable to get an onMenuSelection function to associate with it.
Any idea what I'm missing ?
Cheers, Steve.
-
June 23rd, 2022, 00:38 #6
I've been using the radial menus for an extension and it's been going well. I looked for a way to query the radial menu to see what's there already, to avoid menu item position conflicts at runtime, but couldn't find anything. Any guidance for avoiding radial menu position conflicts with other extensions, etc? Thanks, Justin
-
June 23rd, 2022, 02:45 #7
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,613
No, there’s no way to query. You’ll have to coordinate with other extension creators.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks