User Tools

Site Tools


dromed:custom_menus

Custom Menus

Introduction

Dromed’s menus are read from a file called menus.cfg, which resides in the same folder as Dromed.exe, and which can be opened in any text editor. You can edit this file to add anything you want. This can make life much easier, since you won’t have to remember quite as much, e.g. the exact spelling or syntax of a command. If using someone else’s menu, you may find very useful commands whose existence you didn’t even know about.

Existing Custom Menus

Before you begin making changes, it should be noted that there are already a number of custom menus available for download, and even if you choose not to use them, you can look at them to see how some things are done.

A number of custom menus, some for Dromed 1 and some for Dromed 2, can be downloaded via the Tools page at Dromed Central. These were some of the first ones that were released:

These were made for Dromed 2, but they will probably work in Dromed 1 except for the commands that load texture families:

  • Download “Menus Komag” from this site: http://www.keepofmetalandgold.com/downloads.htm
  • Downlaod “DEDx Menus for Dromed” from the Tools → Utilities section of this site: http://www.wearytaffer.com - An interesting feature of these is the way the textures families are grouped. The original texture families are grouped by what sort of textures they contain, rather than, say, alphabetically.

Undersanding the Menu File

The menu_edit section is used to define the names of each menu (e.g. File, Edit, View, Shapes etc). You’ll also notice that it’s split up into several lines, so there is menu_edit, followed by menu_edit_1, menu_edit_2 etc. This is because there is a limit of 92 characters for each line, beyond which Dromed will not read. You can only have ten lines (that’s the first one, e.g. menu_file, up to and including 9, e.g. menu_file_9). Finally, the pipe symbol ( | ) is used to separate each menu item, but is not needed at the beginning or end of a line.

The very first item is &File:menu_file. The & tells Dromed to underline the following letter, and allow that letter on the keyboard to select that item. However this doesn’t seem to work at the top level, only in subsequent levels. File is the text that is shown, followed by a :, followed the name of the menu to be shown, in this case menu_file.

menu_file is defined after the menu_edit section. You can see that menu_file requires several lines because of the character limit. The first item is &New:new_world. In this case, opening the File menu and pressing N will select the item, and run the command new_world. You can also type new_world into the command box and the result would be the same.

In other words, each item consists of some text, a colon, and the command to be executed. You can get a list of all available Dromed commands by typing

dump_cmds something.txt

That .txt file will be placed in your Dromed installation folder.

You’ll also notice the word separator, which can be used to place a dividing line between two menu items in order to aid presentation. You can also just write sep.

The second item in the menu_edit section is &Edit:menu_edit_x, which defines the Edit menu. The _x is added simply because the other logical name, menu_edit, is reserved for the first section. The content of the Edit menu (menu_edit_x) is defined after the commands in menu_file.

The third item in menu_edit is &View:menu_view, whose menu is defined after the menu_edit_x section, and so it goes on.

Making your own Changes

Adding to an Existing Menu

Say you want to add another command to the View menu, but you have no idea where the commands are in the file. Look in the first section (menu_edit) for the word View, and you’ll see that it refers to menu_view. You can then search the file for that text. If the menu is already using ten lines, you’ll have to add your own command to one of the existing lines, however it may be the case that some lines have been split up unnecessarily. For example, in the original menus.cfg, the final two lines of the view menu are:

menu_view_8 separator | Physics models:show_phys_models
menu_view_9 Physics BBoxes:show_phys_bbox

But it’s quite possible to combine them into one line:

menu_view_8 separator | Physics models:show_phys_models | Physics BBoxes:show_phys_bbox

This will free up menu_view_9 for other things, while menu_view_8 is still below the character limit.

Adding your own command therefore consists of finding a short enough line, or shuffling things around to make enough room in the desired location, or making a new line entirely, and typing whatever is to be shown in the menu, followed by a colon, and the command to be executed.

Making a New Menu

Adding your own menu is not much more complicated than adding to an existing one. Recall that menus are defined in the menu_edit section at the start of the file. You can either start a new line, or add to an existing one:

Some Text:menu_something

At the end of the file, start a line with

menu_something

Followed by some text, a colon, and a command. If you want to add another command, either use a | followed by

text:command

Or put the next item on a new line beginning with

menu_something_1

Submenus are a very good way of getting round the character and line number limits, as well as helping with the presentation of the menu. In the same way that items in the menu_edit section point to menus, items in those menus can, instead of calling commands, point to other menus. E.g instead of text:command, you can have text:menu, then elsewhere in the file create a menu section, with a list of commands.

Example: Say you want to add a submenu to the File menu. At some point in the menu_file section add the text:

Temp Commands:menu_submenu

Somewhere after the menu_file section, add a new section:

menu_submenu Render Backward:render_backward | Build Rooms DB:rooms_build

Save the file and load Dromed. When you go to the File menu you should see Temp Commands, which expands to reveal Render Backward and Build Rooms DB.

You can even have submenus within submenus. Add another line to menu_submenu:

menu_submenu_1 Next Menu:menu_next

You can put Next Menu on the first line if you want, but this helps with the layout of the file.

Add the following section, after the menu_submenu section:

menu_next Show Polys:show_poly_edges

If you save the file and reload Dromed, you’ll see that Temp Commands expands to the two previous commands and another submenu, with the Show Polys command.

Dialogue Boxes

Some commands require variables, such as find_obj or add_family. While you can write menu items that load specific texture families (e.g. Add Church Textures:add_family Church), or find specific objects, you can also add items that ask for user input. End the command with two @ symbols to have a dialogue box shown.

Example: Add Find Object to a menu. Find where the commands for that menu are listed (e.g. menu_edit_x), and add the following item:

Find Object:find_obj @@

Save the file and load Dromed. Select the new command and supply it with some valid input, e.g. type in marker. Another advantage of using dialogue boxes is that they can accept text that is pasted in, so if someone tells you to find an object with a very long name, you can just copy and paste what they’ve written.

Default Values of Dialogue Boxes

The original menus.cfg has the item Sides in &Base…:prim_sides @@6 Sides (used for cylinders and pyramids). When the item is selected, the dialogue box will have 6 Sides already entered. Technically it’s not a valid input. All that’s needed is the number, and Dromed will simply ignore the Sides part. Komag’s menu will simply have an 8 in there.

The custom menus by Yanrdos and Nameless Voice contain examples of submenus, and they all contain examples of dialogue boxes and default values.

dromed/custom_menus.txt · Last modified: 2010/07/17 09:35 by r_soul