[XAseco] Fufi Menu v0.37

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

Moderators: Xymph, TM-Patrol

Post Reply
User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

[XAseco] Fufi Menu v0.37

Post by f*ckfish » 11 Aug 2008 17:07

Fufi Menu (XASECO 1.14 tested)
by oorf I f*ckfish aka Alexander P.
http://fish.stabb.de

XAseco 1.14 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.

Download

Fufi Menu Version 0.37
Fufi Menu All Older Versions

Update v0.37
  • New menu entries for XAseco v1.16 /cptms and /dedicptms commands
Update v0.36
  • New menu entry for XAseco v1.14 /admin relays command
Update v0.35
  • New menu entry for XAseco v1.13 /lastwin command
Update v0.34
  • New menu entries for XAseco v1.12 commands
Update v0.33
  • Added/removed menu entries for XAseco v1.11 commands
Update v0.32
  • New menu entries for XAseco v1.10 commands
Update v0.31
  • New menu entries for XAseco v1.09 commands
Update v0.3
  • Updated Checkpoints Tracking and Jfreu Info Messages for recent XAseco changes
  • New menu entries for recent XAseco commands
  • More menu structure tweaks
Update v0.2
  • Fixed the menu structure, removed unworking entries, fixed jfreu dependencies and rearranged some stuff
  • Reduced the number of manialink calls (that's always a good thing)
  • Changed the usage and structure of the "addEntry"- and the "addSeparator"-function, for details about the new usage have a look at the "Plugin Access" section below, basically what I did is add one functionality: in 0.1 there was only the possibility to insert an entry after another entry, now it's also possible to insert one before another entry
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'
	rights='TMUF'
	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
  • rights: [optional] if left out, every player will see this entry, if set to "TMUF" only United players will see it
  • 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
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');

}

Screenshots

Image

Image
Last edited by f*ckfish on 04 Dec 2008 21:08, edited 5 times in total.
inactive, sorry

User avatar
blooper
happy cruiser
happy cruiser
Posts: 144
Joined: 11 Oct 2007 23:47
Owned TM-games: TMUF
Location: Minnesota, USA

Re: [WIP][XAseco] Fufi Menu

Post by blooper » 11 Aug 2008 17:40

Wow! That looks awesome!
Last edited by blooper on 07 Apr 2013 20:56, edited 1 time in total.

User avatar
lille79
Pit Crew
Pit Crew
Posts: 881
Joined: 09 Dec 2007 15:04
Owned TM-games: TMN, TMNF, TMUF
Location: Norway
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by lille79 » 11 Aug 2008 17:43

Was it you that once upon a time said "And there shall be light" ?

looks awesome :thumbsup:
/lille79
Old man of the Norwegian Trackmania team Super Sheep Racing
To visit my homepage/blog, and download the usbTMFserver, this is the place to go.

User avatar
w1lla
TM-Patrol
TM-Patrol
Posts: 1466
Joined: 23 May 2007 07:20
Owned TM-games: TMU, TMN, TMF
Manialink(s): intr
Location: Venray

Re: [WIP][XAseco] Fufi Menu

Post by w1lla » 11 Aug 2008 17:48

really looks nice. It even has more features the oliverde8's release. :D

Code: Select all

tmnforever is nations and united makes it special. tmnforever has united. I need united!

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by nouseforname » 11 Aug 2008 19:00

waiting for since i know u r working on it. ;)
looks really great. for sure we all will find a place for it^^
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

jeffroselier
road tourist
road tourist
Posts: 102
Joined: 25 Oct 2006 07:59
Location: MARSEILLE

Re: [WIP][XAseco] Fufi Menu

Post by jeffroselier » 11 Aug 2008 21:14

Very nice plugin :thumbsup:

Could you provide a setting for the way round and cup for the system of points (F1GP; MOTOGP; INDY; etc), one can as a "Fast"?

If no: exellent job :thumbsup:

If you seek server for the test: no problem :pil :1 :3

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

Re: [WIP][XAseco] Fufi Menu

Post by Xymph » 11 Aug 2008 22:23

jeffroselier wrote:Could you provide a setting for the way round and cup for the system of points (F1GP; MOTOGP; INDY; etc), one can as a "Fast"?
That has nothing to do with this menu plugin. I can see about incorporating that into a future release though. What are the common point systems and the exact point distributions that should be supported?
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

jeffroselier
road tourist
road tourist
Posts: 102
Joined: 25 Oct 2006 07:59
Location: MARSEILLE

Re: [WIP][XAseco] Fufi Menu

Post by jeffroselier » 12 Aug 2008 06:32

Ok

Here are the distribution points:

Trackmania: 10, 6, 4, 3, 2, 1
AND FET 12, 10, 9, 8, 7, 6, 5, 4,, 3, 2, 1
MotoGP: 25, 20, 16, 13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
MotoGP5: 30, 25, 21, 18, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Formula1: 10, 8, 6, 5, 4, 3, 2, 1
Simple10: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Simple5: 5, 4, 3, 2, 1

If the other players have other ideas of points for the round modem / cup made your proposals.

Again thank you to take into account this point system for very interested in these two modes :thumbsup:

Ouwe
happy cruiser
happy cruiser
Posts: 152
Joined: 07 Sep 2007 15:01
Owned TM-games: TMUF, Canyon
Location: The Netherlands

Re: [WIP][XAseco] Fufi Menu

Post by Ouwe » 12 Aug 2008 09:57

That looks great :gobananas:

I want it NOW :3

User avatar
k4nm4n
smooth traffic navigator
smooth traffic navigator
Posts: 262
Joined: 11 Feb 2008 10:30
Owned TM-games: TMUF
Location: Slovenia
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by k4nm4n » 12 Aug 2008 10:16

Awesome work Fufi. Tnx :thumbsup:

User avatar
VachE
cyclist
cyclist
Posts: 39
Joined: 19 Aug 2006 14:13
Owned TM-games: TMU, TMO, TMS, TM²
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by VachE » 12 Aug 2008 10:20

Wow :idea:

Great Job !
Image

User avatar
k4nm4n
smooth traffic navigator
smooth traffic navigator
Posts: 262
Joined: 11 Feb 2008 10:30
Owned TM-games: TMUF
Location: Slovenia
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by k4nm4n » 12 Aug 2008 10:28

Maybe the music box should be in the menu.

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by f*ckfish » 12 Aug 2008 11:32

k4nm4n wrote:Maybe the music box should be in the menu.
it is, it's just not in the screenshot since I don't have the plugin active =)
inactive, sorry

User avatar
HakkiSk
cyclist
cyclist
Posts: 36
Joined: 16 Sep 2006 17:35
Owned TM-games: TMo,TMs,TMn,TMu :D
Location: Slovakia
Contact:

Re: [WIP][XAseco] Fufi Menu

Post by HakkiSk » 12 Aug 2008 12:06

Veeery nice !!! :gobananas: :3 :pil :1
Image

jeffroselier
road tourist
road tourist
Posts: 102
Joined: 25 Oct 2006 07:59
Location: MARSEILLE

Re: [WIP][XAseco] Fufi Menu

Post by jeffroselier » 12 Aug 2008 13:43

Added settings plugin "Autotrack Manager" :thumbsup:

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests