[XASECO2] Fufi Menu v2

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

[XASECO2] Fufi Menu v2

Post by maniactwister » 05 Sep 2011 23:02

Hey,

I've just updated Fufi Menu for Xaseco2 (Canyon).
Some Entries won't work because a couple of plugins aren't updated for xaseco2 yet.
Note: This is a "Beta" Release. I've tested it several times and i hope all works well, but there are maybe some bugs.

Download
V2.04: http://www.tdracer.de/xaseco/download.p ... .v2.05.zip

Changelog
v2.05 - 13.05.2013 recommended
  • Added CP-Times commands. (Thanks xymph)
v2.04 - 16.10.2011
  • Added support for undef's Third-Party Plugins UpToDate
  • Added MX Entries
  • The Button can now be hidden on score screen(hideonscore @ fufi_menu_config.xml)
v2.03beta - 10.09.2011
  • All Gamemode are available in the menu now
  • Fixed "Info -> Server -> Xaseco"2 Command & Text
  • Removed "HUD -> Style-> Off"
  • Increased size of the close button
v2.02beta - 06.09.2011
  • Updated all Map entries in fufi_menu_config.xml
v2.01beta - 06.09.2011
  • Updated entries in fufi_menu_config.xml
  • Fixed Gamemodes and disabled Laps/Stunts entries temporary.
Some Screenshots

Image

Image

Quote of the original Post because there are no changes.
f*ckfish wrote:
XAseco2 0.90 or better required

Since XAseco is lacking of a menu which already exists in the other controllers, I decided to write one exclusively for XAseco, so no I won't port it to Aseco since there is already the oliverde8 menu which works similar.


Installation

If you don't follow the steps carefully, the plugin will not be working properly.
  1. Unrar the archive into the ASECO folder
  2. Insert the following line into "plugins.xml" (after all other plugins (actually it can be placed before or after the Fufi Widgets, if you use them))

    Code: Select all

    <plugin>plugin.fufi.menu.php</plugin>
  3. Configure some stuff if you like to (see configuration section below)
  4. Done! Have fun!

Configuration

Inside the main XAseco folder, you'll find a file called "fufi_menu_config.xml". Inside this file you can configure everything you want to customize the menu to your needs:
  • menu_caption: the text in the menu button
  • styles: all used styles and substyles for the menu graphics, feel free to play around
  • size: the size of the menu button
  • separatorheight: the height of a "separator" entry in the menu
  • menutimeout: the amount of milliseconds until the menu closes automatically if nothing was clicked
  • position: the position of the menu button and according to that the main starting point for the menu
  • horizontalorientation: the way the menu arranges its submenus horizontally (1.. left-to-right, 2...right-to-left)
  • verticalorientation: the way the menu arranges its submenus vertically (1.. top-to-bottom, 2...bottom-to-top)
  • for the last three entries I included presets for all the four corners of the screen, you'll just have to take out the comments
  • entries: for a detailed description on how the entries work, please have a look at the "Structure" section below

Structure

Now I'll come to the most interesting but also probably most confusing part of the menu: the menu structure. Once you understood the structure, it will be easy for you to add new submenus with your own entries or remove existing menus. The best way to understand the structure is to have a look at the entries section inside "fufi_menu_config.xml". I've built in a lot of features that won't be necessary for the majority of users, but I'll still try to write everything down here.

The maximum possibilities of the tag "entry" are like that:

Code: Select all

<entry 
	type='entrytype'
	caption='somecaption'
	indicator='someindicator'
	params='0'
	chatcmd='/chatcommand' 
	chatcmdparams='someparams'
	dependencies='someplugin.php'
	ability='chat_musicadmin'
	globalvariable='someglobalvariable'
	unique='uniquekey'
