News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Understanding Menu Definiton

Started by Spartanis, August 19, 2011, 12:32:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spartanis

To Whom it may concern.

I would like to create a system of menu in the game that does the following example

In the main menu, you click on ROAD tool, a new list of Submenu appears containing, Road, Signals etc etc

I click on SIGNALS and a NEW sub menu appears showing all different types of signals available.

How do i go about creating that?

(yes i have looked in MenuConf File and i must say.. its a bluddy headache!!)

Combuijs

Well, yes, it's not easy, but when you get the hang of it, it's very flexible.

Did you look at the Wiki? This page is in German, but it explains things quite well, I thought:

http://simutrans-germany.com/wiki/wiki/tiki-index.php?page=de_newMenuDef
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Spartanis

Yeah i had a look at the German Wiki (translated to English).

They helped somewhat to my feeble confused mind. So i did a little experimenting:

Following is the abstract of a pak64 menuconf file with changes i've made, in attempt to create a button within the roadtool submenu, that allows me to create another submenu toolbar.

# roadtools (waytype 1)
#toolbar[5][0]=ways(1,0)
toolbar[5][0]=toolbar[11],4,,ROADTOOLS,roadtools.txt


# roadtools submenu
toolbar[11][0]=ways(1,0)



well.. it didnt work :|

Combuijs

You did see this comment is menuconf.tab I assume:

# IMPORTANT: toolbar[2] must not be mentioned before toolbar[1]!

In your toolbar[5][0] line you introduce toolbar[11]. Are you sure that for instance toolbar[10] is not introduced later on, or toolbar[12] earlier on?
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Spartanis

Ahhh.. i placed toolbar[11] just after the group of toolbar[5]'s.. so i moved toolbar[11] to AFTER group of toolbar[10]'s and before toolbar[12]'s (in standard pak case, there wasn't any)


# roadtools (waytype 1)
toolbar[5][0]=ways(1,0)
toolbar[5][1]=ways(1,1)
toolbar[5][2]=bridges(1)
toolbar[5][3]=tunnels(1)
toolbar[5][4]=general_tool[17],20,,1
toolbar[5][5]=wayobjs(1)
toolbar[5][6]=signs(1)
toolbar[5][7]=buildings(33,1)
toolbar[5][8]=buildings(34,1)
toolbar[5][9]=buildings(35,1)
toolbar[5][10]=general_tool[14],,s,1
toolbar[5][11]=toolbar[11],4,,ROADTOOLS,roadtools.txt

# shiptools (waytype 3)
toolbar[6][0]=ways(3,0)
etc...

# airtools (waytype 1)
toolbar[7][0]=ways(16,0)
etc...

# specialtools
toolbar[8][0]=buildings(35,0)
etc...

# list tools
toolbar[9][0]=dialog_tool[14]
etc...

# editor tools
toolbar[10][0]=general_tool[10],25,,+100
etc...

# roadtools submenu
toolbar[11][0]=ways(1,0)


Having done that, i tested it.. the New Button did not appear

Combuijs

No, but toolbar[12] is probably introduced before toolbar[11]. With introducing I mean appearing behind the "=" sign.

This is an example from my personal menuconf.tab

toolbar[0][4]=toolbar[2],1,,RAILTOOLS,railtools.txt
toolbar[0][5]=toolbar[3],2,,Monorail,monorailtools.txt
toolbar[0][6]=toolbar[4],3,,TRAMTOOLS,tramtools.txt
toolbar[0][7]=toolbar[5],101,,Narrowgauge,
toolbar[0][8]=toolbar[6],102,,Maglev,
toolbar[0][9]=toolbar[7],4,,ROADTOOLS,roadtools.txt
toolbar[0][10]=toolbar[8],5,,SHIPTOOLS,shiptools.txt
toolbar[0][11]=toolbar[9],6,,AIRTOOLS,airtools.txt
toolbar[0][12]=toolbar[10],103,,Powerlines,
toolbar[0][13]=toolbar[11],104,,Extensions,


If you swap the last two toolbars, e.g.:

toolbar[0][4]=toolbar[2],1,,RAILTOOLS,railtools.txt
toolbar[0][5]=toolbar[3],2,,Monorail,monorailtools.txt
toolbar[0][6]=toolbar[4],3,,TRAMTOOLS,tramtools.txt
toolbar[0][7]=toolbar[5],101,,Narrowgauge,
toolbar[0][8]=toolbar[6],102,,Maglev,
toolbar[0][9]=toolbar[7],4,,ROADTOOLS,roadtools.txt
toolbar[0][10]=toolbar[8],5,,SHIPTOOLS,shiptools.txt
toolbar[0][11]=toolbar[9],6,,AIRTOOLS,airtools.txt
toolbar[0][12]=toolbar[11],103,,Powerlines,
toolbar[0][13]=toolbar[10],104,,Extensions,


