MLPV2 Reference Manual

From Second Life Wiki
Revision as of 15:54, 3 August 2008 by Chaz Longstaff (talk | contribs) (added note about swap)
Jump to navigation Jump to search

MLPV2 Reference Manual

.MENUITEMS* NOTECARDS

Menu notecards create menus.

When MLP2 starts up, it reads all .MENUITEMS* ("*" can be anything) notecards, in the same order as they're shown in object contents. You can have as many MENUITEMS notecards as you wish, or just one. MLP2 essentially reads all MENUITEMS notecards as though they've been concatenated into one big file.

The first two things (other than comments) MLPV2 reads from a MENUITEMS notecard MUST be two POSE statements, first for "default" and second for "stand" -- even if you don't use the STAND button anywhere.

After that, it expects directives and MENU commands to build menus.

The first MENU created is the main menu, which a user gets on touching the MLP 2.x object. The remaining menus are reached via buttons configured using TOMENU.

There are several built-in commands that you use to build your menu, as well as several options.

Many menu commands can have "synonyms" to present themselves to users as buttons with more use-friendly language.

The syntax for this is:

COMMAND Friendly Text

Note the space in between the command and the friendly text.


COMMENTS

Comments in MENUITEMS notecards must be preceded by "//".

Any subsequent text on that line is ignored by the scripts.

Example 1:

//all this text is ignored

Example 2:

STOP // STOP is read by the scripts; but this part of the line is ignored.


DEFAULT / STAND

Place these are the very top of your MENUITEMS notecard. (You may insert commented lines before this; commented lines don't count.)

You may if you wish name other animations to use; these are standard ones built into the SL Client that you don't actually need an animation for. [1]

Example:

POSE stand | stand | stand  | stand  //pose before starting and when stopping
POSE default | sit_ground | sit_ground | sit_ground //default pose when no animation entered

See the default pose tip for help on setting coordinates for the default pose.


DIRECTIVES

Directives affect the overall behavior of MLP2. It doesn't really matter where in the .MENUITEMS* files they are, but by convention, they appear after the default and stand poses. ( To be clear: directives don't cause a menu button to appear.)

There are 4 directive options. All are case-sensitive and so therefore you must use them in uppercase as shown here.

If you want a directive to be acted upon, type its name into your menu card. If you don't, either just leave it out, or comment it out.

Keyword Explanation
AUTOBACK

Automatically inserts BACK before the MORE--> button *except* on single pages, and *except* on the last page of multi-page submenus. If you want BACK on such pages, you must do it manually.

AUTOMORE

Automatically inserts "More-->" button for menus with more than 12 buttons *except* for the main menu. If you need a "More-->" on the Main Menu, you must add one manually.

You would add a manual one like this:

MORE More-->