/>
The attributes of entry are used like that:
  • type: [optional] if left out, the entry will ether be an extendable menu group or an actual clickable entry, if set to "help" it's basically the same as the beforementioned, but the icon next to the entry will be the help icon, if set to "separator" there will be some vertical space in the menu on this place, to make the structure more readable
  • caption: [optional] this one is needed for every entry but the separators, it defines the text which is shown in the menu for this entry
  • indicator: [optional] this one's a bit tricky. It is used for boolean properties which should already display their state inside the menu with the help of a red (false), green (true) or yellow (pending) icon.
    The "indicator" attribute has to be a valid function name that returns 0 for "false", 1 for "true" and 2 for "pending",every other value will disable the icon, I'll get back later to the usage of this functionality.
  • params: [optional] With the help of the params you can pass values to the indicator function (comma separated)
  • chatcmd: [optional] This is the heart of the menu, here you define the chat command which should be emulated, when a user clicks an entry in the menu, if left out, the entry will serve as a menu group which can hold subentries
  • chatcmdparams: [optional] Setting this attribute only makes sense if you define an "indicator"-function and the entry therefore represents a boolean value, as most of you know, a lot of settings in XAseco can be activated by "/somechatcommand ON" and deactived by "/somechatcommand OFF", to make that possible, "chatcmdparams" in this case would be "OFF/ON" (slash separated), if left out, the menu would always perform "/somechatcommand"
  • dependencies: [optional] comma separated list of plugins that have to be installed, so these menu entries will be displayed
  • ability: [optional] since XAseco has the tiered admin system, every chat command can be limited to special user groups, if a user needs a special ability to execute this menu entry/chat command, you'll need to specify the ability in this attribute (all abilities can be found inside "adminops.xml")
    If a chat command starts with "/admin" or "/jfreu" the menu will automatically check for the abilities, so there's no need to define the "ability" attribute there.
  • globalvariable: [optional] some features in XAseco like karma and voting are activated via global variables, so this attribute checks for the existence of the defined variable and if it's set to true and displays the entry if the condition is given
  • unique: This attribute always has to be defined and contains a string that identifies the entry uniquely, it is mainly used to define entry points for plugin generated menu entries

Structural Example

For an example that should cover all the possibilities, I'll try to rip out some code from the original menu mixed with some imaginary code (the code itself, especially the structure makes no sense at all, but it's good enough for an example):

Code: Select all

01	<entry caption='Music' dependencies='plugin.musicserver.php' unique='music'>
02		<entry caption='List' chatcmd='/music list' unique='musiclist'/>
03		<entry caption='Administration' ability='chat_musicadmin' unique='musicadmin'>
04			<entry caption='Track Override' indicator='fufi_getMusicOverrideIndicator' chatcmd='/music override' chatcmdparams='off/on' unique='musicoverride'/>
05		</entry>
06		<entry caption='10 Coppers' chatcmd='/donate 10' dependencies='plugin.donate.php' rights='TMUF' unique='don10'/>
07		<entry caption='Game Mode' unique='admingamemode'>
08			<entry caption='Rounds' indicator='fufi_getGameModeIndicator' params='0' chatcmd='/admin setgamemode rounds' unique='admingmrounds'/>
09			<entry caption='Time Attack' indicator='fufi_getGameModeIndicator' params='1' chatcmd='/admin setgamemode ta' unique='admingmtimeattack'/>
10		</entry>
11		<entry type='separator' unique='musicsep1'/>
12		<entry type='help' caption='Help' chatcmd='/helpall' unique='helpall1'/>
13		<entry caption='Track Karma' globalvariable='feature_karma' chatcmd='/karma' unique='karma'/>
14	</entry>
So what will happen in these lines? (the numbers in the list correspond to the line numbers)
  1. a new submenu with the caption "Music" is created, it will only show up in the actual menu, if the plugin "plugin.musicserver.php" is in the list of the active plugins, the unique key is "music"
  2. creates a simple clickable entry with the caption "List" which executes the chat command "/music list", I'm not gonna tell you any more about the unique key, it should be obvious that it's always there and always different
  3. here a new submenu under the "Music" menu is created (caption is "Administration"), the ability tag says that this menu and all its submenus and entries will only be visible to players, that have the ability "chat_musicadmin" inside the "adminops.xml"
  4. creates a clickable entry that is bound to a boolean value, the indicator points to a function name:
    That means, whenever this menu will be accessed, the function "function fufi_getMusicOverrideIndicator()" will be called and the result of this function determines on how this entry will be marked. The function in fact checks if MusicOverride is on or off and will return true or false which then results in a green or red icon next to the entry (see the simple source of this function inside "plugins/plugin.fufi.menu.php"), of course you can define your own indicator functions inside your plugins, I just defined the ones for functinalities included in the original XAseco release
  5. closing tag for the "Administration" submenu
  6. creates a Donation entry (only works with active plugin "plugin.donate.php" and will only be shown to United users because of the "rights" attribute)
  7. a new submenu with the caption "Game Mode" is created
  8. at the first view this looks quite similar to the "Track Override" entry, but it's got one difference: the indicator function "fufi_getGameModeIndicator" now also takes a parameter defined in the attribute "params":
    That results in a method call like this: fufi_getGameModeIndicator(0)
    The function then checks if GameMode 0 (which means "Rounds") is currently active or will be active in the next round, the result of the function then determines the icon which is shown next to the entry (again, double check with the source of this function inside "plugins/plugin.fufi.menu.php")
  9. similar to line 8, but results in a function call like this: fufi_getGameModeIndicator(1)
  10. closing tag for the "Game Mode" submenu
  11. creates a vertical gap (separator) in the menu
  12. similar to all other entries, this one creates a simple clickable entry which executes the chat command "/helpall", the only difference is that with the attribute "type='help'" the icon of this entry will be a help icon
  13. this entry will only be shown if the global variable "feature_karma" is defined and set to true
  14. closing tag for the "Music" submenu