the whole thing won't work!

Bob Marley: No woman, no cry

Programmer: No user, no bugs



Spartanis

yup. I understand you completely. But i have placed it in correct order (see prev post) you notice that i put the new "button" as toolbar[5][11] just after toolbar[5][10] .. which as i said before.. everything else works, but the new "button" add on didnt appear

What gets me is that this line

toolbar[8][12]=toolbar[10],7,,EDITTOOLS,edittools.txt

works quite well :|

(I must mention.. that i used pak/config/menuconf file.. and add that one new line in toolbar[5] group.. then after the toolbar[10] group, i create a toolbar[11] group ... )


Combuijs

QuoteWhat gets me is that this line

Code:

toolbar[8][12]=toolbar[10],7,,EDITTOOLS,edittools.txt


works quite well :|

Yes, that's what I'm telling you!!! (Where's DirrrtyDirk when you need him  ;) )

QuoteWith introducing I mean appearing behind the "=" sign.

Do the following things:

Change line:

toolbar[8][12]=toolbar[10],7,,EDITTOOLS,edittools.txt

into

toolbar[8][12]=toolbar[11],7,,EDITTOOLS,edittools.txt

Change line:

toolbar[5][11]=toolbar[11],4,,ROADTOOLS,roadtools.txt

into

toolbar[5][11]=toolbar[10],4,,ROADTOOLS,roadtools.txt

change all

toolbars[10][ x]=

lines into

toolbars[11][ x]=

and change all

toolbars[11][ x]=

lines into

toolbars[10][ x]=

and finally swap the order of the new toolbar[10]= and toolbar[11]= lines

Then enjoy your new menu layout!





Bob Marley: No woman, no cry

Programmer: No user, no bugs



Spartanis

O_o

Gimmie a few sec to drink a pint of beer before i try to read this again..

lmao

just kidding.. its late here and im a bit tired. I've bookmarked this page, so that i can come back to it tommorrow morning, and have a good slow read. Will let you know how i go.

Spartanis

ok.. did this, and it worked.. i looked at the changes recommended by you..

To feedback to you so that i understand what you have taught me:

the [n] numbers must be in order .. that is.. [10] must not be place  in any lines before [9] is located.. and is also must be placed before [11] line is located.

This rule must be enforced on either side of the '=' sign.

in short:

DONT -->

toolbar[1]=toolbar[1]
toolbar[2]=toolbar[0]

DONT -->

toolbar[3]=toolbar[1]
toolbar[2]=toolbar[2]

DONT -->

toolbar[3]=toolbar[1]
toolbar[2]=toolbar[0]

Do -->

toolbar[1]=toolbar[0]
toolbar[2]=toolbar[1]

Combuijs

Ah, that pint of beer worked wonders for you! You should have drunk that much earlier...  :D

From your feedback I can see you have understood it. A ten and a slate-pencil as they say it in Dutch...
Bob Marley: No woman, no cry

Programmer: No user, no bugs



greenling

#11
Good day
here be talking over the working from the menuconf.tab in combination with the menu.pak ?
Combuijs
i have be look on the wiki http://simutrans-germany.com/wiki/wiki/tiki-index.php?page=de_newMenuDef
but i have not be understand how it work!
Combuijs
it´s Possible that you can be declar that working of the menuconf.tab in combination with the menu.pak in picture that´s in can be
understand?
I want build in a new menubotton in the mainmenu.
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Spartanis

G'day Greenling.

Excuse me if I got this wrong. Correct me if i am.

You want to create a new "button' in the main menu that does something you use very often.

Ie: Move the save game button out of the sub-menu into the main menu?

Spartanis

Just had a thought.

Is it possible to set the menu up to show VERTICALLY... Rather than HORIZONTALLY?

Combuijs

Not at the moment no. But with the current tendency for broad display, this could be very handy.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



prissi

It is possible, since you can specify a maximum width for a menu. With width 64 it might display indeed vertically. However, some places in the game still assume there is a menue at the top, so you may run in troubles without.

Spartanis

Prissi, Yes, I have discovered that by changing the width of the icons to 64, despite the new icon images for the tools works well, the main menu is outta wack, and the software did spat out fatel error (something about icon mismatch) once or twice.

Combuijus: Indeed. With so many "add-ons" and stuff, one need to tidy up the menuconfig system (which i am working on atm) to allow subgroups and stuff, for easier finding of specific tools needed during game play. It would be HELLA awesome if i can get the vertical thingy working lol.. but alas! maybe in the next few version it may be possible with ease.