(Note: MORE is the actual command; More--> is the synonym.

MENUORDER This directive causes all menu buttons to appear in menus in the same order as they appear in the .MENUITEMS* files. If absent, menus are in the group-by-3-backwards order typical of SL menus, like original MLP. If present *anywhere* in the .MENUITEMS files, it affects all menus.
NORELOAD

This directive causes MLP2 not to do a menu reset when rezzed.


MENU COMMANDS

These will cause buttons to appear on menus.

Keyword Explanation
ADJUST

Sometimes shown on menu items with a synonym, like this:

ADJUST ADJPOS   

The ADJUST command makes the balls turn into long, translucent beams for easy editing to manoeuvre them into their proper positions for each pose.

See tip on adjusting beams.

BACK

This creates a button labelled "BACK" that, when pressed, displays the menu one level up in the menu hierarchy.

If you wish, you may present it with a synonym, like this:

BACK << Back

If you use the directive AUTOBACK, you will only need to manually put this on the last page of a submenu.

BALLUSERS

Cycles through the access levels concerning who can sit on the poseballs.

The levels are OWNER, GROUP and ALL

BALLUSERS BallUsers | ALL

The | ALL parameter in this example sets it to default to the balls being accessible to ALL on first being booted.

CHAT

This command toggles ON and OFF how much the MLP product will give information messages to the users.

CHAT Chattiness | ON

The | ON parameter sets it to default to being ON on first being booted.

CHECK

Sometimes shown on menu items with a synonym, like this:

CHECK ConfigCheck

This will find buttons with no positions and vice versa.

Caution! This will reload all .POSITIONS.* files, so first backup any positions that are saved to script memory only!

DUMP

Sometimes shown on menu items with a synonym, like this:

DUMP MEMDUMP  

Lists in chat audible only to the prim owner all positions currently stored in script memory. The user is meant to then copy/paste this information into the .POSITIONS notecard for backup. NOTE! It is for this reason that the .POSITIONS notecard should if at all possible be released to customers as MODIFY.

DUMPPROPS

Causes all the prop positions you have saved to be printed to the screen. They are visible to the MLP product owner only. These are then to be copied and pasted to the .PROPS notecard for permanent storage.

You cause this command to appear like this in a menu:

LINKMSG Dump Props | 0,-4,1,DUMPPROPS    // dump all prop configs
HIDE

Causes any MLP pose balls rezzed to become invisible. Not many MLP product makers bother with offering this command. The opposite is the SHOW command.

INVISIBLE

Sometimes shown on menu items with a synonym, like this:

INVISIBLE Show/Hide

Toggles visibility for the prim that the MLP scripts are in. Note, this does not apply to the balls, or any other prims, even linked ones.

LINKMSG

This creates a button that will send a specified link message to other scripts in the object when the button is pressed. This is useful for adding scripted features to MLP2 without having to modify MLP2 scripts.

LINKMSG name | menu,primnum,lm-num-arg,lm-str-arg
Parameter Explanation
name What you want the button to be called on the menu.
menu Set to 1 if the script receiving the button will pop up a menu. It causes MLP2 not to repost its menu, to avoid menus stacking up. Set to 0 otherwise -- (note: this doesn't inhibit MLP2's remenu feature.)
primnum primitive number (e.g. LINK_ROOT, LINK_SET, LINK_ALL_OTHERS,

LINK_ALL_CHILDREN,LINK_THIS. See llMessageLinked() documentation in LSL Wiki on the web)

lm-num-arg 'num' arg for llMessageLinked()
lm-str-arg 'str' arg for llMessageLinked()

The menu user's UUID key is passed automatically as the 'key' argument for llMessageLinked().

MENU

The menu's buttons are configured following the MENU statement.

MENU name1 | who

or

MENU name1 | who | ballcolors

This creates a menu named name1.

Those who can access it are specified by who, one of the following:

Keyword Explanation
ALL Anyone can use it
GROUP Only those who are wearing a group tag that matches the object's group can use it
OWNER Only the object owner can use it
MENUUSERS

Cycles through the access levels concerning who can use the menu.

The levels are OWNER, GROUP and ALL

MENUUSERS MenuUsers | ALL

The | ALL parameter in this example sets it to default to being accessible to ALL on first being booted.

OFF

Often referred to in menu cards as "Shutdown, using an alias for the button name like this:

OFF ShutDown! 

This first sends out a llDie() command to any balls out there, then unseats any participants, then resets the ~run script.

Upon restarting, the ~run script is set to set all other scripts to not running (until the prim is clicked again, at which point it turns them back on again.)

This has the effect of shutting off the listen that is in the ~menu script. It also turns off the four other listens in each of these scripts: ~poser, poser1, poser2, and poser3.

With all the listens turned off, as well as all the other scripts, this helps to reduce the "footprint" of an MLP product in a sim.

POSE

This creates a button for a pose labeled pname, using the animations listed after the vertical bar.

POSE pname | anim1 | anim2 |anim3 |anim4 |ballcolour1|ballcolour2|ballcolour3|ballcolour4

The animations are applied to the balls specified, in order. That is, if the ball colors are "PINK BLUE PINK", three animations should be listed. The first applies to the first pink ball, the second to the blue ball, and the third animation applies to the third ball, which is pink. (See also "Ball Colours" option below for more information.)

The ball positions are specified in a .POSITIONS* file, discussed below. If there is no .POSITIONS entry for a pose, the default pose is used. It's a good idea to always set up the default pose first for a new MLP product, to avoid balls rezzing underground or in other inconvenient locations.

Each animation name must have a corresponding animation in the object's contents (note: to be clear, you cannot refer to animations by UUID.)

Note: in technical terms, the | separator is called a PIPE symbol. It does not matter whether you prefer to go:

anim1|anim2|anim3|anim4

or to leave a space on either side of the PIPE symbol to increase readability like this:

anim1 | anim2 | anim3 | anim4

It's your choice.

RELOAD

Sometimes shown on menu items with a synonym, like this:

RELOAD Pos Reset    

Resets just the ~memory script, which in turn also resets the ~props script.

The ~memory script is the script that reads information in from the .POSITIONS card.

RESET

Sometimes shown on menu items with a synonym, like this:

RESET Menu Reset

This command restarts the following scripts by resetting them:
~menu
~menucfg
~pos
~pose
~poser
~poser 1
~poser 2
~poser 3
~props

The two scripts not restarted are: ~memory and ~run.

RESTART

Does what both RESET and RELOAD do, combined.

RESTART is therefore the most thorough command to use for a complete reboot.

SAVE

Sometimes shown on menu items with a synonym, like this:

SAVE SAVEPOS  

The SAVE command creates a button on the menu to this effect. When clicked, it saves to script memory the settings for the pose currently being played.

Immediately after adjusting a pose, always, ALWAYS click this button! You will no doubt, like all of us, lose a few adjustments that you make when you first start out with MLP before this gets scarred into your habits.

Caution! This is not permanent. Anything that causes the .positions cards to be re-read will wipe these settings out from script memory. It's only permanent when you do a DUMP and copy and paste the results to a .positions card.

SAVEPROP

You use this command after you have arranged a prop. This stores information about the position, etc, to script memory.

To cause this command to appear on a menu, you do this:

LINKMSG Save Prop | 0,-4,1,SAVEPROP      // save position/rotation for a prop

This information will also be printed to the screen (only the owner can see it.) This information should be copied to the .PROPS notecard for permanent storage. You can either do this right on the spot, or arrange and save a whole bunch of prop positions, and then use the DUMPPROPS command to print out all the prop info at once for copying and pasting to the .PROPS notecard.

SHOW

Causes any MLP pose balls rezzed to become visible, if they are not already. Not many MLP product makers bother with offering this command. The opposite is the HIDE command.

STOP

This creates a button labeled "STOP" that, when pressed, deletes any rezzed balls and unseats any participants.

Note though that, unlike OFF (covered below) it does not turn off the "listen" that the menu script is doing for menu commands. The menu will keep on listening, even when not in use.

SWAP

This creates a menu button labelled "SWAP". When pressed, this swaps positions between the first and second balls for any pose. It has no effect on any third or fourth balls in a pose.

Note: In some animation menuing systems such as XPOSE (as of summer 2008), hitting the SWAP button only swaps the current pose; the swap is lost at the next pose. In MLP, the SWAP is maintained until a user chooses to SWAP back.

TOMENU

TOMENU name1

This creates a button labeled name1, leading to menu name1, which is usually configured in a subsequent MENU statement.

If a menu (say, name2) exists, and there is no TOMENU statement on another menu, and if there are "TOMENU -" statements for the main menu, a button for name2 is added to the main menu.

Z

The Z command allows end users to easily adjust for themselves the height of the poseballs (note: only the height.)

You specify a range of whole numbers (aka "integers"), which can be positive or negative, preceded by a Z.

The numbers are treated by MLP as being a measurement in centimetres. Each time a user clicks a button, say Z+5, the height will be increased by 5 centimetres. If they have previously clicked the Z+5 button, then the height will be increased by an additional 5 centimetres.

Clicking a Z-5 button, if offered, would decrease the height.

Note that Z adjustments chosen by users apply to all the poses, not just the one currently being used.

These adjustments are not stored permanently. They are lost when the scripts in the prim are reset, or the Stop button is clicked twice, or the MLP product is rebooted.

Example:

Z+1 //adjust Z = height offset in cm - use any integer to set the step size
Z+5
Z+25
Z-1
Z-5
Z-25

Traditionally, MLP product makers have put these Z commands under the OPTIONS menu.

We now recommend, though, that they all be put together under a separate submenu called "HEIGHT."

See the Tip! Options Menu for more info on how exactly to do this.

See the Tip! Options Menu table at the end of this page for helpful advice on arranging many of these menu commands into a tidy sub-menu.


MENU PARAMETERS

Keyword Explanation
Animations (Facial)

You can cause an animation to also produce a facial expression on the person using the animation. To do this, you add to the animation name in the menuitems card a suffix (as per the table immediately following) specifying which facial animation you would like.

suffix expression
* mouth open
::1 mouth open
::2 surprise
::3 tongue out
::4 smile
::5 toothsmile
::6 wink
::7 cry
::8 kiss
::9 laugh
::10 disdain
::11 repulsed
::12 anger
::13 bored
::14 sad
::15 embarrassed
::16 frown
::17 shrug
::18 afraid
::19 worry
::20 sleep

Note: 20 is a combination of disdain and smile, the closest that could be found for sleep.


There must be NO SPACE between the animation name, and the suffix. Example:

POSE Sleep 01 | Sleep 01 F::20 | Sleep 01 M::20 

To make the expression happen periodically rather than constantly, add another extension and the length of the repetition cycle (in seconds).

For example, to use MyAnim with open mouth every 5.5 seconds:

POSE Mypose | MyAnim::1::5.5


If during menu boot you get an error that says "animation xyx not found", but you know that animation xyx really is in there, check to see that you didn't put a space before the expression suffix after all.

Note that this suffix appears only in the POSE line of a MENU; the actual name of the animation in the object's contents folder should *not* be changed to have this suffix. (Many anims are sold no mod; so you wouldn't be able to, anyway.)