Please don't be scared of all those attributes, if you really want to work with the menu you'll get a hold of its functionality very soon.

And now let's proceed to the really cool part, using the menu from within your own plugins.


Plugin Access

This section will cover how to access the menu if you want to add your own groups and entries for your plugins. You should have read the sections about the structure to understand this one, but basically it's very easy.

To see a tiny working example, have a look at the Fufi Widgets, I implemented the menu function there.

First of all you'll need to react on an event called "onMenuLoaded" just like you react on all the other events, XAseco releases.

Code: Select all

Aseco::registerEvent('onMenuLoaded', 'myplugin_initMenu');
Then of course you'll need to implement the function "myplugin_initMenu".

Code: Select all

function myplugin_initMenu($aseco, $menu){
	[...]
}
Inside this function (which will only be called once at the start of the server when the menu is loaded) you can now work with the $menu variable to access the menu.
Therefore there are two methods, the first one is called "addEntry" and looks like this:

Code: Select all

function addEntry($insertInGroup, $entryPoint, $insertAfter='true', $caption, $unique, $chatcmd='', $chatcmdparams='', $ability='', $indicator='', $params='', $type='', $rights='')
Now that's the beautiful part of it, nearly all of those parameters directly correspond to the XML structure I described before:
  • $insertInGroup - That's the moment, where you'll need the unique key of the group where you want to insert your entry, if left empty, your entry will be inserted into the root menu
  • $entryPoint - Here you'll have to enter the unique key of the entry in the menu where you want to insert your entry, depending on the next parameter, our entry will be positioned before or after the "entryPoint", if left out or the key is unknown, your entry will be inserted at the very beginning or the very end of the group
  • $insertAfter - This is a boolean value, if set to true your entry will be placed after the one specified in the parameter before, if set to false it will be placed before the other entry
  • $caption - similar to XML attribute caption
  • $unique - similar to XML attribute unique
  • $chatcmd - similar to XML attribute chatcmd
  • $chatcmdparams - similar to XML attribute chatcmdparams
  • $ability - similar to XML attribute ability
  • $indicator - similar to XML attribute indicator
  • $params - similar to XML attribute params
  • $type - similar to XML attribute type
  • $rights - similar to XML attribute rights
[/list]

The other function which is actually just a shortcut to "addEntry" is called "addSeparator" and looks like this:

Code: Select all

addSeparator($insertInGroup, $entryPoint, $insertAfter, $unique)
The parameters are similar to the ones of "addEntry" just less^^.

And now the fun part, I'll use those two functions to make up a menu for my imaginary plugin. I'm aware of the fact, that the order in which I add the entries is a bit chaotic, but I wanted to display the possibilities of the $insertAfter parameter. The comments describe the funtionality of the corresponding function calls.

Code: Select all

