Skip to content

User Defined Permission

LeonaMorro edited this page Nov 29, 2017 · 5 revisions

nPose V3.10 and above

User Defined Permissions (UDP) is an extension of the Button Permissions, which allows all scripts to register their own button permissions which are than handled by the menu script. To do so, the menu have to know 3 things:

  1. the Name of the UDP
  2. the Type of the UDP
  3. the Value of the UDP

UDP Name

The name is chosen by you. It has to be unique. Therefore we maintain a list with registered UDP names (UDP Register). If you want to use UDP for your own purpose (don't want to give your scripts away) you should prefix your UDP name with my. UDP names with the myprefix don't need to be registered.

UDP types and values

Currently there are 2 types of User Defined Permissions, a bool type and a list type.

UDP type bool

The bool type expects a simple boolean value as the udpValue:

0: FALSE
all other values: TRUE

Using this type allows you to simply switch on/off menu buttons.

UDP type list

The list type expects a list of Avatar UUIDs (concentrated into a string) as the udpValue. You may use any seperator except "," and "|" and "=". If the UUID of the Avatar using the menu is inside this "list", the corresponding UDP is evaluated as TRUE (the button is shown).

Examples

nPose DayNight Plugin

This shows you the use of the bool type. You may also find it here:
https://github.com/LeonaMorro/nPose-DayNight-plugin

nPose AccessControlList Plugin

This shows you the use of the list type (and also the use of the new NC Reader). You may also find it here:
https://github.com/LeonaMorro/nPose-AccessControlList-plugin

Code Fragment for your custom script

LSL example UDPBOOL:

integer UDPBOOL=-804;
string UDP_NAME="*** the name ***";
string udpValue="*** the value ***"; //must not contain a "," or "|" or "="
llMessageLinked(LINK_SET, UDPBOOL, UDP_NAME + "=" + udpValue, NULL_KEY);

LSL example UDPLIST:

integer UDPLIST=-805;
string UDP_NAME="*** the name ***";
string udpValue="*** the value ***"; //must not contain a "," or "|" or "="
llMessageLinked(LINK_SET, UDPLIST, UDP_NAME + "=" + udpValue, NULL_KEY);

Every time the udpValue changes, this linkMessage has to be send.

Syntax of the string part of the linkmessage:
UDP_NAME1=udpValue1[|UDP_NAME2=udpValue2[| ...]]