Ball Colours

If a MENU has no pose ball colours listed, it should have no POSE buttons.

When, however, a particular MENU will contain POSE statements in it, then the MENU statement must be followed by a set of ball colours to be used for all poses in this particular menu.

One to four balls can be specified, supporting poses for up to four participants. The balls are rezzed as necessary when a pose in the menu is selected.

Supported colours as of summer 2008 are:

PINK PINK2 BLUE BLUE2 WHITE
GREEN GREEN2 RED RED2 BLACK
MAGENTA ORANGE YELLOW CYAN TEAL

PINK2, BLUE2, RED2, and GREEN2 are darker their respective colours with no number after them.

Note: The colours must be given in uppercase as shown above.

Examples:

MENU boy-girl | ALL | BLUE | PINK
MENU Boy Only | ALL | BLUE | HIDE
MENU Girl Only | ALL | PINK
MENU Anyone | ALL | GREEN
MENU 3Some  | ALL | PINK | BLUE | PINK
MENU 4Some  | ALL | PINK | BLUE | PINK | BLUE


.POSITIONS* NOTECARDS

The .Positions notecards, as their name implies, provide a permanent place for storing information about the poses in the menu.

As long as any adjustments you have made have only been saved via the SavePos buttons, assume them to be "temporary". They are only saved in script memory, and script memory is volatile. If you hand the MLP v 2.0 object to someone else, or if your sim crashes really terribly or if the script blows up with a stack-heap error, etc ... you may lose all the work you'd thought you'd saved.