function myplugin_initMenu($aseco, $menu){

	// creates a menu group with the caption "My Plugin" in the root menu, after all other entries
	$menu->addEntry('', '', 'My Plugin', 'myplugin');

	// creates an entry inside the new group which executes the chatcommand "/myplugin list"
	$menu->addEntry('myplugin', '', 'Show List', 'mypluginlist', '/myplugin list');
	
	// adds an entry at the beginning of the "My Plugin" group, which will only be shown to players with the ability "chat_mypluginadmin"
	$menu->addEntry('myplugin', -1, 'Do Weird Admin Stuff', 'mypluginadminstuff', '/myplugin adminstuff', '', 'chat_mypluginadmin');

	// adds a simple chat command at the end of the menu, also the type is "help" so the icon will be the help icon
	$menu->addEntry('myplugin', '', 'Help', 'mypluginhelp', '/myplugin help', '', '', '', '', 'help');

	// adds a separator after the "Show List" entry
	$menu->addSeparator('myplugin', 'mypluginlist', 'mypluginsep1');

}
Last edited by maniactwister on 12 May 2013 22:47, edited 11 times in total.
Image
"My english is not the yellow from the egg ..." ;)

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by Xymph » 06 Sep 2011 06:00

maniactwister wrote:Image
Thanks a bunch for picking these up. I don't have time to try them now, but from the release note about /admin amdl you can tell that "Challenge Download Allowed" should be "Map ... etc" with the corresponding change in command. And "Shutdown XASECO" and "Server Coppers" also need to be adjusted, of course. Should be simple changes in fufi_menu_config.xml.

The Game Mode numbering changed, this requires the params= entries in that section of fufi_menu_config.xml to be updated, and perhaps the .php code too.

Why are you including a map file in the plugins/fufi/ directory?
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by maniactwister » 06 Sep 2011 10:07

Xymph wrote:Thanks a bunch for picking these up. I don't have time to try them now, but from the release note about /admin amdl you can tell that "Challenge Download Allowed" should be "Map ... etc" with the corresponding change in command. And "Shutdown XASECO" and "Server Coppers" also need to be adjusted, of course. Should be simple changes in fufi_menu_config.xml.

The Game Mode numbering changed, this requires the params= entries in that section of fufi_menu_config.xml to be updated, and perhaps the .php code too.

Why are you including a map file in the plugins/fufi/ directory?
There is an update out, thanks Xymph. The Map is deleted too now, sry ;)
But one Question: "Shutdown Xaseco" works for me, what do you mean?
Image
"My english is not the yellow from the egg ..." ;)

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by Xymph » 06 Sep 2011 18:02

maniactwister wrote:
Xymph wrote:And "Shutdown XASECO" [...]also need to be adjusted, of course. Should be simple changes in fufi_menu_config.xml.
But one Question: "Shutdown Xaseco" works for me, what do you mean?
Adjusted because the system is called XASECO2. But I see you figured it out, so thanks for that.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by Xymph » 10 Sep 2011 15:42

My previous comments were just based on the screenshots - now I've finally gotten around to trying the plugin. :)

Most everything looks and works well. Thanks again for that. Just a few corrections:

- In Customize HUD -> Style, the Off entry should be removed, as the /style off command option was too (forgot to mention that in the release notes).
- In Info -> Server, the XASECO entry should have a '2' appended too, along with its /xaseco command.
- In Admin -> Game Mode, two modes are commented out in the .xml, can those be re-enabled in the correct order?

And a suggestion, increase the size of the Close button a bit (as it is smaller on the screen than in TMF). I used sizen="1.8 1.8" in the start_close quad in plugins/fufi/fufi_menu.xml, which looks better IMHO.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by maniactwister » 10 Sep 2011 17:06

Xymph wrote:My previous comments were just based on the screenshots - now I've finally gotten around to trying the plugin. :)

Most everything looks and works well. Thanks again for that. Just a few corrections:

- In Customize HUD -> Style, the Off entry should be removed, as the /style off command option was too (forgot to mention that in the release notes).
- In Info -> Server, the XASECO entry should have a '2' appended too, along with its /xaseco command.
- In Admin -> Game Mode, two modes are commented out in the .xml, can those be re-enabled in the correct order?

