Skip to content
HowardBaxton edited this page Aug 30, 2015 · 1 revision

The bare minimum we will need to build a working menu system are as follows: One prim. The nPose menu script inside, and the nPose dialog script inside. Locate these two scripts in the nPose release folder. Rez a box and edit the box. Copy these two scripts from your inventory into the Contents tab of the edit window. The nPose system is notecard driven and uses the names of notecards to build it's menu system. If you click the rezzed box, currently you will see no menu.

Before we move further we need to discuss some naming conventions to help us understand what we need to build our menu system. The menu script will read through all the notecard names it has in the Contents tab of the same prim. It is looking for some key words at the beginning of the notecard name. When it finds one of these key words it will do some tricks and add the notecard name to a menu structure list. There are three key words the menu script is looking for. They are SET, BTN, and DEFAULT. The menu script doesn't care what is inside the notecards, it is only interested in the name. Once it finds one of these notecards, it will look in the name for another element which will be used as text on a menu button. The menu looks for a colon ":" as a separator of these elements. If we make a notecard in our inventory and name it BTN:Test, we can drag and drop that notecard into the contents of our prim containing the two scripts.

IMPORTANT NOTE: A NOTECARD THAT HAS NOT HAD SOME MODIFICATION INSIDE IS CONSIDERED AN INVENTORY PLACE HOLDER AND WILL NOT HAVE A UUID ASSIGNED TO IT. fOR THE MENU TO USE IT, THIS NOTECARD MUST HAVE IT'S CONTENTS MODIFIED AND SAVED.

Now when we click the box, we will get a menu and will see a button with the word Test on it. If the menu does not come up for you, there is something wrong with that notecard's name. Take a close look at it. It should have the first word as one of those key words above, followed by a colon, and last is the text to be displayed on the menu button. Feel free to create a couple more notecards utilizing the other two key words, SET, and DEFAULT but put up a different button text for each. Keywords must be in capital letters. Once more notecards are added, you'll see these button in the menu once clicked again.

Before we continue, we will discuss the three key words and what nPose will do differently with each. When nPose sees the key word SET, it expects to find information inside about an animation. For now it should be said that nPose will process several other types of informations also but the animation information is foremost. The menu script will take the very first SET notecard it sees and utilize this notecard as the one to run just after a reset of the scripts. The default pose set is also stored and nPose can be setup to return to this pose when everyone stands. How nPose uses the default pose has a few more optional behaviors. We discuss how to set this up in the Options lesson.

If we have multiple notecards with the SET key word we may not want to use the first one for our default. We can pick the SET notecard we would rather use and replace the SET key word with the DEFAULT key word. The menu script actually reads the notecards as they appear in the Contents tab (from top to bottom). SET notecards and the DEFAULT notecard are treated exactly the same by nPose. Since the DEFAULT notecard will always come first in the Contents, it will become the one that the menu will use as the default notecard.

NOTE: ONLY USE ONE DEFAULT NOTECARD IN YOUR BUILD. UNEXPECTED RESULTS WILL OCCUR WITH MULTIPLE DEFAULT NOTECARDS.

When nPose sees the key word BTN, it expects the contents of the notecard to be a command to be carried out at the time the notecard is read. We will discuss this later also. For this introduction to nPose I'll just say; BTN cards will not run animations. "Disclaimer": it can be done with some advanced trickery.

We have already put up a series of buttons all of them in the root menu. We can do sub menus with nPose as well. We know that the notecard name must begin with a key word, followed by a colon, and then followed by the text on the button. We can continue that protocol by following this button text with a colon and adding another button text. This will create a sub menu for us. Make another notecard in inventory and name it SET:Singles:BoySit1. Drop this notecard into contents and click for menu. You will see our button with 'Singles' on it. Click this button and a sub menu will open with BoySit1 on the button. Make another notecard in inventory and name it SET:Singles:BoySit2. Drop this notecard into contents and click for menu. This time our sub menu will have 2 buttons showing: BoySit1, and BoySit2. This is all there is to making sub menus. You'll be able to make sub sub menus or even sub sub sub menus.

Note: The length of the text that fits onto a button is roughly 12 characters. Use some creative names to have the text fit on these buttons.

In some cases it may not make sense to re-menu after a button click on the menu. For example, BTN:Utilities:Admin{owner}. This notecard has a LINKMSG inside which calls a second menu and nPose will also re-menu and two menus will be displayed (one over the top of another). This is really not a desirable situation and can be avoided by adding a minus to the end of the button name, thus the button name would be BTN:Utilities:Admin-{owner}. For esthetics of the displayed button name use something like BTN:Utilities:-Admin-{owner}

Button permissions:

We can set permissions for a notecard which will selectively hide the button in the menu. See document ["Button Permissions"](Button Permissions) for more information on how to use them.

Clone this wiki locally