The notecard(s) is/are populated by your manually copying and pasting in information from the MemDump operation (described above.) The reason you have to do this manual part is that Linden Labs for a variety of technical reasons cannot yet let us write via scripts directly to notecards (and some think, given how notecards are handled in the SL system, that they may never be able to let us.)

Remember that purchasers of your MLP 2.0 product are meant to be able to adjust poses to fine-tune them to their own heights, sizes, etc. The .position(s) notecard(s) should be supplied to end-users with MODIFY rights so that they too can permanently save all their hard work. [2]

The lines in the .positions notecard look something like this:

{LieHold1} <-0.253,0.157,0.285> <0.0,0.0,0.0> <-0.146,0.000,0.177> <0.0,0.0,90.0>

The 4 vectors in the above example represent in order: first ball position, first ball rotation, second ball position, second ball rotation

If there are 3 and / or 4 balls also involved in a given pose, then the pattern repeats on for them as well.

If you rename a pose in the menu that you have already stored a position in the notecard for, be sure to edit the .positions card, locate that pose in it, and give it the new name as well to match.

Be sure to purge out position lines for which menu items no longer exist. This is one instance in which tidiness really does pay off: all that old, unneeded position information is read into the scripts' memory, which can make you think that your MLP product is "full" (that fatal stack-heap msg) and can't hold any of the other poses you had planned to add.