And a suggestion, increase the size of the Close button a bit (as it is smaller on the screen than in TMF). I used sizen="1.8 1.8" in the start_close quad in plugins/fufi/fufi_menu.xml, which looks better IMHO.
Everything done :)
*There is an update out*
Image
"My english is not the yellow from the egg ..." ;)

pr_killer
tricycle manager
tricycle manager
Posts: 25
Joined: 13 Feb 2011 10:57
Owned TM-games: TMUF

Re: [XASECO2] Fufi Menu v2 (beta)

Post by pr_killer » 12 Oct 2011 13:44

Hi,

how can i change it that there is no blue background, it should be like records eyepace only grey. And is there an possibility that the menu button is not shown at map end?

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by maniactwister » 13 Oct 2011 11:48

Hi,

You Can change the Background Style in "fufi_menu_config.xml" :

Code: Select all

		<menubutton style='BgsPlayerCard' substyle='ProgressBar'/>
		<menubackground style='BgsPlayerCard' substyle='ProgressBar'/>
pr_killer wrote:And is there an possibility that the menu button is not shown at map end?
That's not possible atm, but maybe in the next release
Image
"My english is not the yellow from the egg ..." ;)

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by Ant » 13 Oct 2011 20:19

pr_killer wrote: And is there an possibility that the menu button is not shown at map end?
Would this work in this version? soehest's hack -> viewtopic.php?f=127&t=17450&start=150#p194871

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by maniactwister » 13 Oct 2011 20:39

Yes, but:

Code: Select all

890 //$fufiMenu->sendMenuButtonToLogin('');
is now line number 902 :)
Image
"My english is not the yellow from the egg ..." ;)

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: [XASECO2] Fufi Menu v2 (beta)

Post by Ant » 13 Oct 2011 21:17

Well you probably made some changes to this version for XAseco2 but I trusted showing you that, you would know what to do :)

User avatar
LeTo
cyclist
cyclist
Posts: 45
Joined: 24 Apr 2008 20:55
Owned TM-games: TMU, TMN
Location: Paris

Re: [XASECO2] Fufi Menu v2 (beta)

Post by LeTo » 14 Oct 2011 20:55

maniactwister wrote:Hi,

You Can change the Background Style in "fufi_menu_config.xml" :

Code: Select all

		<menubutton style='BgsPlayerCard' substyle='ProgressBar'/>
		<menubackground style='BgsPlayerCard' substyle='ProgressBar'/>
pr_killer wrote:And is there an possibility that the menu button is not shown at map end?
That's not possible atm, but maybe in the next release
it's not the style from the screen?
Image
Sorry for my english :D

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [XASECO2] Fufi Menu v2

Post by Xymph » 05 May 2013 12:40

For the two new commands in XAseco2 v1.03, I recommend the following new entries in fufi_menu_config.xml, shown in bold:
<entry caption='Range' chatcmd='/recrange' unique='relrange'/>
<entry caption='CP Times' chatcmd='/cptms' dependencies='plugin.checkpoints.php' unique='cptms'/>
<entry caption='Sector Times' chatcmd='/sectms' dependencies='plugin.checkpoints.php' unique='sectms'/>

<entry caption='Range' chatcmd='/dedirange' unique='dedirange'/>
<entry caption='CP Times' chatcmd='/dedicptms' unique='dedicptms'/>
<entry caption='Sector Times' chatcmd='/dedisectms' unique='dedisectms'/>
I'll wait a bit for maniactwister to update the full package, but if that doesn't happen I'll host it myself, like for the TMF version.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
maniactwister
sunday driver
sunday driver
Posts: 71
Joined: 01 Jun 2010 00:37
Owned TM-games: TMU, TMUF, TM2
Manialink(s): tdracer
Contact:

Re: [XASECO2] Fufi Menu v2

Post by maniactwister » 12 May 2013 22:47

Done. Thanks :)
Image
"My english is not the yellow from the egg ..." ;)

weasel
speedy pilot
speedy pilot
Posts: 331
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Fufi Menu v2

Post by weasel » 07 Mar 2014 15:02

Uhm , can the place where the menu popsup , when you pres the button , also be changed ?

So not the place of the button but the place of the menu.

Post Reply