Note: Comparing positions to menu items is easier and the work of seconds as opposed to minutes if you keep the positions information cleaned up. See the tip on tidying .POSITIONS notecards, if you wish to do this extra (not-required) work.


TIP! ADJUST Beams


TIP! Default Pose

You need to set position coordinates for the default pose. To do this, on the MLPV2 main menu click the "adj-default" button, then ADJUST the default pose position, save, and copy the coordinates to the .positions notecard as per normal. When you have finished, delete the .MENUITEMS.zz-default notecard from the prim.

If on the main blue menu you do not see a button called "adj-default", do the following steps:

1) Create a notecard with the file name of:

.MENUITEMS.zz-default

Paste the following in as content:

 
// The "default" pose below is for adjusting "default" position.
// Since there are currently no other items in this menu, you can comment out the whole menu<br />
// or simply delete this file when  you've done that.

MENU adj-default | ALL | BLUE | PINK | BLUE | PINK
POSE default | sit_ground | sit_ground | sit_ground | sit_ground
SWAP
ADJUST
SAVE Save Pos
DUMP Mem Dump
BACK

Tip! If the product you are making is only for 1 or 2 people, then you don't need to include all 4 balls that are listed in the menu above. For a solo product, you can just do instead:

 MENU adj-default | ALL | BLUE
 POSE default | sit_ground
 ADJUST
 SAVE Save Pos
 DUMP Mem Dump
 BACK


Drop this notecard into the prim where you are working with MLPV2.

2) Make sure the main menu notecard has a spare TOMENU slot to fit the adj-default choice into:

TOMENU -


3) restart the MLPV2 product.

4) ADJUST the default pose position, save, and copy the coordinates to the .positions notecard as per normal.

5) When you have finished, delete the .MENUITEMS.zz-default notecard from the prim.


TIP! OPTIONS Menu

By "tradition", most of the common functionality command buttons are stored under a MENU called "OPTIONS."

Such commands include ADJUST, SAVE, DUMP, Show/Hide (aka INVISIBLE), MenuUsers, BallUsers, Chat, Dump Props, Save Prop, etc.

As well, the z commmands for height adjustment were traditionally offered there as well.

With the rapidly-increasing number of functions available within MLP, however, the OPTIONS submenu is becoming very crowded.

Consquently, consider taking all the z height adjusting options out from under OPTIONS and put them in a sub-menu like this:

MENU HEIGHT | ALL
 Z+1 //adjust Z = height offset in cm - use any integer to set the step size
 Z+5
 Z+25
 Z-1
 Z-5
 Z-25
 BACK

Then, in the OPTIONS menu, just make this button linking to the HEIGHT submenu:

TOMENU HEIGHT


TIP! POSITIONS Notecard tidying

The lines in the .positions notecard look like this when copied and pasted in directly from chat:

[7:46] Animated Living Sofa Combo Couple & Solo 2.1e: {Lie&Hold} <-0.413,0.130,0.245> <1.0,-9.0,-0.9> <-0.539,0.207,0.155> <-0.1,-8.9,-1.1>

The extraneous chatter before the {LieHold1} parameter in the curly brackets (aka braces) is ignored by the scripts, so there is no need to delete it.

Still, if you as an MLP professional wish cleaner, easier to read content (which is a boon for easier maintenance and troubleshooting), then copy the contents of the .positions card in question into a simple text programme (such as Notepad on a Windows PC), and using the example above, you would search for:

[7:46]  Animated Living Sofa Combo Couple & Solo 2.1e:  [including the final space at the end of it]

and just replace it with nothing, and then paste the cleaned up text back into the .positions card.

The cleaned up text then looks like this.

{LieHold1} <-0.253,0.157,0.285> <0.0,0.0,0.0> <-0.146,0.000,0.177> <0.0,0.0,90.0>


You may wish to also to SORT the positions in alpha order to make it easier to find them.

So that instead of:

{Massage} <-0.230,-0.133,-0.287> <0.0,0.0,-86.0> <-0.287,0.259,0.161> <0.0,0.0,-82.0>
{Sprawl 1} <0.960,0.000,-0.190> <0.0,0.0,0.0> <0.700,0.000,0.700> <0.0,0.0,-180.0>
{Lie 01} <-0.115,-0.069,0.694> <0.0,0.0,-90.0> <-32.417,-199.035,-518.585> <0.0,0.0,0.0>
{Couch 1} <-0.179,0.001,0.143> <0.0,-19.0,0.0> <0.700,0.000,0.700> <0.0,0.0,-180.0>

You have

{Couch 1} <-0.179,0.001,0.143> <0.0,-19.0,0.0> <0.700,0.000,0.700> <0.0,0.0,-180.0>
{Lie 01} <-0.115,-0.069,0.694> <0.0,0.0,-90.0> <-32.417,-199.035,-518.585> <0.0,0.0,0.0>
{Massage} <-0.230,-0.133,-0.287> <0.0,0.0,-86.0> <-0.287,0.259,0.161> <0.0,0.0,-82.0>
{Sprawl 1} <0.960,0.000,-0.190> <0.0,0.0,0.0> <0.700,0.000,0.700> <0.0,0.0,-180.0>

You can do this sorting in seconds by copying & pasting the (cleaned-up position chatter) into something such as Microsoft Word, or a spreadsheet, and telling it to sort, and then copying & pasting the sorted positions back into the .positions notecard. (This really works best though if you have stripped the initial chatter info from them.)


  1. ^ For a list of other built-in animations, see here: [1].
  2. ^ Some furniture makers prefer to sell their furniture no mod so that others can't just disassemble it and copy the dimensions of the pieces and thereby duplicate the furniture -- fair enough. However, if the .positions notecard is in a no-mod prim, it will also be no mod. There doesn't seem to yet be a way around this. While llAllowInventoryDrop in a small add-on script might seem promising (and the change event could be set to delete the old .positions card), the problem remains that by then, a fresh positions card the user had dropped in would already be named .positions 1, an invalid file name. Because you can't rename objects inside a prim, you'd have to then have your script delete that .positions 1 card as well, and then invite the user to drop his/her fresh .positions notecard in a second time, which would be very confusing. Or, using the LINKMSG feature, create a button that tells a script to delete the .positions notecard, and then invites the user to drop a new one in. But you'd want that script to ask the user if s/he really knew what they were doing.